Skip to main content
Code Guide
Hook Recommended

dangerous-actions-blocker.sh

Block dangerous commands/edits

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

  1. Open the template on GitHub and copy its content: hooks/bash/dangerous-actions-blocker.sh
  2. 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
  3. 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.

Related templates