tdd
Skill4 starsChanged 2 months agoMITView on GitHub
What makes a test worth keeping — seams, assertions, mocking, and the anti-patterns that produce tests which pass forever and catch nothing. A reference consulted before and while writing a test, not a procedure. Use when writing or reviewing tests, choosing where to test, or judging whether a test earns its maintenance.
193 other projects use a version of this.
Adopted by
Most recently taken up by
- mattpocock/skillstheir own version, first seen Oct 8, 2026
- rafaelob/pragmatic-agent-skillstheir own version, first seen Oct 5, 2026
- AlexisBalayre/claude-code-configtheir own version, first seen Oct 5, 2026
- KroxiDev/engineering-skillstheir own version, first seen Oct 5, 2026
- gaia-react/gaiatheir own version, first seen Oct 5, 2026
- uzairansaruzi/p3-stacktheir own version, first seen Oct 5, 2026
Used with
Projects with it also use make-bot-ui, Poteto Mode and 10 more.
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.
eryzerzSkillmake-bot-ui
Use when building a custom UI (page, dashboard, buttons) that should wake a Grok Bot over a webhook, when the user must provide a webhook sender key, or when exposing that UI on Tailscale.
Also in 8 projects that use this
jtarorehSkillPoteto Mode
poteto's agent style for concise, detailed responses, deliberate subagents, unslopped prose, simple code, and verified work. Use for poteto, /poteto-mode, or requests to work in this style.
Also in 5 projects that use this
risadamsSkillwhich-skill
Router over this pack's skills and flows. Ask it "which skill fits X" when you don't remember what's available.
Also in 7 projects that use this
TheOnlyFusionCubeSkillprinciple-attack-the-premise
Inventory who actually owns or exhibits the imbalance, then challenge the shared premise before writing another patch. Use when two or more fixes that share one premise have failed the same gate.
Also in 11 projects that use this
TheOnlyFusionCubeSkillprinciple-test-behavior-not-implementation
Call the system the way its consumer does and assert meaningful observable output; avoid mocks or assertions that only mirror internal calls. Use when when writing or evaluating tests.
Also in 11 projects that use this
shreyT19Skillprinciple-laziness-protocol
Apply when refactoring, evaluating diff size, or tempted to add abstractions, layers, or signal threading. Bias toward deletion and the smallest change that solves the problem.
Also in 22 projects that use this
Other versions193 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 193
- mattpocock/skills★ 335ksame name
- Yeachan-Heo/oh-my-claudecode★ 40ksame name
- open-metadata/OpenMetadata★ 15ksame name
- vinvcn/mattpocock-skills-zh-CN★ 4.6ksame name
- parcadei/Continuous-Claude-v3★ 3.9ksame name
- rohitg00/pro-workflow★ 2.9ksame name
- crbnos/carbon★ 2.7ksame name
- codeaholicguy/ai-devkit★ 1.6ksame name
- backnotprop/pstack★ 991same name
- kdlbs/kandev★ 899same name
183 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.
The file
We split this skill into the rules it gives an agent
3 rules. 0 are common, 2 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 177 edited versions we read keep these.
2
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 46
Never recompute the expectation the way the implementation computes it:
- Very specific: line 69
Prefer the narrowest double that works.
- Distinctive: line 117
Test the branch, the parser, the boundary, the money path, the thing you had to think about.
“Common” is measured: kept by at least 6 in 10 of the 177 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
tdd — tests worth keeping
A test earns its place by two properties: it fails when behaviour breaks, and it stays quiet when only structure changes. Everything below serves those two and nothing else.
This is a reference, not a procedure — the loop, the gate and the stop
conditions live in the lexi skill. Consult this before writing a test and
while writing it, not in review afterwards.
Seams: where a test attaches
A seam is a boundary where behaviour is observable from outside: a public function, a module's exported API, a request handler, a repository method. Tests attach at seams and never reach behind them.
Behind the seam is implementation — private helpers, intermediate state, the order of internal calls. A test that reaches there breaks on a rename and survives a real regression, which is the exact inverse of what you want.
Choosing seams is a decision, not a discovery. Too shallow, every private function pinned, and the suite ossifies: no refactor is possible without a test rewrite. Too deep, only the top-level entry point, and a failure tells you the system is broken but not where. Pick the boundary where the behaviour has a name, agree it, and put the test there.
Naming: the test states what the system does
A test name is a sentence about capability: parses an ISO date without a timezone as UTC, rejects a coupon after its expiry. Read top to bottom, the suite should list what the unit can do.
works, test2, handles edge case describe nothing. When a name is hard to
write, the test is usually covering more than one behaviour — split it.
Assertions come from outside the code
An expected value must have an independent source: a literal worked out by hand, an example from the spec, a fixture captured from the real system.
Never recompute the expectation the way the implementation computes it:
expect(total(items)).toBe(items.reduce((a, i) => a + i.price, 0)) // asserts nothing
expect(total(items)).toBe(47.50) // asserts somethingThe first agrees with the code by construction and can never disagree with it — it is a copy of the implementation wearing a test's clothes. The same applies to a snapshot generated by the code under test and approved without being read.
Mocking
Replace what you don't own; use the real thing for everything else.
Network, clock, filesystem, randomness, third-party SDK → replace, because they make the test slow or non-deterministic. Your own domain objects, pure functions, value types → never: a mock of your own code asserts that your code calls itself in a particular way, which is mechanism, not behaviour.
Rule of thumb: if swapping a collaborator for a mock changes what the test proves, you are mocking too deep.
Prefer the narrowest double that works. A stub returning a value beats a mock
verifying call order — verify(x.wasCalledOnce()) is a claim about how, and
how is free to change. Assert on the observable result instead.
Anti-patterns
- Implementation-coupled — asserts on internals, private methods, or reads state through a side channel (querying the database instead of going through the interface). Tell: a refactor breaks it while behaviour is unchanged.
- Tautological — the assertion recomputes the expectation the way the code does, so it passes by construction.
- Horizontal slicing — all the tests first, then all the implementation. Bulk tests verify imagined behaviour: they commit to a shape before the implementation has taught you anything, and they go insensitive to the changes that matter. Work vertically — one test, one implementation, repeat.
- Assertionless — exercises the code and asserts nothing, or asserts
something true regardless (
expect(result).toBeDefined()). - Conditional — an
ifin a test body is either two tests, or a test that quietly skips its own assertion for some inputs. - Shared mutable fixture — order-dependent suites that pass alone and fail in CI. Each test builds what it needs.
Excuses that sound like reasons
Each feels true in the moment; none changes what the test is for. When one is the reason you are about to skip a step, write the test instead.
- "Too simple to test." Simple code still breaks, and its test is the cheapest.
- "I'll add the test after." A test written after passes on its first run, so it never proved it can fail.
- "I checked it by hand." A manual check leaves nothing behind; the next change undoes it unseen.
- "The test is wrong, not the code." Maybe. Then it is a breaking change: agree it first, never edit the assertion to reach green.
- "It's urgent." An urgent fix that breaks again is two incidents; the red test costs minutes.
- "The user said to skip it." Not an option lexi offers: the test comes first whoever asks.
Coverage
Coverage reports what was executed, never what was verified: a line run by a test with no assertion counts as covered and is not tested. Use it to find blind spots. Never set it as a target — a number chased directly gets met with assertionless tests, and then the suite is worse than before and looks better.
When not to write one
Test the branch, the parser, the boundary, the money path, the thing you had to think about. Skip the one-line delegation, the generated code, the constant, the getter.
A suite that tests everything is a suite nobody maintains, and an unmaintained test that fails gets deleted rather than fixed. Fewer tests that genuinely bite beat a wall of them that nobody trusts.
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.

