done-gate Skill
免费的 Claude Code hook,阻止编程智能体在没有证据的情况下声称"完成""修好了"或"所有测试通过"。代码修改后,智能体必须在其最后一次改动之后真实运行并通过测试命令才能结束回合;管道化、被屏蔽或失败的运行都不算数。当你想让 Claude Code 在报告成功前先证明成果,或智能体总是不跑测试就声称通过时使用。
安装方式:把技能目录放入 ~/.claude/skills/(Claude Code)或在 claude.ai 设置中启用;也可复制右侧安装命令一键添加。
技能指令原文(SKILL.md)
Done Gate (free)
Your agent says "done, all tests pass". Done Gate checks the commands that actually ran, not
the agent's words. No passing test run after the last edit means no "done": the agent is told
exactly what to run, runs it, fixes what fails, and only then finishes.
Install (Claude Code; ask the user first)
- Find Python 3.9+:
python3 --version, thenpython --version, thenpy -3 --version(Windows).
Use the first that works as .
= the absolute path of this skill's folder (where this SKILL.md is).- Ask: this project only (
.claude/settings.json) or every project (~/.claude/settings.json)? - Merge
assets/hooks-settings.jsoninto that file, replacingand. **Merge, never
overwrite:** keep every existing setting and hook; append these three entries.
- Tell the user it is active from the next turn, and how to switch it off (remove the entries or
/hooks).
What it checks (scripts/done_gate.py)
- PostToolUse records code edits and test runs (pytest, npm/yarn/pnpm test, jest, vitest, go test,
cargo test, mvn, gradle, dotnet test, rspec, phpunit, make test and more).
- Stop blocks the end of the turn when code changed and no passing test run happened after the
last edit. A run piped into tail/grep, masked with || true, or with 0 tests collected does not count.
- It never traps you: after two reminders it lets the turn end with a visible warning, so projects
without tests keep working. Sessions without code edits are never blocked.
- Local and private: standard-library Python, a tiny state file per session, no network, no telemetry.
- Config that relaxes the gate (
test_commands,ignore_paths,allow, a lowermax_blocks) lives
only in the user's ~/.claude/proof-of-done.json, globally or under projects. A repository's
.proof-of-done.json can only tighten it: a higher max_blocks and "integrity": true.
When the hook blocks you (agent instructions)
Do what the message says: run the real test command, read the result, fix the code (never the
tests), re-run, then report with evidence: the command, its exit code and the summary line.
Never edit the hook's state, disable hooks, or run a different command that "looks green".
Want more?
The paid Proof-of-Done adds a test-integrity guard (blocks deleted, skipped or weakened tests,
lowered coverage thresholds and softened CI); drop its test_integrity.py next to done_gate.py
and it switches on. The Claude Code Guardrails kit adds Safety Guard (blocks recursive deletes,
git reset --hard, force pushes when they would destroy work) and Fake Package Blocker.
Both on Agensi: https://www.agensi.io/creators/cesar-pereiro