claude-code-hooks
⚠️ This repository has moved to cc-safe-setup — 914 hooks, one-command install. This repo (16 hooks) is the original version kept for backward compatibility.

Quick Start (New Repository)
The published package on npm is still the 2026-04-20 build. The commands below point at GitHub directly so you get the current version.
npx github:yurukusa/cc-safe-setup # Install 8 essential hooks in 10 seconds
npx github:yurukusa/cc-safe-setup --verify # Test each hook works
914 Example Hooks | Interactive Hook Selector | Token Checkup (diagnose token waste)
New here? The Claude Code Safety Field Manual is free (minimum price zero): the pre-flight checklist, what each guard actually refuses, and how to make one fire on purpose so you can watch it work.
Spending too much on Claude Code? The average developer spends $13/day on tokens. Cut Your Claude Code Token Usage in Half is 48 diagnostic symptoms for cost — subagents, MCP server overhead, context bloat, cache misses — measured on one operation rather than reasoned about (English, from $9.99).
Original Repository (16 hooks)
Interactive Cookbook — search, filter, and copy 26 hook recipes in your browser.
16 hooks + 6 templates from 700+ hours of autonomous Claude Code operation.
┌─────────────────────────────────────────────────────────┐
│ Claude Code Session │
│ │
│ User Prompt ──→ PermissionRequest ──→ PreToolUse │
│ (auto-approve- (destructive-guard │
│ readonly) branch-guard │
│ comment-strip │
│ cd-git-allow │
│ secret-guard) │
│ │ │ │
│ ▼ ▼ │
│ Tool Executes ──→ PostToolUse │
│ (syntax-check │
│ context-monitor │
│ activity-logger │
│ tmp-cleanup) │
│ │ │
│ ▼ │
│ Session End ──→ Stop │
│ (proof-log-session) │
│ │
│ Notification ──→ no-ask-human │
│ PreCompact ──→ proof-log-session │
└─────────────────────────────────────────────────────────┘
Production infrastructure for running Claude Code autonomously. Every hook exists because something went wrong without it. Every template encodes a workflow pattern that survived real-world autonomous operation.
Honest disclaimer: This is what works for us. Your workflow may differ. These hooks and templates address the failure modes we actually encountered.
Covers 18 of 20 checks in cc-health-check.
Get Started in 10 Seconds
npx github:yurukusa/cc-safe-setup # Install 8 essential hooks
npx github:yurukusa/cc-safe-setup --verify # Test each hook works
npx github:yurukusa/cc-safe-setup --doctor # Diagnose any issues
npx github:yurukusa/cc-safe-setup --create "block npm publish without tests" # Generate custom hooks
Want 914 hooks? Use cc-safe-setup — the successor to this repo with 57x more hooks, a test suite, and one-command install.
New to hooks? Read the Troubleshooting Guide or print the Cheat Sheet.
Losing tokens too fast? Cut Your Claude Code Token Usage in Half — 48 diagnostic symptoms for cost, measured on one operation over 800+ hours (English, from $9.99, free sample). A longer Japanese book on the same subject (37 chapters) is on Zenn — it is a separate book, not a translation.