rongtnt

Claude Code Hooks Cookbook — Testing skill for Claude Code

Testing community

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 ★
  • Create Test Repo — Create a new ArcKit test repo with full scaffolding, auto-detecting the next version number 2.2k ★
  • Spec Kitty — Spec-Driven Development for serious software developers 1.6k ★

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.

recipes deps MIT PRs welcome

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