Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add magic3007/dotfiles --skill git-destructive-op-guardgit clone --depth 1 https://github.com/magic3007/dotfilesWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/magic3007/dotfiles/git-destructive-op-guard)<a href="https://agentmods.dev/skills/magic3007/dotfiles/git-destructive-op-guard"><img src="https://agentmods.dev/badge/skills/magic3007/dotfiles/git-destructive-op-guard/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/magic3007/dotfiles/git-destructive-op-guard"><img src="https://agentmods.dev/badge/skills/magic3007/dotfiles/git-destructive-op-guard.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00256 | $0.03661 |
| Opus 5.5 | $0.00102 | $0.01464 |
| Sonnet 5.5 | $0.00051 | $0.00732 |
| Haiku 4.5 | $0.00026 | $0.00366 |
Grade C, and why
git-destructive-op-guard scanned grade C with 2 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Recursive force deletehighDestructive command
rm -rf with a variable or a broad path is one typo away from removing the wrong tree.
- 非 git 的同类事故:脚本内 `rm -rf`、`cp` 覆写、installer 覆盖配置 Runs shell commandslowCapability
Expected in a hook, worth knowing in a rule or an instructions file.
| F8 | eval 内核里 `sh("git checkout -- .")` 同样被拦(走 bash 工具),但 `subprocess.run(["git","checkout","--","."])` 直接执行成功并破坏工作区 | `sh()` 抛 ShellError exit 1;`subprocess.run` 返回 0,文件被改回旧值 | 在 eval 单元格里分别跑两种调用 | 同上 | 2026-11-13 | How it starts
The opening of the file, as written. The whole thing — 144 lines — stays where its author put it; the contents beside it link to each section on GitHub.
共享 checkout 里的破坏性 git 命令
Facts
| # | 事实 | 证据 | 复核命令 | 生效条件 | 记录日期 |
|---|---|---|---|---|---|
| F1 | git checkout -- . 把工作区全部未暂存改动还原为索引内容,git status --porcelain 随即变空 |
夹具仓库两文件均 M,执行后 git status 无输出,内容回到 v1 |
在一次性仓库改两个已跟踪文件后执行 git checkout -- .,再看 git status --porcelain |
git 2.34+ | 2026-11-13 |
| F2 | 已暂存改动能活过 git checkout -- .;工作区从索引重建,内容还在对象库 |
夹具中 git add 后执行,mine.txt 仍为 staged-v2,git rev-parse :mine.txt 有 blob |
同上,改动先 git add 再执行 |
同上 | 2026-11-13 |
| F3 | 被 git checkout -- . 抹掉的未暂存内容不可恢复:git fsck --lost-found 找不到对应 blob |
夹具执行后 git fsck --lost-found | grep -c blob 输出 0 |
同上,执行后跑 git fsck --lost-found |
未暂存 = 从未 git add |
2026-11-13 |
| F4 | bash.gitGuard: true 时,git checkout -- .、git checkout HEAD -- .、git restore --worktree .、git reset --hard、git stash、git switch <branch> 全部被拒,exit=1,工作区不变 |
六条命令逐条执行,均 exit=1 且 cat 目标文件仍为新值 |
git checkout -- . 于脏工作区(须在共用 checkout 内) |
omp 18.20.0, bash.gitGuard: true |
2026-11-13 |
| F5 | bash.gitGuard 不拦 git clean -fdx;该命令 exit=0 并删掉未跟踪文件 |
夹具中被删文件 ls 报 No such file or directory |
一次性仓库放一个未跟踪文件后 git clean -fdx |
omp 18.20.0 | 2026-11-13 |
| F6 | bash.patterns 加 {"match":"git clean*","approval":"deny"} 后,bash 工具整条命令被拒:Tool "bash" is blocked by tool policy. + Blocked by bash pattern: git clean*;git clean -n* 前置 allow 项仍放行 dry-run |
单条 git clean -fdx 被拒,单条 git clean -n --dry-run exit=0 |
git clean -fdx 于一次性仓库 |
同上,规则顺序 allow 在 deny 前 | 2026-11-13 |
| F7 | 在 git worktree add <path> -b <br> 建的自有 worktree 内,同类命令放行且自动保存:git checkout: saved your uncommitted changes as <sha> on refs/omp/discarded first |
自有 worktree 内 git checkout -- . exit=0 并打印该行 |
建 worktree 后在其中改文件再执行 | 同上 | 2026-11-13 |
| F8 | eval 内核里 sh("git checkout -- .") 同样被拦(走 bash 工具),但 subprocess.run(["git","checkout","--","."]) 直接执行成功并破坏工作区 |
sh() 抛 ShellError exit 1;subprocess.run 返回 0,文件被改回旧值 |
在 eval 单元格里分别跑两种调用 | 同上 | 2026-11-13 |
Model
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 4d ago Changed 0069926a42c5
- 16d ago First seen · 144 lines · 256 tokens per session scan C 060cce421271
git-destructive-op-guard is a skill published in the GitHub repository magic3007/dotfiles (11 stars, last pushed 5d ago), licensed MIT. It adds 256 tokens to every session and 3,661 once invoked, about $0.0010 per session on Opus 5.5. A static security scan graded it C with 2 findings (recursive force delete, runs shell commands). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-11-14.
git-destructive-op-guard compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| git-destructive-op-guardmagic3007/dotfiles | Skill | 11 | 5d ago | MIT | C | 256 | Claude Code, Codex |
| merge-readyurmzd/dotfiles | Skill | 6 | 4d ago | Apache-2.0 | A | 208 | Claude Code |
| sync-releaseurmzd/dotfiles | Skill | 6 | 4d ago | Apache-2.0 | A | 136 | Claude Code |
| setup-ciurmzd/dotfiles | Skill | 6 | 4d ago | Apache-2.0 | A | 119 | Claude Code |
| landurmzd/dotfiles | Skill | 6 | 4d ago | Apache-2.0 | A | 168 | Claude Code |
| prurmzd/dotfiles | Skill | 6 | 4d ago | Apache-2.0 | A | 161 | Claude Code |
| work-statusurmzd/dotfiles | Skill | 6 | 4d ago | Apache-2.0 | A | 187 | Claude Code |