Make Claude Code safe in 5 minutes. No coding required. Works on macOS, Linux, and Windows (WSL).
Hooks need jq to read JSON. Check if you have it:
jq --version
If not installed:
# macOS
brew install jq
# Ubuntu / Debian
sudo apt install jq
# Windows (in WSL)
sudo apt install jq
This installs 8 safety hooks and configures your settings.json:
npx cc-safe-setup
You'll see a list of hooks. Press Y to install.
Hooks load on startup. Close Claude Code and reopen it:
# In your terminal, exit Claude Code (Ctrl+C or type /exit)
# Then start it again
claude
Run the diagnostic to confirm everything is set up:
npx cc-safe-setup --doctor
All items should show ✓. If any show ✗, the doctor tells you how to fix it.
See how hooks react without actually running the command:
npx cc-safe-setup --simulate "rm -rf /"
You should see: ✗ BLOCK — destructive-guard
npx cc-safe-setup --simulate "git status"
You should see: → This command would trigger a permission prompt
Tired of approving ls, cat, and git log? This hook auto-approves commands that can't modify anything:
npx cc-safe-setup --install-example auto-approve-readonly
Reduces permission prompts by about 80%. Only commands that write, delete, or push still require approval.
npx cc-safe-setup --install-example auto-approve-test
npm test, pytest, go test, cargo test — all auto-approved.
For autonomous sessions where Claude runs unattended:
npx cc-safe-setup --shield
Installs everything from steps 1-6 plus: scope guard, memory write guard, skill gate, and project-specific hooks based on your tech stack.
The hooks run silently in the background. You won't notice them until they block something dangerous. When they do, you'll see a clear message explaining what was blocked and why.
--dangerously-skip-permissions or --bare. These modes disable all safety hooks by design.