hook-writer
Skill1 starsChanged 6 days agoMITView on GitHub
Turn a plain-language automation request — 'format every file Claude edits', 'block writes to migrations', 'notify me when input is needed' — into a working Claude Code hook: the right event, a safe tested script, and the settings.json registration at the right scope. Use when you want a hook but don't want to hand-write the matcher, stdin JSON parsing, and exit-code plumbing.
- Reads credentials
4 other projects use a version of this.
Adopted by
Most recently taken up by
- kenashe/x-article-toolkittheir own version, first seen Oct 2, 2026
- sidchaudhary/gtm-skillstheir own version, first seen Aug 21, 2026
- m-binimran/creator-packtheir own version, first seen Jun 14, 2026
- Noumenon-ai/noumenon-free-starter-packtheir own version, first seen Apr 7, 2026
Other versions4 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 4
- m-binimran/creator-pack★ 3same name
- kenashe/x-article-toolkit★ 2same name
- sidchaudhary/gtm-skills★ 1same name
- Noumenon-ai/noumenon-free-starter-pack★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository163 other files it gives its agents.
- agents.mdAGENTS.md
- 3d-asset-handoff-sheetSkill
- accessibility-regression-auditorSkill
- adr-writerSkill
- agent-memory-designerSkill
- agent-trajectory-evaluatorSkill
- alerting-rules-tunerSkill
- analysis-memo-writerSkill
- annotation-disagreement-ledgerSkill
- annotation-task-spec-builderSkill
- api-deprecation-plannerSkill
- api-error-contract-designerSkill
- architecture-diagram-generatorSkill
- asset-metadata-review-ledgerSkill
- auth-flow-reviewerSkill
- background-job-reliability-auditorSkill
- branch-rebaserSkill
- brand-voice-profilerSkill
- bundle-analyzerSkill
- cache-policy-designerSkill
- canary-release-plannerSkill
- caption-correction-ledgerSkill
- changelog-from-prsSkill
- chart-chooserSkill
- chunking-strategy-optimizerSkill
- circular-dependency-breakerSkill
- claude-settings-auditorSkill
- code-example-verifierSkill
- cold-email-deliverability-auditorSkill
- cold-start-optimizerSkill
- commit-splitterSkill
- competitor-teardownSkill
- component-spec-writerSkill
- connection-pool-tunerSkill
- content-repurposerSkill
- contract-obligation-registerSkill
- contract-test-designerSkill
- conventional-commitsSkill
- cors-configuratorSkill
- coverage-gap-finderSkill
- crm-export-auditorSkill
- dashboard-designerSkill
- data-retention-auditorSkill
- dataset-first-lookSkill
- dead-code-finderSkill
- deadlock-diagnoserSkill
- decision-log-reconcilerSkill
- dependency-auditSkill
- dependency-upgrade-plannerSkill
- design-brief-writerSkill
- design-critique-checklistSkill
- design-token-extractorSkill
- devcontainer-designerSkill
- distributed-tracing-instrumenterSkill
- dockerfile-optimizerSkill
- email-sequence-drafterSkill
- embedding-index-tunerSkill
- embedding-set-inspectorSkill
- entity-match-candidate-ledgerSkill
- exit-ticket-builderSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
1 rule. 0 are common, 0 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 4 edited versions we read keep these.
0
Distinctive
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 26
Write the script defensively: Read the event JSON from stdin (jq -r '.tool_input.file_path // empty'), quote every expansion, handle …
“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Give this skill a sentence like "run prettier on every file Claude edits" or "never let Claude touch .env files, and tell it why" and it produces the complete hook: event choice, matcher, hardened script, settings registration, and a verification step. Hooks are the right tool for rules that must hold every time — this skill removes the plumbing tax of writing one.
When to use this skill
- You want an automatic action around Claude Code's lifecycle: format after edits, run affected tests, log tool calls, send a desktop notification, enforce a freeze window.
- You want to block something deterministically: edits to protected paths, dangerous Bash patterns, prompts containing secrets.
- You have a hook that misbehaves and want it diagnosed and rewritten safely.
When NOT to use this skill
- The rule is a judgment call ("prefer small functions") — that's a CLAUDE.md instruction, not a hook. See Claude Code Hooks for the dividing line.
- You're gating which tools may run at all with static patterns — plain permission rules do that with zero code; hooks are for logic patterns can't express.
- You're bundling hooks for distribution to other repos — write them here, then package with plugin-scaffolder.
Instructions
- Restate the automation as event + condition + action. Name the lifecycle moment (before a tool call? after? on prompt submit? when Claude finishes?), the condition (which tools, paths, or patterns), and the action (run, block, notify, log). If the user's request maps to two events, prefer the narrower one — gate with
PreToolUse, react withPostToolUse. - Choose blocking semantics deliberately. Only some events can block (
PreToolUse,UserPromptSubmit). For a blocking hook, decide fail-open vs fail-closed on script errors and say which you chose: formatters fail open (exit 0 on error), guardrails fail closed (exit 2 on any doubt). Blocking output goes to stderr so Claude learns why and adjusts. - Write the script defensively. Read the event JSON from stdin (
jq -r '.tool_input.file_path // empty'), quote every expansion, handle missing fields, and keep it fast — hooks run inline with the session. Place it at.claude/hooks/<name>.shand make it executable. Never interpolate model-controlled values into shell unquoted. - Register it at the right scope. Project-wide rules go in
.claude/settings.json(team-shared); personal automation in~/.claude/settings.json; machine-local experiments in.claude/settings.local.json. Add the matcher (Edit|Write,Bash,mcp__server__tool, or*) and atimeout. Show the exact JSON block being added and merge it without clobbering existing hooks. - Verify it fires. Trigger the event once (e.g. have Claude edit a scratch file) and confirm the effect; run
/hooksto confirm registration and source file. For a blocking hook, also verify the allowed path still works — overblocking is the most common hook bug. - Hand over the off-switch. Note how to disable it (remove the JSON block, or
"disableAllHooks": truetemporarily) and what its failure mode looks like in practice.
[!WARNING] A hook is arbitrary code running with the user's credentials on every matching event. Keep secrets out of hook scripts, treat tool input as untrusted data, and never write a blocking hook whose error path silently allows what it was built to stop.
[!TIP] When the user's rule is expressible as a permission pattern (
deny: ["Read(./.env)"]), say so and offer the rule instead — fewer moving parts beats a script doing the same job.
Output
The executable hook script at .claude/hooks/<name>.sh, the exact settings JSON registered (with scope stated and why), a one-command verification you ran or the user can run, and the disable/rollback instructions — everything needed to trust the hook or remove it.
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.

