Token导航 LogoToken导航

Agent Skill · 研究检索

dcg(直流电)

dcg 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

dcg 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为接触敏感数据;许可证为 MIT,第三方扫描有未通过项,按安装量在研究检索类的 73,675 个 Skill 里排第 38,218。

总安装 1,592周安装 67GitHub Stars 937下载 557核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
MIT

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:dcg(直流电)
来源仓库:https://github.com/dicklesworthstone/destructive_command_guard
仓库路径:skills/dcg
安装命令:
npx skills add https://github.com/dicklesworthstone/destructive_command_guard --skill dcg
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/dicklesworthstone/destructive_command_guard --skill dcg

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

dcg 是一个高性能命令拦截器,用于阻止 AI 代理意外执行破坏性操作如误删文件或重置提交历史。适合在运行可能修改系统状态的命令前启用保护机制,防止因拼写错误或逻辑失误造成数据丢失。通过 Rust 编写并采用 SIMD 加速实现亚毫秒级响应,可配置规则列表来定义允许或禁止的操作类型。

使用前需明确哪些命令属于高风险操作,并在配置文件中设置相应的拦截策略和告警方式。dcg 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

来源仓库内路径:skills/dcg

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/dicklesworthstone/destructive_command_guard --…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要接触敏感数据,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

dcg 怎么安装?

在终端执行 npx skills add https://github.com/dicklesworthstone/destructive_command_guard --skill dcg。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

dcg 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

dcg 需要什么权限?

权限级别是接触敏感数据。该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

dcg 是免费的吗?

来源标注的许可证是 MIT。本站不代收任何费用,也不托管安装包;能否商用、要不要署名,以许可证原文为准。

dcg 用的人多吗?

公开数据是累计安装 1,592 次,近一周安装 67 次,下载 557 次,GitHub 937 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

dcg 安全吗?

第三方扫描有未通过项,风险较高。除非你确认过源码,否则不建议直接安装到常用环境。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 3 个目录同时收录,说明这个 Skill 流传比较广。
  • 许可证明确为 MIT,商用和分发边界好判断。

先想清楚的地方

  • 需要接触敏感数据,装到常用环境前要先评估影响面。
  • 第三方扫描存在提醒项或未通过项,需要人工逐条确认。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。

不太适合

  • 环境里有大量密钥、凭证,不方便给第三方 Skill 读取的人。
  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
dcg

直流电 · 本页

1,592937接触敏感数据MIT未通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

DCG — Destructive Command Guard

A high-performance Claude Code hook that intercepts and blocks destructive commands before they execute. Written in Rust with SIMD-accelerated filtering for sub-millisecond latency.

Why This Exists

AI coding agents are powerful but fallible. They can accidentally run destructive commands:

  • "Let me clean up the build artifacts" → rm -rf./src (typo)
  • "I'll reset to the last commit" → git reset --hard (destroys uncommitted changes)
  • "Let me fix the merge conflict" → git checkout --. (discards all modifications)
  • "I'll clean up untracked files" → git clean -fd (permanently deletes untracked files)

DCG intercepts dangerous commands *before* execution and blocks them with a clear explanation, giving you a chance to stash your changes first.

Critical Design Principles

1. Whitelist-First Architecture

Safe patterns are checked *before* destructive patterns. This ensures explicitly safe commands are never accidentally blocked:

git checkout -b feature    →  Matches SAFE "checkout-new-branch"  →  ALLOW
git checkout -- file.txt   →  No safe match, matches DESTRUCTIVE  →  DENY

2. Fail-Safe Defaults (Default-Allow)

Unrecognized commands are allowed by default. This ensures:

  • The hook never breaks legitimate workflows
  • Only *known* dangerous patterns are blocked
  • New git commands work until explicitly categorized

3. Zero False Negatives Philosophy

The pattern set prioritizes never allowing dangerous commands over avoiding false positives. A few extra prompts for manual confirmation are acceptable; lost work is not.

