When to use this
- As a safety net to block destructive commands (rm -rf, DROP TABLE, force-push) before they execute
- When running Claude in autonomous mode and want hard stops on irreversible operations
- When team members share a Claude Code config and you need consistent guardrails across all sessions
How to use
-
Open the template on GitHub and copy its content:
hooks/bash/dangerous-actions-blocker.sh -
Place the file inside
.claude/hooks/in your project (or globally in~/.claude/to share across all projects). For shell scripts, make it executable:chmod +x dangerous-actions-blocker.sh - Review each command in the script, adjust paths and thresholds for your environment, then test it in a safe context before wiring it into hooks.