Directory · Hooks
dcg (Destructive Command Guard)
Rust pre-execution hook that blocks destructive shell, git, filesystem, database, and cloud commands run by AI coding agents.
★ 6,382 stars · last updated 2026-11-27 · Free, open source · View on GitHub
Best for
- Preventing agents from running git reset --hard, rm -rf, or DROP TABLE
- Teams using several agents (Claude Code, Codex, Gemini, Copilot, Cursor) wanting one guard
- Opt-in protection packs for Kubernetes, Docker, Terraform, and AWS/GCP/Azure
- Scanning code for dangerous commands in CI or pre-commit
Install
curl -fsSL "https://raw.githubusercontent.com/Dicklesworthstone/destructive_command_guard/main/install.sh?$(date +%s)" | bash -s -- --easy-mode
Our take
Widely starred and actively maintained, with native hook integrations for a long list of agents and per-agent profiles configured in ~/.config/dcg/config.toml. It distinguishes commands used as data (grep "rm -rf") from executed ones and scans heredocs and inline scripts, with bypass options like DCG_BYPASS=1 and allow-once codes. The license is custom rather than a standard open source license, so check terms before adopting; native Windows uses a separate PowerShell installer.
Similar hooks
- Claude Code Ultimate Guide: Large open guide to Claude Code covering agent workflows, hooks, skills, MCP, security, and team adoption, with reusable templates.
- Claude Code Showcase: Example Claude Code project config with hooks, skills, agents, slash commands, MCP setup, and GitHub Actions workflows to copy from.
- Claude Code Hooks Mastery: Reference project implementing all 13 Claude Code hook events as UV Python scripts, plus sub-agents, status lines, and output styles.
- Continuous Claude v3: Hooks, skills, and agents that keep Claude Code context across sessions via YAML handoffs, ledgers, and a PostgreSQL memory store.
- Build with Claude: Plugin marketplace and discovery hub of agents, commands, hooks, and skills for Claude Code users extending their workflows.
- Claude Code Toolkit: Large collection of Claude Code agents, skills, commands, plugins, hooks, rules, and MCP configs, plus links to external tools.