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. 727 hooks, 9,200+ tests, 30K+ total installs.
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: 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. Founder price locked.
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+ total installs ยท 727 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