test-discipline
Skill0 starsChanged 4 months agoMITView on GitHub
What makes a test worth having — test behavior not implementation, cover the case that motivated the change, mock sparingly. Use when writing tests, reviewing tests, or deciding what to test.
15 other projects use a version of this.
Adopted by
Most recently taken up by
- thrillmade/agent-skillstheir own version, first seen Nov 8, 2026
- niksavis/handilytheir own version, first seen Nov 8, 2026
- github/squadtheir own version, first seen Nov 8, 2026
- niksavis/basiclytheir own version, first seen Nov 7, 2026
- Dimon94/skillstheir own version, first seen Nov 1, 2026
- Dimon94/dveritytheir own version, first seen Nov 1, 2026
Used with
Projects with it also use squad-commands, architectural-proposals 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.
Microsoft AzureSkillsquad-commands
Categorized catalog of common Squad operations. Coordinator reads this file and presents it as an interactive menu when the user asks for available commands or help.
Also in 4 projects that use this
Microsoft AzureSkillarchitectural-proposals
How to write comprehensive architectural proposals that drive alignment before code is written
Also in 3 projects that use this
- +10 more from Azure
Other versions15 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 15
- github/gh-aw★ 5.6ksame name
- github/squad★ 3.4ksame name
- microsoft/waza★ 1.5ksame name
- Azure/fleet★ 227same name
- kubefleet-dev/kubefleet★ 164same name
- Dimon94/dverity★ 107same name
- Dimon94/skills★ 107same name
- microsoft/devsquad-copilot★ 50same name
- Azure/apiops-cli★ 32same name
- thrillmade/agent-skills★ 3same name
5 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 repository32 other files it gives its agents.
- architect-modeSkill
- architecture-bundleSkill
- code-like-a-localSkill
- decision-making-guardrailsSkill
- decision-recordsSkill
- delivery-bundleSkill
- fable-modeSkill
- finish-the-turnSkill
- incident-response-playbookSkill
- launch-readiness-gateSkill
- lead-developer-modeSkill
- lead-with-outcomeSkill
- lean-tool-useSkill
- migration-refactor-safetySkill
- plan-before-implementationSkill
- pr-and-commit-hygieneSkill
- product-delivery-bundleSkill
- product-minded-engineer-modeSkill
- reliability-bundleSkill
- reliability-incident-modeSkill
- review-quality-gateSkill
- run-guardrails-on-code-changesSkill
- security-bundleSkill
- security-minded-engineer-modeSkill
- senior-operating-systemSkill
- staff-engineering-bundleSkill
- staff-engineer-modeSkill
- stakeholder-communicationSkill
- surgical-questionsSkill
- systematic-debuggingSkill
- truthful-reportingSkill
- verify-by-exercisingSkill
The file
We split this skill into the rules it gives an agent
7 rules. 0 are common, 7 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 13 edited versions we read keep these.
7
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 23
Never mock the thing under test, and don't mock what you can use for real — pure functions, in-memory implementations, local files.
- Distinctive: line 25
If a test needs five mocks to instantiate the subject, that's design feedback about coupling — worth reporting, not muffling with more …
- Distinctive: line 30
Prefer assertions whose failure output shows the actual vs.
- Distinctive: line 39
Do not write a fix's test without seeing it fail against the unfixed code.
- Distinctive: line 40
Do not assert on implementation details a refactor would legitimately change.
- Distinctive: line 41
Do not mock the system under test.
- Distinctive: line 42
Do not delete or skip a failing test to make a suite green — that is falsifying the report.
“Common” is measured: kept by at least 6 in 10 of the 13 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 discipline
Tests are not a quota to fill; they are executable claims about behavior. A good test fails when the behavior breaks, passes when it doesn't, and tells you what went wrong when it fails. Everything else follows from that.
Test behavior, not implementation
- Assert on what the code does — outputs, state changes, observable effects — not on how it does it (which private method ran, in what order, with what internal arguments).
- A test that breaks on a refactor that preserved behavior is a bad test: it punishes exactly the maintenance work tests exist to enable.
- Name the test after the behavior it claims:
rejects_expired_tokens, nottest_validate_2.
Cover the motivating case
- The first test for any change is the case that motivated it: the bug's reproduction, the feature's core promise. If the change is a fix, the test must fail without the fix — run it both ways once to prove it.
- Then the edges the change creates: the empty input, the boundary value, the error path, the concurrent caller — chosen because the changed code makes them reachable, not from a generic checklist.
Mock sparingly
- Never mock the thing under test, and don't mock what you can use for real — pure functions, in-memory implementations, local files.
- Mock at system boundaries: the network, the clock, the payment provider. A test whose every collaborator is fake verifies your mocks agree with each other, not that the code works.
- If a test needs five mocks to instantiate the subject, that's design feedback about coupling — worth reporting, not muffling with more mocks.
Make failures readable
- One behavior per test, so a failure names the broken behavior rather than "something in this 40-assertion test."
- Prefer assertions whose failure output shows the actual vs. expected values.
- A test the next engineer can't understand will be deleted or ignored the first time it fails inconveniently.
Coverage is a byproduct, not a goal
Chasing a percentage produces assertion-free tests that execute lines without checking anything. Coverage is useful for finding untested code; it says nothing about whether the tested code is tested well.
Non-negotiables
- Do not write a fix's test without seeing it fail against the unfixed code.
- Do not assert on implementation details a refactor would legitimately change.
- Do not mock the system under test.
- Do not delete or skip a failing test to make a suite green — that is falsifying the report.
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.

