Install, configure, and manage Claude Code security hooks that block dangerous commands and protect sensitive files. Use when setting up security protection, blocking destructive commands (rm -rf, git reset --hard), protecting sensitive paths (.env, credentials), or managing PreToolUse hooks.
Resources
2Install
npx skillscat add cfircoo/claude-code-toolkit/damage-control Install via the SkillsCat registry.
- Bash Hook - Evaluates commands against regex patterns and path restrictions
- Edit Hook - Validates file paths before modifications
- Write Hook - Checks paths before file creation
Exit codes:
0= Allow operation0+ JSON = Ask for confirmation (triggers dialog)2= Block operation (stderr fed back to Claude)
Ask patterns: Some operations trigger confirmation dialogs instead of blocking:
git checkout -- .(discards changes)git stash drop(deletes stash)DELETE FROM table WHERE id=X(SQL with specific ID)</how_it_works>
Or ask Claude:
What would you like to do?"Install damage control security hooks"
</quick_start>
"Set up protection for my project"
- Install - Set up damage control hooks (global, project, or personal)
- Modify - Add/remove protected paths or blocked commands
- Test - Validate hooks are working correctly
- List - View all active protections across all levels
Wait for response before proceeding.
Direct command routing (skip menu):
- "add ~/.credentials to zero access" → Execute directly, then restart reminder
- "block npm publish command" → Execute directly, then restart reminder
- "protect /secrets folder" → Execute directly, then restart reminder
After reading the workflow, follow it exactly.
Git destructive:
git reset --hard,git push --force(not --force-with-lease)git clean -fd,git stash clear,git filter-branch
Cloud destructive:
- AWS:
terminate-instances,delete-db-instance,delete-stack - GCP:
projects delete,instances delete,clusters delete - Docker:
system prune -a,volume rm - Kubernetes:
delete namespace,delete all --all
Database destructive:
DELETE FROM table;(no WHERE clause)DROP TABLE,DROP DATABASE,TRUNCATE TABLEredis-cli FLUSHALL,dropdb
See scripts/patterns.yaml for complete list.
</blocked_commands_summary>
Windows
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
**TypeScript with Bun (Alternative):**
```bash
# macOS/Linux
curl -fsSL https://bun.sh/install | bash && bun add yaml
# Windows
powershell -c "irm bun.sh/install.ps1 | iex" && bun add yaml</runtime_requirements>
**IMPORTANT:** After any installation or modification:
Restart your agent for changes to take effect.
Hooks are only loaded at agent startup. Run /hooks after restart to verify.
</critical_reminder>
| Script | Purpose |
|---|---|
| scripts/bash-tool-damage-control.py | PreToolUse hook for Bash commands |
| scripts/edit-tool-damage-control.py | PreToolUse hook for Edit tool |
| scripts/write-tool-damage-control.py | PreToolUse hook for Write tool |
| scripts/test-damage-control.py | Test runner for hook validation |
| scripts/patterns.yaml | Security patterns and protected paths |
| scripts/settings-template.json | Hook configuration template |
| </scripts_index> |
- Hooks installed at chosen level (global/project/personal)
patterns.yamlcopied alongside hook scriptssettings.jsonupdated with PreToolUse hook configuration- UV (or Bun) runtime installed
- Agent restarted to load hooks
- Verified with
/hookscommand showing damage-control hooks - Tested with
rm -rf /tmp/test(should be blocked)</success_criteria>