Destructive Command Guard — Git skill for Claude Code
The Destructive Command Guard (dcg) is for blocking dangerous git and shell commands from being executed by agents.
How to install Destructive Command Guard
This entry records only its repository, not the path inside it, so there is no
exact command to give. Open Dicklesworthstone/destructive_command_guard and copy the folder into
~/.claude/skills/, or the file into ~/.claude/agents/.
What Destructive Command Guard does
The Destructive Command Guard (dcg) is for blocking dangerous git and shell commands from being executed by agents.
Alternatives in Git
- 使用 Git Worktrees — 创建孤立的 Git worktrees,带有智能目录选择与安全验证 115.1k ★
- Git Worktree Docs Issue: Dependency Installation — GitHub — Community feedback on official docs with full worktree lifecycle walkthrough 81.1k ★
- Git Worktree Setup — Create isolated git worktrees with instant feedback and background Rust verification 25.5k ★
README
dcg (Destructive Command Guard)
[](https://codecov.io/gh/Dicklesworthstone/destructive_command_guard) [](https://opensource.org/licenses/MIT)
A high-performance hook for AI coding agents that blocks destructive commands before they execute, protecting your work from accidental deletion.
**Supported:** [Claude Code](https://claude.ai/code), [Gemini CLI](https://github.com/google-gemini/gemini-cli), [GitHub Copilot CLI](https://docs.github.com/en/copilot/concepts/agents/coding-agent/about-hooks), [Cursor IDE](https://cursor.com), [OpenCode](https://opencode.ai) (via [community plugin](https://github.com/aspiers/ai-config/blob/main/.config/opencode/plugins/dcg-guard.js)), [Aider](https://aider.chat/) (limited—git hooks only), [Continue](https://continue.dev) (detection only), [Codex CLI](https://github.com/openai/codex)
Quick Install
curl -fsSL "https://raw.githubusercontent.com/Dicklesworthstone/destructive_command_guard/main/install.sh?$(date +%s)" | bash -s -- --easy-mode
Works on Linux, macOS, and Windows (WSL). Auto-detects your platform and downloads the right binary.
TL;DR
**The Problem**: AI coding agents (Claude, GPT, etc.) occasionally run catastrophic commands like `git reset --hard`, `rm -rf ./src`, or `DROP TABLE users`—destroying hours of uncommitted work in seconds.
**The Solution**: dcg is a high-performance hook that intercepts destructive commands *before* they execute, blocking them with clear explanations and safer alternatives.
Why Use dcg?
| Feature | What It Does |
|---|---|
| **Zero-Config Prot |
Related Skills
Claude Branch Guard
Moved to karlkfi/claude-bouncer. Branch-aware git permissions for Claude Code — auto-approve safe git/gh comma
Harden Actions
Pin GitHub Actions to SHAs, fix permissions, and flag dangerous triggers
Claude Code Safety Net
A Claude Code plugin that acts as a safety net, catching destructive git and filesystem commands before they e
Nomos
Deny-wins policy hook for Claude Code and Codex. Checks every shell, file, and fetch call against rules you ke
Guardrail Sim
Pre-flight guardrail simulator — feed planned Bash commands on stdin and it flags/rewrites the predictable him
Claude Git Reset
Claude Code hook to block destructive git commands (reset --hard, force push, etc.)
Related Agents
Team Goal Auditor
Acceptance contract owner + goal-fidelity guard. Three enumerated phases: define (author definition-of-done.md
Backend Convention Checker
Use this agent when a plan file's lint verification stage needs to be executed — specifically to check recentl
Commit Archaeologist
Phase 1 intelligence gathering agent that proactively mines git history for security-relevant commits with no