Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
boshu2 avatar

Dcg

  • 23 installs
  • 416 repo stars
  • Updated August 5, 2026
  • boshu2/agentops

DCG is a Claude Code skill that blocks destructive commands like rm -rf and git reset --hard and steers the agent to a safe alternative or a human-approved override.

About

DCG is a destructive-command guard that blocks dangerous shell, git, database, filesystem, and Kubernetes commands and offers a safe alternative for each. When an agent hits a block it explains why, suggests a recoverable variant such as git stash for git reset --hard, and only surfaces a human-approved allow-once code when no alternative exists. It is context-aware, so rm -rf ./build is allowed while rm -rf / is blocked.

  • Blocks destructive shell, git, DB, and k8s commands with a safe alternative for each
  • Context-aware: rm -rf ./build allowed, rm -rf / blocked
  • Human-only allow-once codes: 4 hex chars, 24h expiry, bound to command and directory

Dcg by the numbers

  • 23 all-time installs (skills.sh)
  • Ranked #1,564 of 2,203 Security skills by installs in the Skillselion catalog
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
At a glance

dcg capabilities & compatibility

Free; configured via .dcg.toml and DCG_* environment variables, no API keys required.

Capabilities
dependency update safety
Works with
docker · kubernetes · postgres · aws
Use cases
security audit · devops
Pricing
Free
From the docs

What dcg says it does

Blocks are checkpoints, not errors. A safe alternative almost always exists.
SKILL.md
**Context-aware:** `rm -rf ./build` allowed, `rm -rf /` blocked.
SKILL.md
**Allow-once codes** — 4 hex chars, 24h expiry, bound to exact command+directory
SKILL.md
npx skills add https://github.com/boshu2/agentops --skill dcg

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs23
repo stars416
Last updatedAugust 5, 2026
Repositoryboshu2/agentops

What it does

Handle blocked destructive commands and configure agent safety guardrails against rm -rf, git reset --hard, DROP DATABASE, and kubectl delete.

Who is it for?

Teams running coding agents that need mechanical guardrails against irreversible shell, git, and database commands.

When should I use this skill?

When dcg blocks rm -rf, git reset --hard, DROP DATABASE, or kubectl delete, or when configuring agent safety guardrails.

What you get

Destructive commands are mechanically blocked at a checkpoint with a safe alternative surfaced before any override is mentioned.

By the numbers

  • 49+ rule packs available
  • sub-millisecond latency
  • allow-once codes are 4 hex chars with 24h expiry

Files

SKILL.mdMarkdownGitHub ↗

<!-- TOC: Core Insight | THE EXACT WORKFLOW | Quick Reference | Safe Alternatives | What Gets Blocked | Anti-Patterns | Configuration | References -->

DCG: When You Get Blocked

Core Insight: Blocks are checkpoints, not errors. A safe alternative almost always exists. Find it before mentioning override.

Quick Navigation

I need to...Go to
Handle a block right nowTHE EXACT WORKFLOW
Find a safe alternativeSafe Alternatives
See all CLI commandsCOMMANDS.md
Enable more rule packsPACKS.md
Configure per-projectCONFIG.md
Debug hook issuesTROUBLESHOOTING.md

---

THE EXACT WORKFLOW

When blocked, follow this sequence every time:

