hooks-check
Skill80 starsChanged 8 months agoMITView on GitHub
Validate hooks configuration and scripts. Use after adding or editing hooks in settings.json, before committing hook changes, or when a hook fails to fire.
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 2 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 17
Verify the hooks section exists and is valid.
- Distinctive: line 73
When a script does emit JSON, validate it against the event contract:
- Distinctive: line 113
Create missing hook scripts
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Hooks Validator
Validate hooks configuration in .claude/settings.json and hook scripts against
the official Claude Code spec.
Validation Steps
1. Check settings.json
Verify the hooks section exists and is valid.
2. Validate Hook Event Names
Claude Code defines 33 hook events. Accept any of them; flag unknown names
with a typo hint (e.g. PrePromptSubmit -> UserPromptSubmit,
PostToolBatchFailure -> PostToolBatch, SubagentStarts -> SubagentStart).
| Group | Events |
| Lifecycle | SessionStart, SessionEnd, Setup |
| Prompt | UserPromptSubmit, UserPromptExpansion |
| Tool | PreToolUse, PostToolUse, PostToolUseFailure, PostToolBatch |
| Permission | PermissionRequest, PermissionDenied |
| Subagent | SubagentStart, SubagentStop |
| Stop | Stop, StopFailure |
| Task | TaskCreated, TaskCompleted |
| Compaction | PreCompact, PostCompact |
| Notification | Notification, MessageDisplay |
| MCP elicitation | Elicitation, ElicitationResult |
| Model | PreModelSwitch, PostModelSwitch |
| Environment | ConfigChange, CwdChanged, DirectoryAdded, FileChanged, InstructionsLoaded, WorktreeCreate, WorktreeRemove, TeammateIdle |
That is all 33 events. See the official hooks docs for each event's payload.
3. Validate Each Hook Entry
typeis present and one of:command,prompt,http,mcp_tool,agent- If
type: command:commandpath exists and script is executable; a shell-form path variable is quoted ("$CLAUDE_PROJECT_DIR"/...), or the hook uses exec form (args) - If
type: promptoragent:promptstring is non-empty - If
type: http:urlis set; iftype: mcp_tool:serverandtoolare set matcheris a string if present (exact names joined by|or,,*, or a regex); warn when it sits on an event without matcher support (UserPromptSubmit,Stop,PostToolBatch,TeammateIdle,TaskCreated,TaskCompleted,WorktreeCreate,WorktreeRemove,MessageDisplay,CwdChanged), where it is silently ignoredtimeoutis a positive integer if present (defaults: 600s command/http/mcp_tool, 30s prompt, 60s agent)ifis a permission rule such asBash(git *), used only on tool eventsonFailureiscontinueorblock(v2.1.295+); recommendblockfor security guardsonceappears only in skill frontmatter hooks; settings files ignore itasync/asyncRewakeappear only on command hooksstatusMessageis a string if presentSessionEndmatchers do not usebypass_permissions_disabled(removed in v2.1.234)
4. Validate Hook Scripts
- File exists and is executable
- Has an appropriate shebang
- If the script emits structured output on stdout, it is valid JSON.
Silent / exit-code-only hooks are valid — no stdout is required
(exit
0= allow/continue, exit2= block forPreToolUse).
Decision Output Schema
When a script does emit JSON, validate it against the event contract:
- PreToolUse:
hookSpecificOutput.permissionDecisionisallow,deny,ask, ordefer(-ponly). The legacy top-level{"decision": "approve" | "block"}is still accepted. - Prompt / agent hooks: the model's verdict is
{"ok": true}or{"ok": false, "reason": "..."}. - Stop / SubagentStop: continuation uses
{"decision": "block", "reason": "<next prompt>"}— the key isreason. - Input JSON always carries the event under
hook_event_name(nothook_type).
Output Format
## Hooks Validation Report
### Configuration Status: VALID / INVALID
### Configured Hooks
| Event | Matcher | Script | Status |
|-------|---------|--------|--------|
| Stop | * | auto-loop-stop.sh | OK |
### Script Validation
| Script | Exists | Executable | Output |
|--------|--------|------------|--------|
| auto-loop-stop.sh | OK | OK | JSON OK / silent |
### Issues Found
1. [Issue and fix]Auto-Fix
- Make scripts executable
- Add missing shebang
- Create missing hook scripts
- Correct a misspelled event name to the nearest valid event
- Normalize
hook_type->hook_event_namein emitted JSON
In this repository36 other files it gives its agents.
- .github/copilot-instructions.mdCopilot instructions
- changelog-observerSkill
- agent-checkSkill
- agentsSkill
- agent-templateSkill
- auto-loopSkill
- changelogSkill
- check-environmentSkill
- claude-md-checkSkill
- claude-md-templateSkill
- code-reviewerSkill
- debuggerSkill
- director-modeSkill
- doc-writerSkill
- evolving-loopSkill
- evolving-statusSkill
- focus-problemSkill
- getting-startedSkill
- handoff-claudeSkill
- handoff-codexSkill
- handoff-geminiSkill
- handoff-grokSkill
- hook-templateSkill
- interop-routerSkill
- mcp-checkSkill
- planSkill
- project-health-checkSkill
- project-initSkill
- session-relaySkill
- skill-checkSkill
- skillsSkill
- skill-templateSkill
- smart-commitSkill
- test-firstSkill
- test-runnerSkill
- workflowSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

