Claude Code Hooks Cookbook — Testing skill for Claude Code
Copy-paste Claude Code hooks that actually do something — auto-format, block dangerous commands, test gates, notifications.
How to install Claude Code Hooks Cookbook
This entry records only its repository, not the path inside it, so there is no
exact command to give. Open rongtnt/claude-code-hooks-cookbook and copy the folder into
~/.claude/skills/, or the file into ~/.claude/agents/.
What Claude Code Hooks Cookbook does
Copy-paste Claude Code hooks that actually do something — auto-format, block dangerous commands, test gates, notifications. Dependency-free, current schema.
Alternatives in Testing
- Sentient — Test prompt to showcase claude code hook blocking a dangerous rm -rf command 3.4k ★
- Mda — MDA Open Spec — a Markdown superset for agent-facing documents 615 ★
- Ab Variants — Generate A/B test design variants from an existing Figma screen — alternate layouts, CTA placements, color tre 309 ★
README
Claude Code Hooks Cookbook
Copy-paste [Claude Code](https://code.claude.com) hooks that actually do something useful — auto-format on edit, block dangerous commands, notify you when a run finishes, gate on tests, and cut permission prompts. Every recipe is real, dependency-free, and current with the latest hook schema.
Hooks are shell commands Claude Code runs **automatically** at points in its loop — before a tool runs, after a file is edited, when a session starts, when the turn ends. They're how you turn "an agent that asks nicely" into "an agent that physically can't `rm -rf` your repo and always leaves the code formatted." Most examples online are stale; this repo tracks the current schema (the `if:` conditions, `permissionDecision`, `updatedInput`, and the full event list).
Quickstart
# drop the scripts into your project
git clone https://github.com/rongtnt/claude-code-hooks-cookbook /tmp/cc-hooks
mkdir -p .claude/hooks && cp /tmp/cc-hooks/hooks/* .claude/hooks/ && chmod +x .claude/hooks/*
Then add the recipes you want to `.claude/settings.json` (commit it to share with your team) or `~/.claude/settings.json` (all projects, just you). Restart Claude Code or run `/hooks` to reload. That's it.
`$CLAUDE_PROJECT_DIR` is set by Claude Code to your project root, so the paths below work from any subdirectory.
Recipes
| # | Recipe | Event | What it does |
|---|---|---|---|
| 1 | Auto-format on edit | PostToolUse |
Formats every file Claude writes |
| 2 | [Block dangerous commands](#2-block-dangerous-command |
Related Skills
Nereus
An opinionated development harness for Claude Code — interview → spec → TDD build → parallel review → finish,
Code Quality Skill
Deterministic code quality gate for AI coding agents (Claude Code, Codex, pi): git hooks that block test tampe
Fia Harness
Local, dependency-free spec-driven development harness for AI agents: spec-first, machine-validated state and
Mobile Auto Test Prompt
Self-contained prompt to paste into a fresh Claude Code (mobile/cloud) session to run a full e2e regression te
Frontend Test Pattern Skill
Claude Code skill for React + Vite projects — auto-generates Vitest & Testing Library tests for utils, compone
Logic Review
Review code for logic bugs — use when you suspect something is wrong but have no failing test yet
Related Agents
Applier 2
Generates copy-paste answers for job application forms based on pipeline research. Human-in-the-loop — never a
Gantry Verifier
Runs the readiness gate. Use to execute the project's lint/test/build from its own .claude/gates.sh, the check
Scheduler Agent
Creates a single calendar event to block out a confirmed meeting time on the user's own primary calendar — nev