by PenglinChina
GuardList guard for AI coding agents: 72 cross-language footguns covered by four layers — instruction skill, zero-dependency deterministic detector, post-edit feedback hook, and CI gate (SARIF/GitHub). Works for C, C++, C#, Java, JS/TS, Python, Go and Rust.
Available after the catalog security scan passes.
⚠️ Third-Party Software Notice
This skill is third-party open-source software developed and hosted independently on GitHub. SkillsLLM lists this project for discovery and does not control or maintain the underlying repository.
Any security checks, ratings, or warnings displayed by SkillsLLM are automated and limited in scope. They do not constitute a security certification or guarantee that the software is safe, error-free, or free from malicious code, vulnerabilities, compromised dependencies, or prompt-injection risks.
Review the source code, permissions, dependencies, and configuration before installing or running any third-party skill. Use is at your own risk. To the maximum extent permitted by applicable law, SkillsLLM is not liable for losses arising from third-party software.
The deep catalog scan for this skill is still queued. Run an instant dependency check now instead.
# Add to your Claude Code skills
git clone https://github.com/PenglinChina/footgun-guardGuides for using ai agents skills like footgun-guard.
See how footgun-guard compares with popular alternatives.
GuardList 守卫:让 AI 在写代码、查代码、读代码、交付汇报时避开 80 条已知 footgun(代码写法 + 交付物质量)。 A GuardList guard that keeps AI coding agents away from 80 known footguns — code patterns and deliverable quality — while writing, reviewing, or reading code.
它不是一份"注意事项"清单,是四层结构——和 Impeccable 一样的分层:能判定的交给机器,判不了的交给流程,而且每一层都诚实说明自己覆盖不到什么。
| 层 | 是什么 | 在 FootgunGuard 里 |
|---|---|---|
| ① 指令层 | 提示词/playbook | skill/SKILL.md、skill/reference/*.md、AGENTS.md:可判定的祈使句 + 反例 + 自检顺序 |
| ② 测量层 | 确定性检测器 | src/rules/*.js + src/engine/:80 条里 61 条做成规则(19 条确定性 + 42 条启发式),19 条诚实留在人工清单(12 条共通 + 7 条语言特有);零依赖、无 AST、无网络 |
| ③ 反馈层 | 编辑后回灌 | src/commands/hook.js + hooks/:hook 把发现以 additionalContext 塞回 agent,永远非阻塞 |
| ④ 门禁层 | 退出码/CI | footgun detect 退出码 2、--sarif、--github:模型说什么都不影响合并结果 |
rustc 编译期拦截),要么需要跨语句语义(C-9/CPP-7 有符号溢出 UB、CS-11 P/Invoke 封送、JAVA-3 泛型擦除)。它们在注册表里标 tier: 'manual',由第①层和第③层的 /footgun review 承担。rustc 在编译期强制。检测器只补 3 条运行时语义(自引用结构体、RefCell 重复借用、Drop 中 panic)。"detect 干净"不等于 Rust 安全。.h 一律按 C 处理。tier: 'heuristic' 的规则。它们宁可少报,但你仍需要自己判断。detect 的输出里会明确写出"发现是不完全统计,不是健康证明"。
node src/cli.js detect . # 扫当前目录
node src/cli.js detect src/ --json # 机器可读
node src/cli.js context # 打印给 agent 的常驻指令块
node src/cli.js list --manual # 列出没有检测器的条目
node src/cli.js explain c-unsafe-string-fn # 查一条规则
node src/cli.js doctor # 自检:规则完整性、hook 接线
退出码:0 干净 / 2 有发现 / 1 有目标无法扫描。
DSH:把 AGENTS.md 放进项目根(DSH 会读进首个请求),或安装 hooks/dsh/ 插件拿到编辑后自动提醒。
Claude Code:把 hooks/claude-settings.json 的内容合并进 .claude/settings.json;或把 skill/ 复制到 .claude/skills/footgun-guard/。
一条命令装技能(仓库自带安装器,复制的是自包含的宿主目录):
node scripts/install.mjs --host claude # 装到 <当前项目>/.claude/skills/footgun-guard
node scripts/install.mjs --host dsh --scope global # 装到 ~/.dsh/skills/
--host 可用:claude / cursor / dsh / agents / codex / github / gemini / kiro / opencode / pi / omp / qoder / trae / trae-cn / rovodev / vibe / veto / grok / antigravity / hermes / devin。
其它宿主:把 AGENTS.md 放进项目(instruction 层),把 footgun hook 接到该宿主的 post-tool-use 事件。
- run: node src/cli.js detect --sarif src/ > footgun.sarif || test $? -eq 2
- uses: github/codeql-action/upload-sarif@v3
with: { sarif_file: footgun.sarif, category: footgun-guard }
2 仍然上传日志(有发现);1(有目标扫不了)会让这一步失败。包尚未发布到 npm,所以这里用仓库内路径;发布后 npx footgun 可替换 node src/cli.js。
| 文件 | 作用 |
|---|---|
| GuardList_cn.txt | 中文需求:每条 footgun 的"问题"与"检查" |
| GuardList_en.txt | 英文同构版:同样的 ID、同样的顺序 |
格式是两级标题 + 固定字段,用一个 for 循环就能解析:
## c · C
### C-8 strcpy 与 \0
- 问题:`strcpy`/`strcat`/`sprintf` 不看目标容量,多一个字节就是缓冲区溢出。
- 检查:改用 `snprintf`/`strlcpy`,并显式保证容量够放结尾的 \0。
判定规则:
## <语言> 的键必须与 src/engine/lang.js 一致,否则解析器直接报错。### <ID> <标题> 的 ID 是稳定标识(C-8、CS-3、RUST-5),规则用它对应,改名等于断链。- Problem: / - Check:。为什么分两版而不是一份双语表格:英文版是给英文项目/英文模型的真实输入,不是翻译副产品;两版同构由测试保证,不靠人自觉。
GuardList_cn.txt / GuardList_en.txt 需求源(双语同构,测试强制)
src/ 唯一真源:检测引擎 + 规则
engine/ 掩码器(剥注释与字符串)、上下文、语言判定、扫描
rules/ 9 个规则包,一条一个 detect()
commands/hook.js 第③层
cli.js 第④层与命令路由
skill/ 唯一真源:给模型看的文本
SKILL.md 第①层入口(含 {{cli}} 占位符)
reference/ 各语言条目(由 scripts/gen-docs.mjs 从注册表生成)+ common/review/audit(手写)
scripts/
build.mjs 把上面两者生成为 20 个宿主目录
gen-docs.mjs 从规则注册表生成 reference/<lang>.md
install.mjs 把某个宿主目录复制到项目/全局技能路径
smoke.mjs 单语言调规则
cli 生成物 见下节,勿手改
hooks/ Claude Code 设置片段、DSH 插件
fixtures/ 每条语言一份"有 footgun"和一份"干净"的样本
tests/ node --test
和 Impeccable 一样的做法——一份源码,生成全部宿主目录,产物提交进仓库,这样 git clone 完就能直接复制用。
node scripts/build.mjs # 写入 20 个宿主目录 + bundle payload(660 个文件)
node scripts/build.mjs --check # 校验磁盘与源是否一致,漂移则退出 1
每个宿主目录的形状固定:
<configDir>/skills/footgun-guard/
SKILL.md 渲染后的技能说明(占位符已替换成该宿主的相对路径)
reference/*.md 11 份 playbook / 语言条目
scripts/ 检测引擎的副本 + package.json(自包含,不需要另装依赖)
<configDir> 与 Impeccable 的 provider 表一致:
| 宿主 | 目录 | 宿主 | 目录 |
|---|---|---|---|
| Claude Code | .claude |
Qoder | .qoder |
| Cursor | .cursor |
Trae / Trae China | .trae / .trae-cn |
| DeepSeek Harness | .dsh |
Rovo Dev | .rovodev |
| Codex / 通用 | .agents |
Mistral Vibe | .vibe |
| GitHub Copilot | .github |
Veto | .veto |
| Gemini | .gemini |
Grok Build | .grok |
| Kiro | .kiro |
Antigravity | .agent |
| OpenCode | .opencode |
Hermes | .hermes |
| Pi / Oh My Pi | .pi / .omp |
Devin | .devin |
两处刻意的差异:
.agents(Codex)的 frontmatter 只有 name/description——Codex 的校验器会拒绝未知顶层键,其余宿主才带 user-invocable/license。workspace/(Muse):它只支持用户级安装,没有可生成的仓库内布局。node scripts/build.mjs --check 被写进了测试(tests/build.test.js),所以手改生成物、或改了 skill//src/ 忘了重跑构建,都会让测试变红。
### C-13 … + 问题 + 检查),再在 GuardList_en.txt 同样位置加英文版。ID 自己起,但必须唯一且之后不再改。src/rules/<lang>.js 加一个对象,listNo 填上一步的 ID。fixtures/<lang>/bad.* 埋一个正例,在 good.* 里确认不误报。node scripts/gen-docs.mjs && node scripts/build.mjs,然后 node --test "tests/**/*.test.js"。tier: 'manual' 并且不写 detect——注册表会拒绝不一致的规则。漏掉任何一步都会在测试里报出来:需求多于规则、规则多于需求、双语不同构、正例没覆盖、生成物漂移。
node scripts/test.mjs # 93 passed(跨 Node 版本可用)
node scripts/smoke.mjs c # 单语言:bad 全命中 / good 零发现
node src/cli.js detect fixtures # 67 条发现,退出码 2
node src/cli.js detect src # 自扫:19 个文件,0 findings
node src/cli.js doctor # 80/80 条编号覆盖,hook 接线状态
node scripts/build.mjs --check # 20 个宿主目录与源一致
tests/fixtures.test.js 断言的是 GuardList 编号(C8、Java2…),不是规则 id:每个语言的正例样本必须命中该语言全部可检测条目,反例样本必须零发现。加规则时不能靠改断言过关。
MIT
This is not a checklist of "things to be careful about" but a four-layer structure — the same layering as Impeccable: what can be decided by a machine goes to the machine, what cannot goes to process, and every layer is explicit about what it does not cover.
| Layer | What it is | In FootgunGuard |
|---|---|---|
| ① Instructions | prompt / playbook | skill/SKILL.md, skill/reference/*.md, AGENTS.md: checkable imperatives + counter-examples + self-check order |
| ② Measurement | deterministic detector | src/rules/*.js + src/engine/: 61 of the 80 rules (19 mechanical + 42 heuristic); the other 19 stay in an explicit manual list (12 common + 7 language-specific). Zero dependencies, no AST, no network |
| ③ Feedback | post-edit injection | src/commands/hook.js + hooks/: findings go back to the agent as additionalContext; never blocking |
| ④ Gate | exit codes / CI | footgun detect exit 2, --sarif, --github: what the model says cannot change the merge result |
rustc) or need cross-statement semantics (C-9/CPP-7 signed-overflow UB, CS-11 P/Invoke marshaling, JAVA-3 type erasure). They are marked tier: 'manual' and handled by layer ① and /footgun review in layer ③.rustc at compile time. The detectors only add 3 runtime-semantic checks (self-referential struct, RefCell double borrow, panic in Drop). "detect is clean" does not mean Rust is safe..h always treated as C.tier: 'heuristic' rule. They prefer under-reporting, but you still have to judge.detect output explicitly says the findings are an undercount, not a clean bill of health.
node src/cli.js detect . # scan the current directory
node src/cli.js detect src/ --json # machine-readable
node src/cli.js context # print the always-on instruction block for agents
node src/cli.js list --manual # list items without a detector
node src/cli.js explain c-unsafe-string-fn # look up one rule
node src/cli.js doctor # self-check: rule completeness, hook wiring
Exit codes: 0 clean / 2 findings / 1 some target could not be scanned.
DSH: put AGENTS.md in the project root (DSH reads it on the first request), or install the hooks/dsh/ plugin to get post-edit reminders.
Claude Code: merge the contents of hooks/claude-settings.json into .claude/settings.json; or copy skill/ to .claude/skills/footgun-guard/.
One-command install (ships a self-containe
footgun-guard is an open-source ai agents skill for AI coding assistants such as Claude Code, Codex CLI, and ChatGPT, built by PenglinChina. GuardList guard for AI coding agents: 72 cross-language footguns covered by four layers — instruction skill, zero-dependency deterministic detector, post-edit feedback hook, and CI gate (SARIF/GitHub). Works for C, C++, C#, Java, JS/TS, Python, Go and Rust. It has 77 GitHub stars.
footgun-guard's catalog security scan is still queued. You can run an instant dependency and prompt-injection check now with the "Scan for vulnerabilities" button above.
Clone the repository with "git clone https://github.com/PenglinChina/footgun-guard" and add it to your Claude Code skills directory (see the Installation section above).
footgun-guard is primarily written in JavaScript. It is open-source under PenglinChina on GitHub, so you can review or fork the full source.
Yes. SkillsLLM lists many other AI Agents skills you can browse and compare side by side. Open the AI Agents category from the badge at the top of this page, or use the Related Skills and comparison links further down to weigh footgun-guard against similar tools.
No comments yet. Be the first to share your thoughts!