Claude Hookbook

Hook library

Every hook lists its event, matcher, risk, and test status. Blocking hooks come with a recovery note.

20 of 20 hooks

Block commits that contain secrets

Intercepts git commit commands and runs gitleaks on staged changes first.

PreToolUseBashblocking riskneeds manual check

Block destructive shell commands

Blocks rm -rf, disk tools, force pushes, and destructive git commands before they run.

PreToolUseBashblocking riskneeds manual check

Block writes outside the repo

Stops Edit/Write calls whose target path resolves outside the project root.

PreToolUseEdit|Writeblocking riskneeds manual check

Compact audit trail on stop

Appends a one-line JSON record to a local audit log every time Claude finishes a turn.

Stoplow riskneeds manual check

ESLint after JS/TS edit

Runs eslint --fix on JavaScript and TypeScript files after Claude edits them, and warns (never blocks) on remaining problems.

PostToolUseEdit|Writereview riskneeds manual check

Full check before task completion

Blocks Claude from marking a task completed while your project check fails.

TaskCompletedblocking riskneeds manual check

gofmt after Go edit

Runs gofmt -w on Go files after Claude edits them.

PostToolUseEdit|Writelow riskneeds manual check

Log tool failures for debugging

Writes a structured JSONL record whenever a Bash, Edit, or Write call fails - the debugging trail you wish you had last week.

PostToolUseFailureBash|Edit|Writelow riskneeds manual check

Notify when Claude needs input

Desktop notification when Claude asks for permission or goes idle waiting for you.

Notificationpermission_prompt|idle_prompt|agent_needs_inputlow riskneeds manual check

Notify when the agent completes

Desktop notification when Claude finishes a turn - useful for long unattended runs.

Notificationagent_completedlow riskneeds manual check

Prettier after edit

Runs Prettier on any JS/TS/JSON/CSS/Markdown file right after Claude edits it.

PostToolUseEdit|Writelow riskneeds manual check

Protect .env and secret files

Blocks Claude from writing to .env files, keys, and credential files - unless you say otherwise.

PreToolUseEdit|Writeblocking riskneeds manual check

Re-inject project context after compaction

Restores your project's key facts into Claude's context right after a compaction wipes the details.

SessionStartcompactlow riskneeds manual check

Ruff after Python edit

Runs ruff check --fix on Python files after Claude edits them.

PostToolUseEdit|Writelow riskneeds manual check

Run the nearest test after an edit

Finds the test file that belongs to the file Claude just edited and runs it, in the background.

PostToolUseEdit|Writereview riskneeds manual check

rustfmt after Rust edit

Runs rustfmt on Rust files after Claude edits them.

PostToolUseEdit|Writelow riskneeds manual check

Secret scan on changed files

Runs gitleaks on every file Claude edits and warns when something looks like a secret.

PostToolUseEdit|Writereview riskneeds manual check

Session-start repo snapshot

Hands Claude a bounded snapshot - branch, dirty state, recent commits - at every session start and resume.

SessionStartstartup|resumelow riskneeds manual check

Terminal bell on permission prompt

Rings the terminal bell when Claude asks for permission, via the terminalSequence output field.

Notificationpermission_promptlow riskneeds manual check

Typecheck after TypeScript changes

Runs tsc --noEmit in the background after Claude edits TypeScript, so type errors surface even when tests don't cover the file.

PostToolUseEdit|Writereview riskneeds manual check