test-quality
Skill1 starsChanged 6 months agoMITView on GitHub
Test quality nine rules. test-is-truth demands that "done" is backed by a test verdict; this skill governs whether the tests themselves are worth trusting. Coding agents over-generate tests: mock-heavy suites asserting implementation details, near-duplicate bodies differing by one value, tests that re-verify the framework. Triggers when about to write or generate tests, review a diff containing tests, or QA-review a sub-agent's test output. 测试质量九规:test-is-truth 管"完成必须有测试结论",本 skill 管"测试本身写得好不好"。agent 会过度生成测试——mock 堆山、近似重复、测框架不测逻辑。
10 other projects use a version of this, 1 of them edited.
Adopted by
Most recently taken up by
- AhmedAbdelfattah0/AI-Skillsedited, first seen Sep 28, 2026
- decebals/claude-code-javatheir own version, first seen Sep 6, 2026
- techygarg/latticetheir own version, first seen Sep 3, 2026
- danielteles/awesome-agent-skillstheir own version, first seen Sep 2, 2026
- hams-ollo/zen-agent-skillstheir own version, first seen Aug 31, 2026
- bruuuuuce/manatheir own version, first seen Aug 7, 2026
Used with
Projects with it also use clean-code and security-audit.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
xfstudioSkillclean-code
Pragmatic coding standards - concise, direct, no over-engineering, no unnecessary comments
Also in 3 projects that use this
CloudflareSkillsecurity-audit
Security guidance and vulnerability review for codebases, APIs, services, CLI tools, libraries, and daemons. Use for security questions, focused reviews, vulnerability research, security audits, or pen tests. Run the complete workflow only for explicit codebase audit or pen-test requests, full/comprehensive/end-to-end reviews, or requested report artifacts.
Also in 3 projects that use this
Other versions10 projects use a version of this.
Word for word · 0
None found.
Edited · 1
- AhmedAbdelfattah0/AI-Skills★ 412% same
Wrote their own version · 9
- modelcontextprotocol/python-sdk★ 24ksame name
- decebals/claude-code-java★ 747same name
- techygarg/lattice★ 197same name
- rollinsio/beyond-test-coverage★ 52same name
- danielteles/awesome-agent-skills★ 3same name
- bruuuuuce/mana★ 2same name
- hams-ollo/zen-agent-skills★ 2same name
- andrewclark88/skills★ 1same name
- iCesofT/awesome-ai★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository9 other files it gives its agents.
- agent-teamSkill
- ask-before-actSkill
- check-versionsSkill
- first-principlesSkill
- incremental-buildSkill
- log-firstSkill
- no-dead-codeSkill
- restraintSkill
- test-is-truthSkill
The file
We split this skill into the rules it gives an agent
3 rules. 0 are common, 3 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 10 edited versions we read keep these.
3
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 26
Every test must justify its existence: Delete tests that only catch typos, verify dataclass defaults, or exercise trivial pass-throughs.
- Distinctive: line 32
Don't test framework guarantees: If the test would still pass with all your custom code deleted, it tests the framework, not the project.
- Distinctive: line 36
Infrastructure under test gets real infrastructure: When persistence *is* the subject, run a real test database with real migrations.
“Common” is measured: kept by at least 6 in 10 of the 10 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Test Quality Nine Rules / 测试质量九规
Before writing any test, answer: "What bug does this catch that no other test catches?" No answer, no test. 写任何测试前先答:"它能抓到什么别的测试抓不到的 bug?"答不出就不写。
The discipline / 纪律
- Test behavior, not implementation. Assert return values and observable side effects. Never assert that an internal helper was called with specific arguments — that breaks on every refactor and catches nothing. 测行为不测实现。 断言返回值和可观察副作用;永不断言"内部函数被以某参数调用过"——重构必碎,什么也抓不到。
- Every mock must be justified. Mock only at system boundaries: network/HTTP, LLM APIs, databases, external file I/O, clock & randomness, third-party SDKs. Never mock internal classes to isolate a "unit". When you mock a boundary, assert what the caller does with the response. 每个 mock 要有正当性。 只在系统边界 mock;禁止 mock 内部类来隔离"单元"。mock 边界后,断言调用方拿响应做了什么。
- One scenario per test; variants go data-driven. Same setup differing only in values → merge into
parametrize/test.each/DataProvider. 一个场景一个测试,变体走参数化。 setup 相同只差值的合并成数据驱动。 - Every test must justify its existence. Delete tests that only catch typos, verify dataclass defaults, or exercise trivial pass-throughs. 每个测试自证价值。 只能抓 typo 的、验证默认值的、测平凡透传的,删。
- Name tests for the scenario.
test_<scenario>_<expected_outcome>— reads like a requirement, not an echo of the function signature. 测试名说场景。 读起来像需求,不是函数签名回声。 - Production regression tests are sacred. A test reproducing a real production bug is always justified; reference the incident and never delete it. Exempt from rule 4. 生产回归测试神圣不可删。 复现真实生产 bug 的测试永远正当,注明事故来源,豁免第 4 条。
- Don't test framework guarantees. If the test would still pass with all your custom code deleted, it tests the framework, not the project. 不测框架保证。 把项目自定义代码全删了还能过的测试,测的是框架。
- State and value objects are real, never mocked. Construct real DTOs/entities. Mocking state hides field-name typos and validation errors — exactly the bugs worth catching. Painful construction is design feedback: add a builder, don't mock. 状态与值对象永不 mock。 构造真实例;mock 状态恰好藏住字段 typo 和校验错误。构造太痛苦是设计反馈,加 builder 而不是 mock。
- Infrastructure under test gets real infrastructure. When persistence is the subject, run a real test database with real migrations; mocking the session there tests nothing. Mocking is fine when persistence is only a side effect. 测基础设施就上真基础设施。 持久化是被测对象时跑真库真迁移;只是副作用时才可 mock。
Severity / 严重度: rules 1, 2, 8 = must-fix (they hide real bugs) · rules 3, 4, 5, 7 = should-fix (bloat) · rule 6 = sacred (never delete) · rule 9 = note, don't block. 分档: 1/2/8 必须修(藏真 bug) · 3/4/5/7 应该修(膨胀) · 6 神圣 · 9 记录不阻塞。
When this triggers / 触发时机
- About to write or generate tests (put the nine rules in a sub-agent's task brief too).
- Reviewing a diff or MR that contains test changes.
- QA / inspector reviewing a sub-agent's test output.
- Noticing unusually high mock density or near-duplicate test bodies.
Done criterion (verifiable) / 完成判据(可验证)
✅ Every mock in the diff sits on a system boundary you can name; no test asserts internal call arguments; no two tests differ only by values; state objects are constructed real. ⚠️ Should-fix violations (bloat, naming, framework tests) noted and queued — acceptable for small changes. ❌ A must-fix violation ships: an internal mock, an implementation-detail assertion, or a mocked DTO. Fix before merge.
Worked examples / 实战反例
Real before/after cases for this discipline live in EXAMPLES.md — read them before you act. 本纪律的真实 before/after 反例见 EXAMPLES.md —— 动手前先对照。
Adapted from guard-skills' test-guard (MIT, Ahmed Nagdy), rebuilt for the agent-discipline verifiable-check format.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

