Claude Code hook
destructive_command_guard
Fast Rust PreToolUse hook that stops destructive shell, git and filesystem commands before they run.
Install
brew install dicklesworthstone/tap/dcggit clone https://github.com/Dicklesworthstone/destructive_command_guard.gitFrom the README
dcg (Destructive Command Guard) A high-performance hook for AI coding agents that blocks destructive commands before they execute, protecting your work from accidental deletion across Claude Code, Codex CLI, Gemini CLI, Copilot CLI, VS Code Copilot Chat, Cursor, Hermes Agent, Grok (xAI), Posit Assistant, Oh My Pi, Factory Droid's Execute tool, and related tools. Supported: Claude Code, Codex CLI 0.125.0+, Gemini CLI, GitHub Copilot CLI, VS Code Copilot Chat, Cursor IDE, Hermes Agent, Posit Assistant (Positron/RStudio extension, standalone server, and pa terminal client), Grok (xAI) (native ~/.grok/hooks/ plus Claude compatibility layer), Antigravity CLI (agy) (native ~/.gemini/config/hooks.json via dcg install --agy), OpenCode (native tool.execute.before plugin via dcg install --opencode — see docs/opencode-integration.md), Oh My Pi (omp) (native tool_call extension via dcg install --omp), Crush (native hooks.PreToolUse entry in crush.json via dcg install --crush — see docs/crush-integration.md), Reasonix (native hooks.PreToolUse entry in settings.json via dcg install --reasonix — see docs/reasonix-integration.md), Muse Code (native hooks.PreToolUse matcher group in ~/.config/muse/settings.json via dcg install --muse — see docs/muse-integration.md), Amp (native tool.call plugin via dcg install --amp — see docs/amp-integration.md), Pi (via extension recipe), Aider (limited—git hooks only), Continue (detection only) Quick Install Factory Droid's Execute tool is supported through dcg install --droid; see coverage and Script-mode limitations. Install a verified release on Linux, macOS, or WSL. The copyable recipe authenticates the pinned installer before running it and supports normal, easy-mode, and system-wide installation. Works on Linux, macOS, and Windows via…
How hooks work
- Hooks are shell commands Claude Code runs at fixed points: before or after a tool call, when you submit a prompt, when Claude stops, on notifications and at session start.
- They are set in the hooks section of ~/.claude/settings.json (or .claude/settings.json for a project), or come bundled in a plugin.
- A hook can block a tool call, add context, or run a formatter or test. Read the scripts before you install them: they run on your machine with your permissions.
Details
- Repository
- Dicklesworthstone/destructive_command_guard
- Type
- Hooks
- Language
- Rust
- Last updated
- 3 November 2026
- Topics
- ai-agentsclideveloper-toolsgitrustsafety
FAQ
What is destructive_command_guard?
Fast Rust PreToolUse hook that stops destructive shell, git and filesystem commands before they run. It is a hook for Claude Code, from Dicklesworthstone/destructive_command_guard on GitHub.
How do I install destructive_command_guard?
Run brew install dicklesworthstone/tap/dcg, then follow the setup in the README.
Is destructive_command_guard popular?
Dicklesworthstone/destructive_command_guard has 6,242 GitHub stars and 264 forks. It was last updated on 3 November 2026.
More hooks
Claude Code Ultimate Guide
6.3kFlorianBruniaux/claude-code-ultimate-guide
The most comprehensive Claude Code guide: agentic workflows, hooks, skills, MCP servers, quizzes, and production-ready templates. 430K+ lines.
Continuous Claude V3
3.9kparcadei/Continuous-Claude-v3
Context management for Claude Code. Hooks maintain state via ledgers and handoffs. MCP execution without context pollution. Agent orchestration with isolated context windows.
Multi-Agent Observability
1.6kdisler/claude-code-hooks-multi-agent-observability
Streams hook events from many Claude Code agents to a live web dashboard for real-time monitoring.
TDD Guard
2.4knizos/tdd-guard
Hook-based enforcer that blocks code changes which skip the red-green-refactor TDD cycle.
Claude Code Hooks Mastery
4kdisler/claude-code-hooks-mastery
Reference project demonstrating every Claude Code hook event with working Python scripts for logging, blocking and TTS.
Everything Claude Code
5.8kWorldFlowAI/everything-claude-code
Claude Code toolkit - agents, commands, skills, rules, and hooks for productive AI-assisted development
Browse the most popular Claude Code mods, all hooks, or the skills and MCP server directories.