| name | audit-hooks |
| description | Audit Claude Code hooks for safety, correctness, and best practices compliance. Checks settings.json configuration, hook scripts, error logging, and deployment readiness. Use when reviewing hook health, checking hook safety, validating hooks, or after adding/modifying hooks. |
| disable-model-invocation | true |
| allowed-tools | Read, Grep, Glob, Bash |
Hook Audit
Audits all Claude Code hooks registered in .claude/settings.json against the best practices defined in BEST_PRACTICES.md. Produces a structured report with PASS/WARN/FAIL dispositions per hook.
What this skill does
- Parse
.claude/settings.json and extract all hook entries
- Classify each hook as advisory (has
|| true) or validator (no || true)
- Run safety checks against BEST_PRACTICES.md rules
- Inspect each hook script for code-level issues
- Check deployment readiness
- Output a structured findings report
This skill is read-only. It does NOT auto-fix anything. Review findings and fix manually.
Audit Procedure
Step 1: Parse settings.json
Read .claude/settings.json and extract every hook entry. For each hook, record:
- Event type (UserPromptSubmit, PreToolUse, PostToolUse, Stop)
- Matcher (empty string = all, or specific tool name)
- Command string
- Timeout value
- Whether
|| true is present
Step 2: Classify hooks
| Classification | Criteria | || true required? |
|---------------|----------|-------------------|
| Validator | PreToolUse/PostToolUse + matcher + named validate_*.py | NO — must NOT have || true |
| Advisory | Any hook whose purpose is logging/tracking/enrichment | YES — must have || true |
| Stop | Any hook on Stop events | YES — must have || true |
Step 3: Check each hook against rules
For EACH hook command, check:
Settings-level checks:
Python script checks (for hooks targeting .py files):
Bash script checks (for hooks targeting .sh files):
Step 4: Deployment readiness
Step 5: Check logs/hooks.log
If logs/hooks.log exists, scan for recent errors (last 24h). Report:
- Total error count
- Unique hook names that errored
- Most frequent error message
Report Format
Output findings as a structured table:
## Hook Audit Report
### Summary
- Total hooks: N
- PASS: N | WARN: N | FAIL: N
### Findings
| Hook | Event | Type | Finding | Severity |
|------|-------|------|---------|----------|
| stop.py | Stop | Advisory | Has || true, has log_hook_error() | PASS |
| validate_commit_message.py | PreToolUse | Validator | No || true (correct) | PASS |
| calendar_prompt_hook.sh | UserPromptSubmit | Advisory | Missing || true | FAIL |
### Recommendations
[List specific fixes for FAIL and WARN items]
Severity Levels
- FAIL: Rule violation that can cause session hangs, silent failures, or security issues
- WARN: Suboptimal pattern that should be improved but is not immediately dangerous
- PASS: Hook follows all applicable best practices