New hook
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.From its SKILL.md
npx -y skills add jajupmochi/agent-harness --skill new-hookAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
3.6 KB, 856 tokens by cl100k_base, as published. Nobody here has run it
/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
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.
Gives 0 of the 12 instructions most skill authoring skills give in 856 tokens
Counted across 408 of the 422 authors here whose files we hold, read 2026-09-06
- Keep SKILL.md under 500 linesin 118 of 408, across 104 files
- Write skill instructions in imperative formin 44 of 408, across 37 files
- Move detailed reference material into references filesin 41 of 408, across 34 files
- Run init_skill.py to initialize new skillsin 40 of 408, across 33 files
- Draft assertions while test runs are in progressin 32 of 408, across 25 files
- Keep description under 1024 charactersin 31 of 408, across 18 files
- Run package_skill.py once the skill is completein 29 of 408, across 23 files
- Spawn with-skill and baseline runs in the same turnin 28 of 408, across 21 files
- Test added scripts by actually running themin 27 of 408, across 21 files
- Follow the creation steps in orderin 24 of 408, across 17 files
- Generate the eval viewer before evaluating outputs yourselfin 24 of 408, across 17 files
- Write the description in third personin 24 of 408, across 18 files
Said here and by no other author read
- Verify the hook directory does not already exist
- Confirm the hook is not redundant with an existing one
- Write the raw command first
- Pipe-test the raw command before wrapping it
- Wrap the command in JSON with a matcher
- Validate the snippet with jq empty
Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once. Length counted with cl100k_base; the agent that loads this file may tokenize it differently.