hook-writerlisted
Install: claude install-skill imtiazrayhan/agentscamp-library
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](/guides/configuration/claude-code-hooks) for the dividing line.
- You're gating *which tools may run at all* with static patterns — plain [permission rules](/guides/configuration/claude-code-settings-permissions) 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](/skills/workflow/plugin-scaffolder).
## Instructions
1. **Restate the automation as event + condition + action.** Name the lifecycle moment (before a tool call? aft