| name | hooks-automation |
| description | Configure Claude Code hooks for automated coordination and learning |
| version | 1.0.0 |
| invocable | true |
| author | agentic-flow |
| capabilities | ["pre_edit_hooks","post_edit_hooks","session_management","metrics_tracking"] |
Hooks Automation Skill
Configure intelligent hooks for automated coordination, formatting, and learning.
Available Hooks
PreToolUse Hooks
Triggered before Claude Code tools execute.
{
"PreToolUse": [
{
"matcher": "Edit|Write|MultiEdit",
"hooks": [{
"type": "command",
"command": "npx agentic-flow@alpha hooks pre-edit \"$TOOL_INPUT_file_path\""
}]
},
{
"matcher": "Bash",
"hooks": [{
"type": "command",
"command": "npx agentic-flow@alpha hooks pre-command \"$TOOL_INPUT_command\""
}]
}
]
}
PostToolUse Hooks
Triggered after successful tool execution.
{
"PostToolUse": [
{
"matcher": "Edit|Write|MultiEdit",
"hooks": [{
"type": "command",
"command": "npx agentic-flow@alpha hooks post-edit \"$TOOL_INPUT_file_path\" --success"
}]
}
]
}
Session Hooks
Triggered at session start/end.
{
"SessionStart": [{
"hooks": [{
"type": "command",
"command": "npx agentic-flow@alpha hooks intelligence stats --json"
}]
}],
"SessionEnd": [{
"hooks": [{
"type": "command",
"command": "npx agentic-flow@alpha hooks metrics --session --json"
}]
}]
}
Hook Commands
npx agentic-flow@alpha hooks pre-edit "src/api.ts"
npx agentic-flow@alpha hooks post-edit "src/api.ts" --success
npx agentic-flow@alpha hooks pre-command "npm install"
npx agentic-flow@alpha hooks post-command "npm install"
npx agentic-flow@alpha hooks route "implement OAuth"
npx agentic-flow@alpha hooks metrics --session
Automation Features
Auto-Agent Assignment
Hooks automatically assign specialized agents based on file type:
.ts, .tsx → TypeScript agent
.py → Python agent
.md → Documentation agent
test.* → Testing agent
Command Validation
Pre-command hooks validate for:
- Dangerous patterns (rm -rf, force push)
- Permission requirements
- Resource limits
Pattern Learning
Post-edit hooks learn:
- Code patterns
- Successful solutions
- Error recovery strategies
Metrics Tracking
Session hooks track:
- Token usage
- Tool invocations
- Success rates
- Performance metrics
Configuration
Full hook configuration in .claude/settings.json:
{
"hooks": {
"PreToolUse": [...],
"PostToolUse": [...],
"PostToolUseFailure": [...],
"SessionStart": [...],
"SessionEnd": [...],
"UserPromptSubmit": [...],
"Stop": [...]
}
}
Best Practices
- Keep hooks fast: <100ms for interactive experience
- Use timeout: Prevent hanging hooks
- Handle failures gracefully: Use
|| true for optional hooks
- Log metrics: Track for optimization
- Test hooks: Verify before deployment