destructive_command_guard

Block destructive commands executed by AI coding agents.

5.7k|225|Updated Jan 7, 2026
One-click install
npx skills add https://github.com/Dicklesworthstone/destructive_command_guard --skill destructive-command-guard-dicklesworthstone
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: destructive_command_guard
Source: https://github.com/Dicklesworthstone/destructive_command_guard/tree/main
Command: npx skills add https://github.com/Dicklesworthstone/destructive_command_guard --skill destructive-command-guard-dicklesworthstone

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires serde, serde_json, schemars, serde_yaml, toml, toml_edit, chrono, fancy-regex, regex, memchr, aho-corasick, smallvec, colored, dirs, glob, clap, clap_complete, once_cell, base64, async-trait, rust-mcp-sdk, tokio, rayon, ast-grep-core, ast-grep-language, tracing, tracing-subscriber, sha2, hmac, fs2, fsqlite, fsqlite-types, fsqlite-error, ctrlc, flate2, self_update, semver, ratatui, indicatif, console, inquire, rand, rich_rust, vergen-gix, assert_cmd, insta, predicates, tempfile, proptest, criterion, libc, regex-automata, which, walkdir, and includes scripts (resource) and references (resource) components.

What problem does it solve?

AI coding agents like Claude, Codex, Gemini, and Copilot can sometimes execute destructive commands, leading to accidental data loss. This Skill blocks such commands before they execute.

Core Features & Use Cases

  • Command Interception: Blocks destructive commands like git reset --hard and rm -rf ./src before they run.
  • Security Packs: Provides over 50 security packs for databases, Kubernetes, Docker, AWS/GCP/Azure, Terraform, and more.
  • Sub-Millisecond Latency: Delivers near-invisible performance using SIMD-accelerated filtering.
  • Context Detection: Differentiates between harmless and dangerous commands like grep "rm -rf" and rm -rf /.
  • Rich Terminal Output: Provides clear explanations and suggestions on stderr.
  • Machine-Readable Output: Delivers structured JSON output on stdout for integration with other systems.
  • Scan Mode: Enables pre-commit hooks and CI integration for catching dangerous commands during code review.
  • Fail-Open Design: Never blocks workflows due to timeouts or parse errors.
  • Explain Mode: Uses dcg explain "command" to show why a command is blocked or allowed.

Quick Start

Use the dcg skill to block the command 'git reset --hard HEAD~5'.

Frequently Asked Questions about destructive_command_guard

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent AI coding agents from running destructive commands like git reset --hard or rm -rf?

You can block destructive commands from AI coding agents by using command interception hooks that evaluate and halt dangerous inputs like `git reset --hard` before they execute. This Skill intercepts such commands and provides over 50 security packs to prevent accidental data loss in development workflows.

How does command blocking differentiate between harmless and dangerous shell commands?

Command blocking differentiates harmless and dangerous shell commands using context detection. It analyzes the execution context to distinguish between a destructive action like `rm -rf /` and a harmless string search like `grep "rm -rf"`, ensuring only truly dangerous commands are halted.

How do I integrate destructive command scanning into pre-commit hooks and CI pipelines?

You can integrate destructive command scanning into pre-commit hooks and CI pipelines using the built-in Scan Mode. Scan Mode evaluates code changes and commands during code review to catch dangerous operations before they are committed or deployed.

Does command blocking add noticeable latency to AI development workflows?

Command blocking does not add noticeable latency to development workflows. It uses SIMD-accelerated filtering to deliver sub-millisecond performance, operating near-invisibly while evaluating commands executed by AI coding agents.

What happens if the command blocking tool times out or encounters a parse error?

If the command blocking tool times out or encounters a parse error, it follows a fail-open design. This means it will never block your workflows due to internal timeouts or parsing issues, ensuring your development process continues without interruption.

Can I get explanations for why a specific command was blocked or allowed?

Yes, you can get explanations for why a specific command was blocked or allowed using the Explain Mode. By running `dcg explain "command"`, the tool provides clear reasoning on stderr and structured machine-readable JSON output on stdout.