Skip to content

Commit 87a7c20

Browse files
sjnimsclaude
andauthored
docs(hook-development): remove duplicated temporarily active hooks section (#68)
## Summary - Removed duplicated "Temporarily Active Hooks" section from SKILL.md (50 lines) - Updated patterns.md reference to "10 proven patterns including temporarily active and configuration-driven hooks" - Word count reduced from 2,125 → 1,979 words (now within 1,500-2,000 target) ## Problem Fixes #65 The "Temporarily Active Hooks" section in SKILL.md duplicates content from `references/patterns.md` (Pattern 9: Temporarily Active Hooks and Pattern 10: Configuration-Driven Hooks), violating the skill-development best practice of keeping SKILL.md lean through progressive disclosure. ## Solution Removed the duplicated section and enhanced the reference to patterns.md to explicitly mention the temporarily active and configuration-driven hook patterns. ### Alternatives Considered - **Keep both with cross-reference**: Rejected because it still violates the single-source principle - **Move patterns.md content to SKILL.md**: Rejected because patterns.md has more comprehensive examples ## Changes - `plugins/plugin-dev/skills/hook-development/SKILL.md`: Removed lines 531-578, updated patterns.md reference ## Testing - [x] Markdownlint passes - [x] Word count verified (2,125 → 1,979) - [x] Content verified in patterns.md (Pattern 9 & 10) --- 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude <noreply@anthropic.com>
1 parent 9c869df commit 87a7c20

1 file changed

Lines changed: 1 addition & 50 deletions

File tree

  • plugins/plugin-dev/skills/hook-development

plugins/plugin-dev/skills/hook-development/SKILL.md

Lines changed: 1 addition & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -528,55 +528,6 @@ All matching hooks run **in parallel**:
528528
3. Cache validation results in temp files
529529
4. Minimize I/O in hot paths
530530

531-
## Temporarily Active Hooks
532-
533-
Create hooks that activate conditionally by checking for a flag file or configuration:
534-
535-
### Pattern: Flag file activation
536-
537-
```bash
538-
#!/bin/bash
539-
# Only active when flag file exists
540-
FLAG_FILE="$CLAUDE_PROJECT_DIR/.enable-strict-validation"
541-
542-
if [ ! -f "$FLAG_FILE" ]; then
543-
# Flag not present, skip validation
544-
exit 0
545-
fi
546-
547-
# Flag present, run validation
548-
input=$(cat)
549-
# ... validation logic ...
550-
```
551-
552-
### Pattern: Configuration-based activation
553-
554-
```bash
555-
#!/bin/bash
556-
# Check configuration for activation
557-
CONFIG_FILE="$CLAUDE_PROJECT_DIR/.claude/plugin-config.json"
558-
559-
if [ -f "$CONFIG_FILE" ]; then
560-
enabled=$(jq -r '.strictMode // false' "$CONFIG_FILE")
561-
if [ "$enabled" != "true" ]; then
562-
exit 0 # Not enabled, skip
563-
fi
564-
fi
565-
566-
# Enabled, run hook logic
567-
input=$(cat)
568-
# ... hook logic ...
569-
```
570-
571-
**Use cases:**
572-
573-
- Enable strict validation only when needed
574-
- Temporary debugging hooks
575-
- Project-specific hook behavior
576-
- Feature flags for hooks
577-
578-
**Best practice:** Document activation mechanism in plugin README so users know how to enable/disable temporary hooks.
579-
580531
## Hook Lifecycle and Limitations
581532

582533
### Hooks Load at Session Start
@@ -681,7 +632,7 @@ echo "$output" | jq .
681632

682633
For detailed patterns and advanced techniques, consult:
683634

684-
- **`references/patterns.md`** - Common hook patterns (8+ proven patterns)
635+
- **`references/patterns.md`** - 10 proven patterns including temporarily active and configuration-driven hooks
685636
- **`references/migration.md`** - Migrating from basic to advanced hooks
686637
- **`references/advanced.md`** - Advanced use cases and techniques
687638

0 commit comments

Comments
 (0)