1. Run `dcg explain "cmd"` → Understand why (see trace)
2. Check Safe Alternatives table → Use if exists (DON'T mention override)
3. No alternative? → Explain risk clearly, let human decide
4. Human approves? → THEY run: dcg allow-once CODE

Never: Ask for override first. Never retry silently. Never circumvent.

Example block output:

BLOCKED: git reset --hard HEAD
Rule: core.git:reset-hard
Reason: Discards uncommitted changes permanently
Allow-once code: ab12
Safer alternative: git stash

Good response:

"I wanted to discard changes but git reset --hard was blocked. Let me use git stash instead—recoverable if needed." [proceeds with stash]

Safe Alternatives

BlockedUse InsteadWhy
git reset --hardgit stashRecoverable
git checkout -- filegit stash push filePreserves changes
git push --forcegit push --force-with-leaseChecks remote unchanged
git clean -fdgit clean -fdn (preview)Shows what would delete
git stash dropgit stash list firstVerify which stash
rm -rf /pathrm -ri /path or verify pathInteractive/confirm
kubectl delete namespacekubectl delete -l app=XSelective deletion
DROP DATABASEBackup firstHuman approves
docker system prune -adocker system df firstSee what's used

Quick Reference

dcg doctor              # Health check — hook registered?
dcg explain "cmd"       # WHY is it blocked? (with trace)
dcg test "cmd"          # Would this be blocked? (dry-run)
dcg allow-once CODE     # Human approves (THEY run this)
dcg packs               # List available rule packs
dcg scan --staged       # Pre-commit: scan for issues

---

What Gets Blocked

CategoryPatternsSafe Variants
Git destructivereset --hard, checkout --stash, restore --staged
Git historypush --force, branch -D--force-with-lease, -d
Git stashstash drop, stash clearstash list first
Filesystemrm -rf (dangerous paths)/tmp/* allowed
DatabaseDROP, TRUNCATE, DELETE w/o WHEREAdd WHERE clause
K8sdelete namespace, delete --all-l label selector

Context-aware: rm -rf ./build allowed, rm -rf / blocked.

`dcg explain` example (7-step pipeline):

$ dcg explain "git reset --hard HEAD"
BLOCKED by core.git:reset-hard

Evaluation trace:
  1. Config allow overrides: no match
  2. Config block overrides: no match
  3. Heredoc detection: not applicable
  4. Quick reject: triggered (contains "reset")
  5. Context sanitization: no changes
  6. Normalization: git reset --hard HEAD
  7. Pack evaluation:
     - Safe patterns: no match
     - Destructive: MATCH "reset --hard"

Suggestion: Use `git stash` to preserve changes

Anti-Patterns

❌ "Command blocked. Run dcg allow-once ab12"  → Find alternative first!
❌ *Retrying silently or circumventing*         → Always acknowledge blocks
❌ Treating blocks as errors                    → They're checkpoints
❌ Asking user to allow-once without explaining → They need context

Configuration

# .dcg.toml — enable rule packs per-project
[packs]
enabled = ["database.postgresql", "kubernetes.kubectl", "cloud.aws"]

[overrides]
allow_patterns = ["rm -rf ./node_modules"]  # Project-specific safe

Environment variables:

  • DCG_PACKS="containers.docker,kubernetes" — Enable packs
  • DCG_DISABLE="kubernetes.helm" — Disable specific packs
  • DCG_BYPASS=1 — Escape hatch (human-only)

Key Facts

  • 49+ rule packs available (database, containers, k8s, cloud, etc.)
  • Sub-millisecond latency — won't slow your workflow
  • Fail-open on timeout — if DCG hangs, command runs (with warning)
  • Heredoc scanning — inline scripts (bash -c, python -c) are analyzed
  • Allow-once codes — 4 hex chars, 24h expiry, bound to exact command+directory

The Incident That Started It All

On December 17, 2025, an AI agent ran git checkout -- on files containing hours of uncommitted work. The files were recovered via git fsck --lost-found, but it proved: instructions don't prevent execution—mechanical enforcement does.

---

Validation

# Quick health check
dcg doctor | head -20

# Test if a command would be blocked
dcg test "git reset --hard HEAD"

# Should show: WOULD BE BLOCKED

---

Scripts

ScriptUsage
./scripts/validate-dcg.shFull installation validation

---

References

  • COMMANDS.md — Full CLI reference with dcg explain, dcg scan
  • PACKS.md — 49+ rule pack system (database, k8s, cloud, etc.)
  • CONFIG.md — Configuration, agent profiles, heredoc settings
  • SCENARIOS.md — Detailed examples with good/bad responses
  • PHILOSOPHY.md — Why DCG works this way
  • TROUBLESHOOTING.md — Common issues and fixes

Related skills

FAQ

How should an agent react to a DCG block?

Run dcg explain to understand it, use a safe alternative if one exists without mentioning override, and otherwise explain the risk and let a human run allow-once.

Does DCG slow down my workflow?

No. It runs at sub-millisecond latency and fails open on timeout, so a hung check lets the command run with a warning.

Securityappseccompliance

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.