Claude Code hooks that enable skill auto-activation, file tracking, and validation.
Hooks are scripts that run at specific points in Claude's workflow:
- UserPromptSubmit: When user submits a prompt
- PreToolUse: Before a tool executes
- PostToolUse: After a tool completes
- Stop: When user requests to stop
Key insight: Hooks can modify prompts, block actions, and track state - enabling features Claude can't do alone.
Purpose: Automatically suggests relevant skills based on user prompts and file context
How it works:
- Reads
skill-rules.json - Matches user prompt against trigger patterns
- Checks which files user is working with
- Injects skill suggestions into Claude's context
Why it's essential: This is THE hook that makes skills auto-activate.
Integration:
# Copy both files
cp skill-activation-prompt.sh your-project/.claude/hooks/
cp skill-activation-prompt.ts your-project/.claude/hooks/
# Make executable
chmod +x your-project/.claude/hooks/skill-activation-prompt.sh
# Install dependencies
cd your-project/.claude/hooks
npm installAdd to settings.json:
{
"hooks": {
"UserPromptSubmit": [
{
"hooks": [
{
"type": "command",
"command": "$CLAUDE_PROJECT_DIR/.claude/hooks/skill-activation-prompt.sh"
}
]
}
]
}
}Customization: ✅ None needed - reads skill-rules.json automatically
Purpose: Tracks file changes to maintain context across sessions
How it works:
- Monitors Edit/Write/MultiEdit tool calls
- Records which files were modified
- Creates cache for context management
- Auto-detects project structure (frontend, backend, packages, etc.)
Why it's essential: Helps Claude understand what parts of your codebase are active.
Integration:
# Copy file
cp post-tool-use-tracker.sh your-project/.claude/hooks/
# Make executable
chmod +x your-project/.claude/hooks/post-tool-use-tracker.shAdd to settings.json:
{
"hooks": {
"PostToolUse": [
{
"matcher": "Edit|MultiEdit|Write",
"hooks": [
{
"type": "command",
"command": "$CLAUDE_PROJECT_DIR/.claude/hooks/post-tool-use-tracker.sh"
}
]
}
]
}
}Customization: ✅ None needed - auto-detects structure
Purpose: TypeScript compilation check when user stops
Integration:
First, determine if this is right for you:
- ✅ Use if: Multi-service TypeScript monorepo
- ❌ Skip if: Single-service project or different build setup
If using:
- Copy tsc-check.sh
- EDIT the service detection (line ~28):
# Replace example services with YOUR services: case "$repo" in api|web|auth|payments|...) # ← Your actual services
- Test manually before adding to settings.json
Customization:
Purpose: Auto-launches build-error-resolver agent when compilation fails
Depends on: tsc-check hook working correctly
Customization: ✅ None (but tsc-check must work first)
When setting up hooks for a user:
- Read CLAUDE_INTEGRATION_GUIDE.md first
- Always start with the two essential hooks
- Ask before adding Stop hooks - they can block if misconfigured
- Verify after setup:
ls -la .claude/hooks/*.sh | grep rwx
Questions? See CLAUDE_INTEGRATION_GUIDE.md