Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Creates Claude Code hooks for automation and workflow customization. Guides through hook events, configuration, and script creation. Use when user wants to create a hook, automate Claude Code, or asks about hook events.
.claude/skills/aiskillstore-creating-hooks/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | -11% | 0% |
| case-02 | ✗→✓ | ▲ Improved | -12% | 0% |
| case-03 | ✗→✓ | ▲ Improved | 18% | 0% |
| case-07 | ✗→✓ | ▲ Improved | -5% | 0% |
| case-08 | ✗→✓ | ▲ Improved | -11% | 0% |
Guides creation of Claude Code hooks for automation and workflow customization.
Progress:
- [ ] Select hook event
- [ ] Add to settings.json
- [ ] Create hook script
- [ ] Test and validate| Event | When It Triggers | Common Use | |-------|------------------|------------| | PreToolUse | Before tool runs | Block/modify tools | | PostToolUse | After tool succeeds | Validate, log, feedback | | UserPromptSubmit | User sends message | Inject context, validate | | SessionStart | Session begins | Load context, init state | | SessionEnd | Session ends | Cleanup, save state | | Stop | Agent finishes | Decide if should continue |
Full event reference: reference.md
Location priority (highest wins):
.claude/settings.local.json (local, not committed).claude/settings.json (project)~/.claude/settings.json (user)Basic structure:
json{ "hooks": { "EventName": [ { "matcher": "ToolPattern", "hooks": [ { "type": "command", "command": "bash \"$CLAUDE_PROJECT_DIR/.claude/hooks/my-hook.sh\"" } ] } ] } }
Use templates from templates/ directory.
Key requirements:
Run hook manually with test input:
bashecho '{"tool_name":"Write"}' | bash .claude/hooks/my-hook.sh
json"matcher": "Write" // Exact match "matcher": "Edit|Write" // Multiple tools "matcher": "mcp__.*" // MCP tools (regex) "matcher": "*" // All tools
Matchers apply to: PreToolUse, PostToolUse, PermissionRequest
json{ "type": "command", "command": "...", "timeout": 120 }
Default: 60 seconds. Max recommended: 300 seconds.
| Code | Meaning | Behavior | |------|---------|----------| | 0 | Success | Continue normally | | 2 | Block | Stop action, show error | | Other | Non-blocking error | Log only (verbose mode) |
Return JSON to stdout for decisions:
json{ "decision": "block", "reason": "Why blocked", "additionalContext": "Info for Claude" }
Decision values by event:
PreToolUse: allow, deny, askPostToolUse: block (with reason)UserPromptSubmit: block (with reason)Stop: block (requires reason)"$VAR" not $VAR"$CLAUDE_PROJECT_DIR/..."..Available in all hooks:
CLAUDE_PROJECT_DIR - Project root pathCLAUDE_CODE_REMOTE - "true" if web environmentSessionStart only:
CLAUDE_ENV_FILE - Path to persist env varsbash#!/bin/bash # Output context for Claude echo '{"additionalContext": "Project uses TypeScript"}' exit 0
bash#!/bin/bash INPUT=$(cat) FILE=$(echo "$INPUT" | jq -r '.tool_input.file_path // empty') if [[ "$FILE" == *".env"* ]]; then echo "Blocking edit to sensitive file" >&2 exit 2 fi exit 0
bash#!/bin/bash INPUT=$(cat) TOOL=$(echo "$INPUT" | jq -r '.tool_name') echo "$(date -Iseconds) $TOOL" >> "$CLAUDE_PROJECT_DIR/.claude/tool.log" exit 0
See reference.md for complete event details and more examples.
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→pass | 18,631 | 15,377 | -17% | 1 | 1 | 0% | 3,456 | 3,071 | -11% | 0 | 0 | — |
case-02 | fail→pass | 17,728 | 10,436 | -41% | 1 | 1 | 0% | 3,562 | 3,126 | -12% | 0 | 0 | — |
case-03 | fail→pass | 12,383 | 8,054 | -35% | 1 | 1 | 0% | 2,357 | 2,790 | +18% | 0 | 0 | — |
case-04 | pass→pass | 18,218 | 8,895 | -51% | 1 | 1 | 0% | 2,376 | 2,636 | +11% | 0 | 0 | — |
case-05 | pass→pass | 10,454 | 2,917 | -72% | 1 | 1 | 0% | 926 | 1,602 | +73% | 0 | 0 | — |
case-06 | pass→pass | 14,801 | 9,652 | -35% | 1 | 1 | 0% | 1,759 | 1,970 | +12% | 0 | 0 | — |
case-07 | fail→pass | 18,634 | 11,120 | -40% | 1 | 1 | 0% | 2,265 | 2,150 | -5% | 0 | 0 | — |
case-08 | fail→pass | 17,624 | 9,886 | -44% | 1 | 1 | 0% | 2,245 | 2,003 | -11% | 0 | 0 | — |
case-09 | pass→pass | 11,115 | 2,961 | -73% | 1 | 1 | 0% | 1,071 | 1,624 | +52% | 0 | 0 | — |
case-10 | pass→pass | 13,290 | 7,914 | -40% | 1 | 1 | 0% | 1,357 | 1,632 | +20% | 0 | 0 | — |
case-11 | fail→pass | 6,167 | 9,977 | +62% | 1 | 1 | 0% | 980 | 1,947 | +99% | 0 | 0 | — |
case-12 | pass→pass | 14,939 | 8,183 | -45% | 1 | 1 | 0% | 1,775 | 2,685 | +51% | 0 | 0 | — |
case-13 | pass→pass | 16,722 | 8,793 | -47% | 1 | 1 | 0% | 2,033 | 1,786 | -12% | 0 | 0 | — |
case-14 | pass→pass | 10,861 | 2,927 | -73% | 1 | 1 | 0% | 963 | 1,576 | +64% | 0 | 0 | — |
case-15 | pass→pass | 14,707 | 20,809 | +41% | 1 | 1 | 0% | 1,931 | 2,498 | +29% | 0 | 0 | — |
case-16 | pass→pass | 16,719 | 12,359 | -26% | 1 | 1 | 0% | 1,970 | 2,384 | +21% | 0 | 0 | — |
case-17 | fail→pass | 18,852 | 10,491 | -44% | 1 | 1 | 0% | 2,340 | 1,949 | -17% | 0 | 0 | — |
case-18 | fail→pass | 20,347 | 3,463 | -83% | 1 | 1 | 0% | 2,824 | 1,683 | -40% | 0 | 0 | — |
case-19 | pass→pass | 13,610 | 7,067 | -48% | 1 | 1 | 0% | 1,499 | 1,455 | -3% | 0 | 0 | — |
case-20 | pass→fail | 16,160 | 15,244 | -6% | 1 | 1 | 0% | 1,847 | 2,908 | +57% | 0 | 0 | — |
case-21 | pass→fail | 20,563 | 17,089 | -17% | 1 | 1 | 0% | 2,983 | 3,772 | +26% | 0 | 0 | — |
case-22 | pass→pass | 17,072 | 10,456 | -39% | 1 | 1 | 0% | 1,192 | 2,017 | +69% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of +27 percentage points is the difference between those two pass rates over the 22 comparable cases. 2 cases got worse with the skill loaded, and they are included in that figure.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.