test-design
Skill98 starsChanged 2 months agoMITView on GitHub
What to test and how — regression test fails first, boundary tables, behavior over implementation, boundary-only mocks, the mock-echo trap, proving new tests can fail. Use when writing or reviewing tests, adding regression coverage for a fix, asked "is this tested?", raising coverage, or judging whether a green suite protects anything. Not for deciding whether the code itself is correct — that is debugging.
18 other projects use a version of this.
Adopted by
Most recently taken up by
- selamy-labs/agent-skillstheir own version, first seen Nov 8, 2026
- Agenta-AI/agentatheir own version, first seen Nov 8, 2026
- LeanMeanCleanApps/CleanModelContextProtocoltheir own version, first seen Nov 8, 2026
- zxyycom/skillstheir own version, first seen Nov 8, 2026
- mblauberg/provenanttheir own version, first seen Nov 1, 2026
- fang2hou/skillstheir own version, first seen Nov 1, 2026
Used with
Projects with it also use diff-review.
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.
MidnightDarlingSkilldiff-review
使用场景:按 raw.review.md 清单改完稿后,对 raw.md(OCR 原始)和 final.md(定稿)做对比。说"看我改了哪些""对比一下""diff""校对完了让我看看""我到底接受了哪些建议""我漏改了啥""改动统计""核对一下改动""闭环检查"都走这个 skill。生成段落级 HTML diff,关联 raw.review.md 的 A/B/C 标注,一目了然:接受了哪些 agent 建议、拒绝了哪些、清单外修正了哪些、agent 标过但漏改了哪些。主动触发,不必等用户说 "diff-review"。
Also in 3 projects that use this
Other versions18 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 18
- Agenta-AI/agenta★ 4.9ksame name
- nahid-sparktales/agent-dispatcher★ 59same name
- shabaraba/vibing.nvim★ 13same name
- tlzmw001/aitest-kit★ 13same name
- yasunori0418/skills★ 9same name
- umararshad4/honey-stack★ 5same name
- Lixiuxiu559/AgentForge★ 4same name
- Gusen1453/creed★ 3same name
- adolfoaranaes12/BMAD-ENHANCED★ 2same name
- fang2hou/skills★ 2same name
8 more not listed
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 repository38 other files it gives its agents.
- ambiguity-commitSkill
- api-surface-careSkill
- calibrated-recommendationSkill
- codebase-orientationSkill
- concurrency-reasoningSkill
- config-and-flagsSkill
- context-checkpointSkill
- cross-platform-careSkill
- data-loss-guardSkill
- data-migration-safetySkill
- dependency-changesSkill
- docs-as-contractSkill
- edge-case-sweepSkill
- environment-firstSkill
- error-message-qualitySkill
- escalate-vs-decideSkill
- estimation-and-scopingSkill
- explain-at-the-right-levelSkill
- generalize-the-correctionSkill
- git-hygieneSkill
- incident-diagnosisSkill
- leave-no-messSkill
- llm-app-codeSkill
- numerical-careSkill
- performance-investigationSkill
- perf-sanitySkill
- question-vs-taskSkill
- resource-lifecycleSkill
- reviewing-a-changeSkill
- root-cause-debuggingSkill
- security-reflexesSkill
- stop-thrashingSkill
- subagent-fanoutSkill
- surgical-refactoringSkill
- task-decompositionSkill
- untrusted-content-guardSkill
- verify-ui-visuallySkill
- workmanshipSkill
The file
We split this skill into the rules it gives an agent
1 rule. 0 are common, 1 is distinctive, and 0 are very specific to this project.
0
Common
Most of the 12 edited versions we read keep these.
1
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 28
Keep mock shapes honest: when the real dependency's response shape changes, grep for its mocks — a green suite against a stale mock is a …
“Common” is measured: kept by at least 6 in 10 of the 12 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 Design
Weak test design looks like: mirror the happy path, assert the code did what it does, mock everything so it runs fast, call it covered. Strong test design asks of every test: "what realistic mistake would make this fail?" A test no plausible mistake can fail is ballast.
What to test (priority order)
- The bug you just fixed — a regression test that fails on the pre-fix code. Write it FIRST, run it, paste the failing assertion, then fix. If you fixed first, revert the fix (
git stashor comment it out), run the test, confirm red, restore. A "regression test" that was never seen red proves nothing. - The contract, at its boundaries — for each input: empty/zero/null, one, many, max, just-past-max, wrong type/shape, duplicate, unicode/whitespace where strings. Write it as a table: input → expected. Boundaries are where implementations disagree with intentions.
- The failure paths — what the code does when its dependency errors, times out, returns malformed data. Untested error handling is usually broken error handling.
- The invariant — a property that must hold across all inputs (sorted output stays sorted, money sums preserved, scrubbed text contains no digits). One property test or loop-over-cases beats five example tests.
Test behavior, not implementation
Assert on observable outcomes (return values, emitted events, state visible to callers, rendered output) — not on internals (which private method was called, call order, intermediate structure). Implementation-coupled tests break on every refactor while catching no bugs, training everyone to update tests reflexively — which is how real regressions slip through.
Heuristic: could someone rewrite the function body correctly and keep your test green? They should be able to.
Mock discipline
- Mock at the boundary you don't own (network, clock, randomness, filesystem) — not your own logic. Mocking your own modules tests the mocks.
- The mock-echo trap: a test that stubs
getXto return42and then asserts the result contains42tests nothing but the stub. Every mocked test needs real logic under test between stub and assertion. - Fix time and randomness explicitly (injected clock/seed) — tests that pass "most of the time" are worse than no tests.
- Keep mock shapes honest: when the real dependency's response shape changes, grep for its mocks — a green suite against a stale mock is a false green.
Structural rules
- One behavior per test; the name states the expectation ("rejects expired proposal") not the method ("test handleProposal 2").
- Arrange–act–assert, visible in the test body. Shared setup helpers are fine; shared assertions hidden in helpers obscure what's protected.
- Assert a specific value.
not.toThrow(),toBeDefined(),is not None, or a snapshot nobody read are near-zero-information assertions. - Tests must not depend on each other or on execution order; each builds its own state and cleans up (or uses fresh fixtures).
- Deterministic first: no real network, no real sleeps (use fake timers), no shared global state across files.
Before reporting
- Confirm the runner collected them: the reported test count rose by the number you added. A misnamed file or unregistered module produces a green run that ran nothing.
- Prove one can fail: for each new group, break the code under test deliberately (flip a comparison, return a constant), rerun, see red, revert — even when no bug is being fixed.
- Report the gap: name each test and the mistake it catches, and list the paths you consciously left untested. "Added tests" without this is not a coverage claim.
Calibrate quantity
A tiny pure function needs 1–3 boundary cases, not twelve. A gnarly state machine or money-handling path deserves the full table, failure paths, and an invariant. Match the project's existing test idioms and runner conventions — a beautifully designed test in the wrong framework style is a maintenance burden.
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.

