Claude Code is Anthropic's AI coding agent that runs commands in your terminal. Without guardrails, it can delete files, leak secrets, or force-push to production.
One command installs safety hooks that block destructive commands before they execute. 892 example hooks, 213 test files, 30K+ npm downloads (cumulative).
npx cc-safe-setup
8 core safety hooks installed in under 30 seconds. No config needed.
Real incidents from GitHub Issues: 50GB data loss, $1,446 unauthorized transfer, production server destroyed
🔥 New: /rewind deleted my code — recover it · Max usage burn check (why am I hitting limits so fast?) · Safety Scorecard (score & share your setup) · Team Governance Scorecard (is your org governed?) · Attack Simulator (10 scenarios) · Risk Assessment · Incident Tracker (90 incidents)
Install
Run npx cc-safe-setup. 8 hooks installed in 30 seconds.
Protect
Hooks intercept rm -rf, force-push, credential leaks before they execute.
Monitor
Track token consumption, detect quota drain, get alerts before it's too late.
⚡ Safety AND Convenience — our most popular hook auto-approves safe git commands, reducing clicks while blocking dangerous ones.
ONE-TIME · CUT YOUR TOKENS IN HALF
Token Book — $17
800+ hours of data. 48 token drain symptoms. Copy-paste templates.
MONTHLY · STAY AHEAD OF INCIDENTS
CC Safety Lab — ¥500/mo
Monthly digest: 4-8 incidents, hooks, token-saving techniques. First month free.
Paste your ~/.claude/settings.json. Nothing leaves your browser.
Build a custom hook without writing code.
Copy-paste recipes from real GitHub Issues.
All major Claude Code hook projects compared.
| Project | Lang | Hooks | Install |
|---|---|---|---|
| safety-net | TS | 5 | npx |
| cc-safe-setup | Bash | 707+ | npx |
| karanb192 | JS | 5+ | copy |
| mastery | Python | 12 | copy |
| lasso | Python | 1 | install.sh |
| Feature | safety-net | cc-safe-setup | karanb192 | mastery |
|---|---|---|---|---|
| rm -rf blocker | ✓ | ✓ | ✓ | ✓ |
| Branch guard | ✓ | ✓ | - | - |
| Secret guard | - | ✓ | ✓ | - |
| Syntax check | - | ✓ | - | - |
| Context monitor | - | ✓ | - | - |
| Hook generator | - | ✓ | - | - |
| Dashboard | - | ✓ | - | - |
| GitHub Action | - | ✓ | - | - |
Print this page (Ctrl+P) for a quick reference.
Prompt → PreToolUse → Tool → PostToolUse → Stop
| Code | Meaning |
|---|---|
0 | Allow |
2 | Block |
#!/bin/bash CMD=$(cat | jq -r '.tool_input.command // empty') [ -z "$CMD" ] && exit 0 echo "$CMD" | grep -qE 'PATTERN' && echo "BLOCKED" >&2 && exit 2 exit 0
#!/bin/bash
CMD=$(cat | jq -r '.tool_input.command // empty')
[ -z "$CMD" ] && exit 0
echo "$CMD" | grep -qE '^git\s+(status|log|diff)' && \
jq -n '{"hookSpecificOutput":{"hookEventName":"PreToolUse","permissionDecision":"allow"}}'
exit 0
npx cc-safe-setup | Install 8 hooks |
--create "desc" | Generate hook |
--audit | Score 0-100 |
--dashboard | Live status |
--doctor | Diagnose |
--benchmark | Speed test |
How healthy is your Claude Code setup?
Run a free 20-check diagnostic. Takes 2 seconds, nothing leaves your machine.
npx cc-health-check
30K+ npm downloads (cumulative) · 892 example hooks · Production Guide (Zenn Book)
Prevent real incidents:
rm -rf disasters Force-push to main Secret leaks git reset --hard Cascading syntax errors Dependency bloat Temp file buildup Auto Mode safety Hook if field (v2.1.85) Shell variable trap Session drift Token waste Cost explosion bash -x debug leak Post-compact push Hook testing guide Autonomous safety CLAUDE.md best practices Co-Authored-By control Fix git show --no-stat Disable auto-compaction WebFetch domain fix Pipe mode safety Session degradation Denied action retry Background agent writes