A few weeks ago I noticed every Claude Code project I touch starts with the same ritual: I want Prettier to run after Claude edits a file, I want a notification when it asks for permission, and I really want it to not touch my .env files. So I open the hooks docs, dig up an old gist, hand-write a settings.json block, get the matcher slightly wrong, debug it, and repeat the whole thing on the next project.
Hooks are one of the best features in Claude Code: deterministic shell commands that fire on events like PreToolUse or PostToolUse, so the boring stuff happens every time without relying on the model to remember. But the setup friction means most people run with zero hooks.
So I built Claude Hookbook: a reviewed library of 20 copy-ready hooks, plus a generator that composes the ones you pick into one valid settings.json.
What's in the book
20 hooks covering the stuff I kept re-doing:
- Formatters that run after an edit: Prettier, ESLint, Ruff, gofmt, rustfmt.
- Guardrails that block before something runs: stop Claude from writing to .env and credential files, block destructive shell commands, run gitleaks on staged changes before a commit.
- Quality gates: run the nearest test after an edit, typecheck TypeScript in the background, block task completion while your project check fails.
- Quality of life: desktop notification when Claude needs input, a session-start repo snapshot, re-injecting project context after a compaction.
Every hook page lists the event and matcher it uses, the risk level, what it needs installed, install and test steps, and - for the blocking ones - a recovery note for when it fires and you disagree.
The honest part: test status
Hooks run code on your machine, so I didn't want a site full of unreviewed snippets. Each hook ships with provenance (sources and what Claude Code release it was checked against) and a test badge: tested only after a real install plus a positive and negative trigger run against the current release. Until then a hook shows needs-manual-check with the exact test steps on its page. Right now most of the library carries that badge - I'd rather show you the checklist than fake a green one.
The generator
The part I built for myself: tick hooks on the site and the generator emits one merged settings.json. The single-hook pages and the generator build the config fragment from the same canonical fields, so they can't drift apart. No CLI, no account, runs in the browser.
Stack and repo
It's a static Next.js site on Vercel, all routes pre-rendered. Hooks live as one JSON file per hook, validated at build time by a Zod schema, so a malformed hook fails the build instead of failing on your machine.
Repo: github.com/yanairon/claude-hookbook. Issues and hook requests welcome - if there's a hook you keep rewriting in every project, tell me about it in the comments.
Top comments (0)