npx skills add https://github.com/adaptationio/skrillz --skill hooks-managerSKILL.md
Hooks Manager
Overview
hooks-manager enables sophisticated workflow automation through Claude Code's hooks system (released June 2025).
Purpose: Create event-driven automation for code formatting, security gates, observability, and validation
Pattern: Task-based (8 operations, one per hook event + management)
Key Innovation: Hooks transform Claude Code from interactive to automated - reducing manual work by up to 92%
Hook Events Available (8):
- UserPromptSubmit - Before Claude sees prompts
- PreToolUse - Before tool execution
- PostToolUse - After tool execution
- PermissionRequest - When permissions requested
- Notification - Important events
- SessionStart - Session initialization
- SessionEnd - Session cleanup
- Stop - Conversation termination
When to Use
Use hooks-manager when:
- Auto-formatting code (PostToolUse after Write/Edit)
- Security gates (PreToolUse to block dangerous operations)
- Observability integration (send telemetry on all tool calls)
- Validation enforcement (block invalid operations)
- Workflow automation (trigger actions on events)
- Team standardization (enforce coding standards)
Production Impact: Companies report 92% reduction in style review time with PostToolUse formatting hooks
Prerequisites
Required
- Claude Code (hooks support added June 2025)
- Basic understanding of event-driven programming
Recommended
- Linter/formatter installed (ESLint, Prettier, Black)
- Security tools (if using security hooks)
- Observability platform (if using telemetry hooks)
Hook Operations
Operation 1: Create Formatting Hook (PostToolUse)
Purpose: Auto-format code after AI writes/edits files
Use Case: Enforce coding standards without manual intervention
Process:
-
Choose Formatter:
# JavaScript/TypeScript npm install --save-dev prettier # Python pip install black # Multi-language npm install --save-dev prettier @prettier/plugin-python -
Create Hook Configuration:
{ "event": "PostToolUse", "tools": ["Write", "Edit"], "description": "Auto-format code after Claude writes/edits files", "handler": { "command": "npx prettier --write \"$FILE\"", "timeout": 5000 }, "filters": { "filePatterns": ["**/*.{ts,tsx,js,jsx,py}"], "excludePatterns": ["node_modules/**", "*.min.js"] } } -
Install Hook:
# Global hook (all projects) mkdir -p ~/.claude/hooks echo '[above-json]' > ~/.claude/hooks/auto-format.json # Project-specific mkdir -p .claude/hooks echo '[above-json]' > .claude/hooks/auto-format.json -
Test Hook:
# Have Claude write unformatted code # Hook should auto-format after Write/Edit # Verify formatted correctly
Outputs:
- Hook configuration file
- Auto-formatting on all code changes
- 92% reduction in style review time
Validation:
- Hook file created
- Formatter configured correctly
- File patterns appropriate
- Tested with Claude Code
- Formatting works automatically
Time Estimate: 30-45 minutes
Operation 2: Create Security Hook (PreToolUse)
Purpose: Block dangerous operations before execution
Use Case: Prevent accidental production file modifications, destructive commands
Process:
-
Define Security Rules:
{ "event": "PreToolUse", "tools": ["Write", "Edit", "Bash"], "description": "Block dangerous operations", "handler": { "command": ".claude/hooks/security-check.sh \"$TOOL\" \"$FILE\" \"$COMMAND\"" }, "structuredOutput": true } -
Create Security Check Script:
#!/bin/bash # .claude/hooks/security-check.sh TOOL=$1 FILE=$2 COMMAND=$3 # Block production file modifications if [[ "$FILE" == "/etc/"* ]] || [[ "$FILE" == "/usr/"* ]]; then echo '{"continue": false, "stopReason": "Cannot modify system files", "suppressOutput": true}' exit 1 fi # Block destructive commands if [[ "$COMMAND" =~ rm\ -rf\ / ]] || [[ "$COMMAND" =~ dd\ if ]]; then echo '{"continue": false, "stopReason": "Destructive command blocked", "suppressOutput": true}' exit 1 fi # Block curl/wget (security risk) if [[ "$COMMAND" =~ curl|wget ]]; then echo '{"continue": false, "stopReason": "Network commands disabled", "suppressOutput": false}' exit 1 fi # Allow operation echo '{"continue": true}' exit 0 -
Install Security Hook:
chmod +x .claude/hooks/security-check.sh # Hook JSON already configured in step 1
Outputs:
- Security hook blocking dangerous operations
- Protection against accidental damage
- Audit trail of blocked operations
Validation:
- Hook blocks system file modifications
- Hook blocks destructive commands
- Hoo
...