什么是 destructive-command-guard?
通过基于 Rust 的 Claude Code 挂钩在执行前阻止危险命令。在配置代理安全防护、设置破坏性命令阻止或审核 CLI 保护规则时使用。用于 git 重置保护、rm -rf 拦截、强制推送阻止、基于包的命令过滤和 PreToolUse 挂钩安全。 来源:oakoss/agent-skills。
通过基于 Rust 的 Claude Code 挂钩在执行前阻止危险命令。在配置代理安全防护、设置破坏性命令阻止或审核 CLI 保护规则时使用。用于 git 重置保护、rm -rf 拦截、强制推送阻止、基于包的命令过滤和 PreToolUse 挂钩安全。
通过命令行快速安装 destructive-command-guard AI 技能到你的开发环境
来源:oakoss/agent-skills。
A high-performance Claude Code hook that intercepts and blocks destructive commands before they execute. Written in Rust with SIMD-accelerated filtering via the memchr crate and Aho-Corasick multi-pattern matching for sub-millisecond latency. Assumes agents are well-intentioned but fallible.
DCG uses a whitelist-first architecture: safe patterns are checked before destructive patterns, and unrecognized commands are allowed by default (fail-safe). This ensures legitimate workflows are never broken while known dangerous patterns are always blocked. DCG runs as a PreToolUse hook in Claude Code, receiving JSON on stdin for each Bash tool invocation and returning exit code 0 (allow) or 2 (block). It only i...
The processing pipeline has four stages: JSON parsing, command normalization (strips absolute paths like /usr/bin/git), SIMD quick-reject filter (skips regex for commands without git or rm), and pattern matching. The memchr crate provides hardware-accelerated substring search (SSE2/AVX2 on x8664, NEON on ARM), while Aho-Corasick handles multi-pattern matching in O(n) time regardless of pattern count.
为搜索与 AI 引用准备的稳定字段与命令。
npx skills add https://github.com/oakoss/agent-skills --skill destructive-command-guard通过基于 Rust 的 Claude Code 挂钩在执行前阻止危险命令。在配置代理安全防护、设置破坏性命令阻止或审核 CLI 保护规则时使用。用于 git 重置保护、rm -rf 拦截、强制推送阻止、基于包的命令过滤和 PreToolUse 挂钩安全。 来源:oakoss/agent-skills。
打开你的终端或命令行工具(如 Terminal、iTerm、Windows Terminal 等) 复制并运行以下命令:npx skills add https://github.com/oakoss/agent-skills --skill destructive-command-guard 安装完成后,技能将自动配置到你的 AI 编程环境中,可以在 Claude Code、Cursor 或 OpenClaw 中使用
https://github.com/oakoss/agent-skills