new-hook
Skill1 starsChanged 4 months agoMITView on GitHub
Scaffold a new hook under hooks/<kebab-name>/. Creates README.md (what/when/install/variants) and settings.snippet.json (drop-in JSON), plus updates INVENTORY.md and hooks/README.md in the same edit batch. Hooks are sensitive — pipe-test the raw command before wrapping.
2 other projects use a version of this.
Adopted by
Most recently taken up by
- AcKeskin/contexturetheir own version, first seen Nov 1, 2026
- childrentime/reactusetheir own version, first seen Oct 9, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- childrentime/reactuse★ 1.1ksame name
- AcKeskin/contexture★ 2same 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 repository5 other files it gives its agents.
- codex/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- new-ruleSkill
- new-skillSkill
- publishSkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
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 20
Verify hooks/<kebab-name>/ does not already exist
- Distinctive: line 52
Pipe-test the raw command: before writing files:
≈ “Common” is an estimate: at least 1 in 5 of the 372,429 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
/new-hook
Scaffold a new hook recipe. Hooks are deterministic shell commands tied to Claude Code lifecycle events.
Usage
/new-hook <kebab-name>E.g.: /new-hook prettier-format-on-edit or /new-hook block-secrets-on-edit
Pre-flight
- Verify
hooks/<kebab-name>/does not already exist - Confirm the hook isn't redundant with an existing one
- Critical: hooks are sensitive — verify you've pipe-tested the raw command before wrapping (see "Construction flow" below)
Construction flow
Per the official update-config skill (Anthropic-managed), hook construction follows:
- Dedup check — search existing
.claude/settings.jsonfiles for similar hooks; reuse if possible - Construct for THIS project — write the raw command first
- Pipe-test raw — run the bare command and verify it produces correct output
- Wrap in JSON — embed in
settings.snippet.jsonwithmatcherandhooksarray - Validate JSON —
jq empty settings.snippet.json(no error = valid) - Live-proof — for
Pre|PostToolUseon triggerable matchers, trigger an actual matching tool call and verify the hook fires - Cleanup — remove test artifacts; document the variant in README
- Handoff — show the user the complete files
Steps for this skill
Create directory:
mkdir -p hooks/<kebab-name>- Ask the user for:
- Event:
PreToolUse | PostToolUse | Stop | SubagentStop - Matcher: tool name pattern (e.g.,
Write|Edit,Bash,*) - Command: the bare shell command (will be wrapped in JSON
"command"field) - Context: which project types it applies to
- Variants: are there alternative ways to achieve the same effect (different toolchain, different config)?
- Event:
Pipe-test the raw command before writing files:
echo '{"tool_input":{"file_path":"<example-file>"}}' | <YOUR-COMMAND>Confirm output matches expectations.
Write
hooks/<kebab-name>/README.md:# <kebab-name> > <one-line: event + matcher + what it does> ## What it does <full description> ## Why <bug it prevents / time it saves> ## Install <install steps + jq merge command> ## Variants <alternative implementations> ## Caveats <gotchas, edge cases> ## Companion <related hooks/rules/skills>Write
hooks/<kebab-name>/settings.snippet.json:{ "hooks": { "<EVENT>": [ { "matcher": "<MATCHER>", "hooks": [ { "type": "command", "command": "<wrapped command — escape JSON correctly>", "timeout": 30, "statusMessage": "<optional one-line status>" } ] } ] } }Validate JSON:
jq empty hooks/<kebab-name>/settings.snippet.json- Update
hooks/README.md— add a row to the hook index table. - Update
INVENTORY.mdANDINVENTORY.zh.md— add a row to the Hooks section. - Show the user the diff and ask for confirmation before committing.
Companion
docs/CONTRIBUTING.md§"Adding a hook"- Anthropic's
update-configskill — canonical hook construction flow with live-proof - Anthropic's
hookifyplugin — generate hooks from conversation analysis
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.

