test-design
Skill98 starsChanged 3 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.
11 other projects use a version of this.
Adopted by
Most recently taken up by
- mrpupkeen/test-designtheir own version, first seen Oct 6, 2026
- nahid-sparktales/agent-dispatchertheir own version, first seen Sep 21, 2026
- Gusen1453/creedtheir own version, first seen Sep 18, 2026
- Hakkadaikon/hymmetheir own version, first seen Sep 9, 2026
- fang2hou/skillstheir own version, first seen Aug 18, 2026
- tlzmw001/aitest-kittheir own version, first seen Aug 13, 2026
Other versions11 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 11
- nahid-sparktales/agent-dispatcher★ 59same name
- shabaraba/vibing.nvim★ 14same name
- tlzmw001/aitest-kit★ 13same name
- yasunori0418/skills★ 8same name
- Gusen1453/creed★ 3same name
- adolfoaranaes12/BMAD-ENHANCED★ 2same name
- fang2hou/skills★ 2same name
- mattstruble/skills★ 2same name
- mrpupkeen/test-design★ 1same name
- Hakkadaikon/hymme★ 0same name
1 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 8 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 8 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.

