new-hooklisted
Install: claude install-skill jajupmochi/claude-config
# /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:
1. **Dedup check** — search existing `.claude/settings.json` files for similar hooks; reuse if possible
2. **Construct for THIS project** — write the raw command first
3. **Pipe-test raw** — run the bare command and verify it produces correct output
4. **Wrap in JSON** — embed in `settings.snippet.json` with `matcher` and `hooks` array
5. **Validate JSON** — `jq empty settings.snippet.json` (no error = valid)
6. **Live-proof** — for `Pre|PostToolUse` on triggerable matchers, trigger an actual matching tool call and verify the hook fires
7. **Cleanup** — remove test artifacts; document the variant in README
8. **Handoff** — show the user the complete files
## Steps for this skill
1. **Create directory**:
```bash
mkdir -p hooks/<kebab-name>
```
2. **Ask the user** for:
- Event: `PreToolUse | PostToolUse | Stop | SubagentStop`
- Matcher: tool name pattern (e.g., `Wri