What It Blocks

Git Commands That Destroy Uncommitted Work

CommandReason
git reset --hardDestroys uncommitted changes
git reset --mergeDestroys uncommitted changes
git checkout -- <file>Discards file modifications
git restore <file> (without --staged)Discards uncommitted changes
git clean -fPermanently deletes untracked files

Git Commands That Destroy Remote History

CommandReason
git push --force / -fOverwrites remote commits
git branch -DForce-deletes without merge check

Git Commands That Destroy Stashed Work

CommandReason
git stash dropPermanently deletes a stash
git stash clearPermanently deletes all stashes

Filesystem Commands

CommandReason
rm -rf (outside /tmp, /var/tmp, $TMPDIR)Recursive deletion is dangerous

What It ALLOWS

Safe operations pass through silently:

Always Safe Git Operations

git status, git log, git diff, git add, git commit, git push, git pull, git fetch, git branch -d (safe delete with merge check), git stash, git stash pop, git stash list

Explicitly Safe Patterns

PatternWhy Safe
git checkout -b <branch>Creating new branches
git checkout --orphan <branch>Creating orphan branches
git restore --staged <file>Unstaging only, doesn't touch working tree
git restore -S <file>Short flag for staged
git clean -n / --dry-runPreview mode, no actual deletion
rm -rf /tmp/*Temp directories are ephemeral
rm -rf $TMPDIR/*Shell variable forms

Safe Alternative: --force-with-lease

git push --force-with-lease   # ALLOWED - refuses if remote has unseen commits
git push --force              # BLOCKED - can overwrite others' work

Modular Pack System

DCG uses a modular "pack" system to organize patterns by category:

Core Packs (Always Enabled)

PackDescription
core.gitDestructive git commands
core.filesystemDangerous rm -rf outside temp

Database Packs

PackDescription
database.postgresqlDROP/TRUNCATE in PostgreSQL
database.mysqlDROP/TRUNCATE in MySQL/MariaDB
database.mongodbdropDatabase, drop()
database.redisFLUSHALL/FLUSHDB
database.sqliteDROP in SQLite

Container Packs

PackDescription
containers.dockerdocker system prune, docker rm -f
containers.composedocker-compose down --volumes
containers.podmanpodman system prune

Kubernetes Packs

PackDescription
kubernetes.kubectlkubectl delete namespace
kubernetes.helmhelm uninstall
kubernetes.kustomizekustomize delete patterns

Cloud Provider Packs

PackDescription
cloud.awsDestructive AWS CLI commands
cloud.gcpDestructive gcloud commands
cloud.azureDestructive az commands

Infrastructure Packs

PackDescription
infrastructure.terraformterraform destroy
infrastructure.ansibleDangerous ansible patterns
infrastructure.pulumipulumi destroy

System Packs

PackDescription
system.diskdd, mkfs, fdisk operations
system.permissionsDangerous chmod/chown patterns
system.servicessystemctl stop/disable patterns

Other Packs

PackDescription
strict_gitExtra paranoid git protections
package_managersnpm unpublish, cargo yank

Configuring Packs

# ~/.config/dcg/config.toml
[packs]
enabled = [
    "database.postgresql",
    "containers.docker",
    "kubernetes",  # Enables all kubernetes sub-packs
]

Environment Variables

VariableDescription
DCG_PACKS="containers.docker,kubernetes"Enable packs (comma-separated)
DCG_DISABLE="kubernetes.helm"Disable packs/sub-packs
DCG_VERBOSE=1Verbose output
`DCG_COLOR=auto\always\never`Color mode
DCG_BYPASS=1Bypass DCG entirely (escape hatch)

Installation

Quick Install (Recommended)

curl -fsSL "https://raw.githubusercontent.com/Dicklesworthstone/destructive_command_guard/main/install.sh?$(date +%s)" | bash

# Easy mode: auto-update PATH
curl -fsSL "https://raw.githubusercontent.com/Dicklesworthstone/destructive_command_guard/main/install.sh?$(date +%s)" | bash -s -- --easy-mode

# System-wide (requires sudo)
curl -fsSL "https://raw.githubusercontent.com/Dicklesworthstone/destructive_command_guard/main/install.sh?$(date +%s)" | sudo bash -s -- --system

From Source (Requires Rust Nightly)

cargo +nightly install --git https://github.com/Dicklesworthstone/destructive_command_guard

Prebuilt Binaries

Available for: Linux x86_64, Linux ARM64, macOS Intel, macOS Apple Silicon, Windows

Claude Code Configuration

Add to ~/.claude/settings.json:

{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Bash",
        "hooks": [
          {
            "type": "command",
            "command": "dcg"
          }
        ]
      }
    ]
  }
}

Important: Restart Claude Code after adding the hook.

How It Works

Processing Pipeline

┌─────────────────────────────────────────────────────────────────┐
│                        Claude Code                               │
│  Agent executes `rm -rf ./build`                                │
└─────────────────────┬───────────────────────────────────────────┘
                      │
                      ▼ PreToolUse hook (stdin: JSON)
┌─────────────────────────────────────────────────────────────────┐
│                          dcg                                     │
│  ┌──────────────┐    ┌──────────────┐    ┌──────────────┐       │
│  │    Parse     │───▶│  Normalize   │───▶│ Quick Reject │       │
│  │    JSON      │    │   Command    │    │   Filter     │       │
│  └──────────────┘    └──────────────┘    └──────┬───────┘       │
│                                                  │               │
│                      ┌───────────────────────────┘               │
│                      ▼                                           │
│  ┌──────────────────────────────────────────────────────────┐   │
│  │                   Pattern Matching                        │   │
│  │   1. Check SAFE_PATTERNS (whitelist) ──▶ Allow if match  │   │
│  │   2. Check DESTRUCTIVE_PATTERNS ──────▶ Deny if match    │   │
│  │   3. No match ────────────────────────▶ Allow (default)  │   │
│  └──────────────────────────────────────────────────────────┘   │
└─────────────────────┬───────────────────────────────────────────┘
                      │
                      ▼ stdout: JSON (deny) or empty (allow)

Stage 1: JSON Parsing

  • Reads hook input from stdin
  • Validates Claude Code's PreToolUse format
  • Non-Bash tools immediately allowed

Stage 2: Command Normalization

  • Strips absolute paths: /usr/bin/git status → git status
  • Preserves argument paths

Stage 3: Quick Rejection Filter

  • SIMD-accelerated substring search for "git" or "rm"
  • Commands without these bypass regex entirely (99%+ of commands)

Stage 4: Pattern Matching

  • Safe patterns checked first (short-circuit on match → allow)
  • Destructive patterns checked second (match → deny)
  • No match → default allow

Exit Codes

CodeMeaning
0Command is safe, proceed
2Command is blocked, do not execute

CLI Usage

Test commands manually:

# Show version with build metadata
dcg --version

# Test a command
echo '{"tool_name":"Bash","tool_input":{"command":"git reset --hard"}}' | dcg

Example Block Message

════════════════════════════════════════════════════════════════════════
BLOCKED  dcg
────────────────────────────────────────────────────────────────────────
Reason:  git reset --hard destroys uncommitted changes. Use 'git stash' first.

Command:  git reset --hard HEAD~1

Tip: If you need to run this command, execute it manually in a terminal.
     Consider using 'git stash' first to save your changes.
════════════════════════════════════════════════════════════════════════

Contextual Suggestions

Command TypeSuggestion
git reset, git checkout --"Consider using 'git stash' first"
git clean"Use 'git clean -n' first to preview"
git push --force"Consider using '--force-with-lease'"
rm -rf"Verify the path carefully before running manually"

Edge Cases Handled

Path Normalization

/usr/bin/git reset --hard          # Blocked
/usr/local/bin/git checkout -- .   # Blocked
/bin/rm -rf /home/user             # Blocked

Flag Ordering Variants

rm -rf /path          # Combined flags
rm -fr /path          # Reversed order
rm -r -f /path        # Separate flags
rm --recursive --force /path    # Long flags

All variants are handled.

Shell Variable Expansion

rm -rf $TMPDIR/build           # Allowed (temp)
rm -rf ${TMPDIR}/build         # Allowed
rm -rf "$TMPDIR/build"         # Allowed
rm -rf "${TMPDIR:-/tmp}/build" # Allowed

Staged vs Worktree Restore

git restore --staged file.txt    # Allowed (unstaging only)
git restore -S file.txt          # Allowed (short flag)
git restore file.txt             # BLOCKED (discards changes)
git restore --worktree file.txt  # BLOCKED (explicit worktree)
git restore -S -W file.txt       # BLOCKED (includes worktree)

Performance Optimizations

DCG is designed for zero perceived latency:

OptimizationTechnique
Lazy StaticRegex patterns compiled once via LazyLock
SIMD Quick Rejectmemchr crate for CPU vector instructions
Early ExitSafe match returns immediately
Zero-Copy JSONserde_json operates on input buffer
Zero-AllocationCow<str> for path normalization
Release Profileopt-level="z", LTO, single codegen unit

Result: Sub-millisecond execution for typical commands.

Pattern Counts

TypeCount
Safe patterns (whitelist)34
Destructive patterns (blacklist)16

Security Considerations

What DCG Protects Against

  • Accidental data loss from git checkout -- or git reset --hard
  • Remote history destruction from force pushes
  • Stash loss from git stash drop/clear
  • Filesystem accidents from rm -rf outside temp directories

What DCG Does NOT Protect Against

  • Malicious actors (can bypass the hook)
  • Non-Bash commands (Python/JavaScript file writes, API calls)
  • Committed but unpushed work
  • Commands inside scripts (./deploy.sh contents not inspected)

Threat Model

DCG assumes the AI agent is well-intentioned but fallible. It catches honest mistakes, not adversarial attacks.

Troubleshooting

Hook not blocking commands

  1. Verify ~/.claude/settings.json has hook configuration
  2. Restart Claude Code
  3. Test manually: echo '{"tool_name":"Bash","tool_input":{"command":"git reset --hard"}}' | dcg

Hook blocking safe commands

  1. Check if there's an edge case not covered
  2. File a GitHub issue
  3. Temporary bypass: DCG_BYPASS=1 or run command manually

FAQ

Q: Why block git branch -D but allow git branch -d?

Lowercase -d only deletes branches fully merged. Uppercase -D force-deletes regardless of merge status, potentially losing commits.

Q: Why is git push --force-with-lease allowed?

Force-with-lease refuses to push if the remote has commits you haven't seen, preventing accidental overwrites.

Q: Why block all rm -rf outside temp directories?

Recursive forced deletion is extremely dangerous. A typo or wrong variable can delete critical files. Temp directories are designed to be ephemeral.

Q: What if I really need to run a blocked command?

DCG instructs the agent to ask for permission. Run the command manually in a separate terminal after making a conscious decision.

Integration with Flywheel

ToolIntegration
Claude CodeNative PreToolUse hook
Agent MailAgents can report blocked commands to coordinator
BVFlag tasks that repeatedly trigger DCG
CASSSearch DCG block patterns across sessions
RUDCG protects agent-sweep from destructive commits

平台分布

mcpjam

27.96%
按下载量换算156

Claude Code

22.23%
按下载量换算124

windsurf

16.14%
按下载量换算90

zencoder

11.8%
按下载量换算66

crush

8.29%
按下载量换算46

amp

3.6%
按下载量换算20

安全审计

Gen Agent Trust Hub

未通过

Socket

可疑

Snyk

未通过

权限和风险

接触敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在提醒或未通过项,安装前请自行复核。

继续浏览同类 Skills