test-driven-development
Skill0 starsChanged 22 days agoMITView on GitHub
Use when implementing any feature or bugfix, before writing implementation code. Enforces RED-GREEN-REFACTOR with mandatory failure verification, tests at agreed seams, and the testing anti-pattern laws. Not for hunting a bug's root cause, that is systematic-debugging.
190 other projects use a version of this, 109 of them edited.
Adopted by
Most recently taken up by
- DemonDamon/AgenticXedited, first seen Nov 9, 2026
- chrysogonus/power-agentsedited, first seen Nov 8, 2026
- ishandutta2007/Awesome-Agent-Skillstheir own version, first seen Nov 8, 2026
- roundpilot/superpowers-antigravityedited, first seen Nov 8, 2026
- REPOZY/superpowers-optimizedtheir own version, first seen Nov 8, 2026
- lingyired/status-trioedited, first seen Nov 8, 2026
Used with
Projects with it also use chinese-code-review, chinese-commit-conventions 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.
Leodorareluctant259Skillchinese-code-review
中文代码审查规范——在保持专业严谨的同时,用符合国内团队文化的方式给出有效反馈
Also in 8 projects that use this
Leodorareluctant259Skillchinese-commit-conventions
中文 Git 提交规范 — 适配国内团队的 commit message 规范和 changelog 自动化
Also in 8 projects that use this
obraSkilldiagnosing-superpowers
Use when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.
Also in 19 projects that use this
LLl0k0laDSkillusing-agent-skills
Use when starting a session or when you need to discover which skill applies to the current task. This is the meta-skill that governs how all other skills are discovered and invoked.
Also in 39 projects that use this
LLl0k0laDSkillgit-workflow-and-versioning
Use when making any code change. Use when committing, branching, resolving conflicts, or when you need to organize work across multiple parallel streams.
Also in 47 projects that use this
MrCipherSmithSkillconstraint-driven-development
Use when a project needs a persistent, measurable quality bar — starting a project without documented standards, 'set up constraints', or when coverage/perf/a11y thresholds get re-debated per-PR. Produces CONSTRAINTS.md with enforceable numbers, ratchets, and a guard against silent weakening. NOT for throwaway prototypes or a one-off CI setup.
Also in 15 projects that use this
- +3 more from Leodorareluctant259
- +3 more from LLl0k0laD
Other versions190 projects use a version of this.
Word for word · 0
None found.
Edited · 109
- obra/superpowers★ 314k12% same
- NousResearch/hermes-agent★ 262k11% same
- openai/plugins★ 7.8k10% same
- farm-fe/farm★ 5.6k11% same
- lingyired/status-trio★ 1.8k12% same
- pcvelz/superpowers★ 1.3k12% same
- math-inc/OpenGauss★ 1.3k13% same
- DemonDamon/AgenticX★ 1k11% same
- coco-research/coco★ 79711% same
- bolshakov/stoplight★ 62911% same
99 more not listed
Wrote their own version · 81
- addyosmani/agent-skills★ 114ksame name
- cloudflare/computer★ 9.9ksame name
- jnMetaCode/superpowers-zh★ 8.4ksame name
- microsoft/FluidFramework★ 4.9ksame name
- mikeyobrien/ralph-orchestrator★ 3.2ksame name
- crbnos/carbon★ 2.8ksame name
- ollaya-dev/ollaya★ 1.4ksame name
- GanyuanRan/Aegis★ 1.4ksame name
- taichuy/1flowbase★ 292same name
- KbWen/agentic-os★ 229same name
71 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 repository25 other files it gives its agents.
- AGENTS.mdAGENTS.md
- brainstorming-designSkill
- branch-lifecycleSkill
- bug-feedback-loopSkill
- codebase-designSkill
- code-review-disciplineSkill
- domain-modelingSkill
- failure-classesSkill
- git-safetySkill
- grillingSkill
- handoffSkill
- ops-safetySkill
- prototypeSkill
- quality-floorSkill
- researchSkill
- subagent-driven-devSkill
- systematic-debuggingSkill
- terse-modeSkill
- ui-designSkill
- using-skillsSkill
- verification-before-completionSkill
- vetting-third-partySkill
- writing-plansSkill
- writing-skillsSkill
- zoom-outSkill
The file
We split this skill into the rules it gives an agent
7 rules. 1 is common, 6 are distinctive, and 0 are very specific to this project.
1
Common
Most of the 178 edited versions we read keep these.
6
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
- Common: line 16
Core principle: If you didn't watch the test fail, you don't know if it tests the right thing.
- Distinctive: line 20
Always: new features, bug fixes, refactoring, behavior changes — any code with logic (business rules, permission checks, calculations, …
- Distinctive: line 35
GREEN — write the simplest code that passes: No extra options, no features beyond the test.
- Distinctive: line 37
Verify GREEN — run it, watch it pass. MANDATORY: All other tests still green, output pristine (no warnings).
- Distinctive: line 39
REFACTOR — only after green: Remove duplication, improve names, extract helpers.
- Distinctive: line 45
Never fix a bug without a failing test reproducing it first.
- Distinctive: line 66
NEVER add test-only methods to production classes: Test needs a hook? Fix the design or keep helpers in test code.
“Common” is measured: kept by at least 6 in 10 of the 178 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-Driven Development
The Iron Law
NO PRODUCTION CODE WITHOUT A FAILING TEST FIRSTWrote code before the test? Delete it. Start over. Don't keep it as "reference", don't "adapt" it while writing tests. Delete means delete.
Core principle: If you didn't watch the test fail, you don't know if it tests the right thing.
When
Always: new features, bug fixes, refactoring, behavior changes — any code with logic (business rules, permission checks, calculations, parsing, data transforms).
Exceptions (no need to ask; name the exception in the report): config, docs, purely presentational UI, generated code, throwaway prototypes, one-off scripts. Infrastructure changes are verified by real behaviour (ops-safety), not unit tests.
Not "the whole test suite first". A request like "write full-coverage unit tests before generating any logic" is met by this skill's vertical slices, not by a test-suite-up-front pass: all-tests-first verifies imagined behaviour (law 5 below). What the human can approve up front is the list of seams and cases, one line each — not the test bodies.
Coverage ratchet. Where the project measures coverage, new lines stay ≥80%; never lower the threshold to make a change pass (quality-floor).
Small steps. One cycle = one test + the code that turns it green + one commit, at most 50 added logic lines (tests, docs, config, generated code, lockfiles, deletions and renames excluded). Measure with quality-floor's scripts/diff_budget.py. Over budget → split; can't split → reason in the commit message.
Red-Green-Refactor
RED — write one minimal failing test. One behavior, clear name, real code (mocks only if unavoidable). Demonstrates the desired API.
Verify RED — run it, watch it fail. MANDATORY. Confirm it fails (not errors) for the expected reason: feature missing, not a typo. Test passes immediately? You're testing existing behavior — fix the test.
GREEN — write the simplest code that passes. No extra options, no features beyond the test. YAGNI.
Verify GREEN — run it, watch it pass. MANDATORY. All other tests still green, output pristine (no warnings). Test fails? Fix the code, not the test.
REFACTOR — only after green. Remove duplication, improve names, extract helpers. No new behavior. Stay green.
Repeat with the next failing test.
Bug Fixes
Never fix a bug without a failing test reproducing it first. The test proves the fix and prevents regression. Red-green verify regression tests: pass → revert fix → MUST fail → restore → pass.
Rationalizations (all false)
| Excuse | Reality |
| "Too simple to test" | Simple code breaks. Test takes 30 seconds. |
| "I'll test after" | Tests passing immediately prove nothing. |
| "Tests after achieve same goals" | Tests-after answer "what does this do?"; tests-first "what should this do?" — after-tests are biased by the code you wrote, verifying remembered cases, not discovered ones. |
| "Already manually tested" | Ad-hoc ≠ systematic. No record, can't re-run. |
| "Deleting X hours is wasteful" | Sunk cost fallacy. Unverified code is debt. |
| "TDD will slow me down" | TDD is faster than debugging after. |
| "Test hard = skip it" | Hard to test = hard to use. Listen to the test; simplify the design. |
Seams — where tests go
A seam is the public boundary you test at. Tests live at seams, never against internals — code can change entirely; tests shouldn't. A good test reads like a specification ("user can checkout with valid cart") and survives refactors. Test only at pre-agreed seams: before writing tests, ask "what's the public interface, and which seams should we test?" — confirm with the user so effort lands on critical paths, not every edge case. Give each proposed seam a one-line note on what it catches and what it misses — the user is choosing coverage, not nodding at a list. Read GLOSSARY.md (or CONTEXT.md) (if it exists) so test names match the project's domain language. When the shape of that interface is itself in question — how deep the module is, where the seam belongs, what the interface should expose — consult codebase-design for the vocabulary (module, interface, depth, seam, adapter, leverage, locality). It's a reference to look things up in, not a session to run.
Testing Anti-Patterns — the five laws
- NEVER test mock behavior. Assert on real behavior, not that a mock rendered/was called. Ask: "Am I testing the component or the mock's existence?"
- NEVER add test-only methods to production classes. Test needs a hook? Fix the design or keep helpers in test code.
- NEVER mock without understanding the dependency. Mocks are for isolation, not the thing being tested.
- NEVER write tautological tests — assertions that recompute the expected value the way the code does (
expect(add(a,b)).toBe(a+b)) pass by construction. Expected values come from an independent source: a known-good literal, a worked example, the spec. - NEVER slice horizontally — all tests first, then all implementation, verifies imagined behavior. Work in vertical slices: one test → one implementation → repeat, each test a tracer bullet informed by the last cycle.
Name the Break — gate before every test body
Before writing a test, name the production change that would make it fail — and is that change a bug or a decision? Can't name one → redesign around observable behavior.
- No change detectors. If only intentional decisions can fail a test (a constant's value, exact message wording, private structure), it fires on redesign and sleeps through bugs. Test the behavior that depends on the decision: not
expect(MAX_RETRIES).toBe(5)but "a failing call retries 5 times, the 6th never happens." - Behavior, not text. Asserting a script/config contains an exact line proves only the source is the source. Run it against controlled inputs; assert outputs, side effects, exit codes.
- Your code, not the framework. Test the contract your code makes at its boundaries (route registered, query emitted, payload produced) — upstream mechanics are the framework maintainers' tests. Upstream behavior genuinely surprised you → one narrow characterization test naming the assumption. Constructors/getters/trivial forwarding earn tests only when they validate, normalize, default, derive, or cause side effects.
Checklist before claiming done
- Every new function has a test that I watched fail for the right reason
- Minimal code to pass each test; all tests pass; output pristine
- Tests use real code; edge cases and errors covered
Can't check all boxes → you skipped TDD → start over.
"Other tests" means the project's suite, not just your file. A scope statement in your task bounds the deliverable, not your verification. Any failure that run shows — including one you did not cause — goes in your report by name; a red test you watched scroll past and did not mention is a report falsified by omission.
When Stuck
| Problem | Solution |
| Don't know how to test | Write the wished-for API; write the assertion first. |
| Test too complicated | Design too complicated. Simplify the interface. |
| Must mock everything | Code too coupled. Dependency injection. |
Distilled from obra/superpowers (MIT © Jesse Vincent / Prime Radiant), v7.0.0 @ bb92a77 (2026-10-12); seams + tautological/horizontal anti-patterns from mattpocock/skills (MIT © Matt Pocock) @ f3fc563 (2026-10-08).
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.

