test-driven-development
Skill146 starsChanged 7 months agoMITView on GitHub
MUST USE for any behavior change: write failing tests before production code. No exceptions. Triggers on: "TDD", "write tests first", any implementation task, bug fix needing regression tests, behavior changes during execution. Routed by using-superpowers, or invoke directly via /test-driven-development.
190 other projects use a version of this.
Adopted by
Most recently taken up by
- DemonDamon/AgenticXtheir own version, first seen Nov 9, 2026
- chrysogonus/power-agentstheir own version, first seen Nov 8, 2026
- ishandutta2007/Awesome-Agent-Skillstheir own version, first seen Nov 8, 2026
- roundpilot/superpowers-antigravitytheir own version, first seen Nov 8, 2026
- lingyired/status-triotheir own version, first seen Nov 8, 2026
- bepaldes/heimdall-agenttheir own version, 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 · 0
None found.
Wrote their own version · 190
- obra/superpowers★ 314ksame name
- NousResearch/hermes-agent★ 262ksame name
- addyosmani/agent-skills★ 114ksame name
- cloudflare/computer★ 9.9ksame name
- jnMetaCode/superpowers-zh★ 8.4ksame name
- openai/plugins★ 7.8ksame name
- farm-fe/farm★ 5.6ksame name
- microsoft/FluidFramework★ 4.9ksame name
- mikeyobrien/ralph-orchestrator★ 3.2ksame name
- crbnos/carbon★ 2.8ksame name
180 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 repository23 other files it gives its agents.
- brainstormingSkill
- claude-md-creatorSkill
- context-managementSkill
- deliberationSkill
- dependency-managementSkill
- dispatching-parallel-agentsSkill
- error-recoverySkill
- executing-plansSkill
- finishing-a-development-branchSkill
- frontend-designSkill
- performance-investigationSkill
- premise-checkSkill
- receiving-code-reviewSkill
- refactoringSkill
- requesting-code-reviewSkill
- self-consistency-reasonerSkill
- subagent-driven-developmentSkill
- systematic-debuggingSkill
- token-efficiencySkill
- using-git-worktreesSkill
- using-superpowersSkill
- verification-before-completionSkill
- writing-plansSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
22 rules. 0 are common, 16 are distinctive, and 6 are very specific to this project.
0
Common
Most of the 178 edited versions we read keep these.
16
Distinctive
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 13
Write failing tests first.
- Distinctive: line 19
If code was written first, delete it and restart from a test.
- Distinctive: line 25
RED: Write one small failing test for one behavior.
- Distinctive: line 26
VERIFY RED: Run the test. Confirm it fails for the expected reason (not a syntax error or import issue).
- Distinctive: line 27
GREEN: Write the minimum production code to make the test pass.
- Very specific: line 28
VERIFY GREEN: Run the target test plus the suite for the module you changed.
- Distinctive: line 37
Before writing the first test, verify the project has a test runner:
- Very specific: line 39
Check for test config: jest.config.*, vitest.config.*, pytest.ini, pyproject.toml [tool.pytest], go.mod, Cargo.toml, .rspec, phpunit.xml
- Very specific: line 40
Check for test script: npm test, yarn test, make test, or equivalent
- Distinctive: line 41
If no test infrastructure exists:
- Distinctive: line 42
Ask the user: "No test runner detected.
- Distinctive: line 43
If yes: install and configure the minimal test runner.
- Distinctive: line 44
If no: note that TDD requires a test runner and proceed only if the user provides an alternative.
- Distinctive: line 46
Do not skip this step — a "failing test" that fails because the runner doesn't exist teaches nothing.
- Distinctive: line 81
Prefer real behavior checks over mock-only assertions.
- Distinctive: line 105
Integration tests: Test real interactions between components (database, API, filesystem).
- Distinctive: line 107
Property-based tests: When behavior has invariants (e.g., "sort output is always ordered"), generate random inputs to find edge cases.
- Distinctive: line 108
Performance tests: When latency or throughput matters, add benchmarks with clear thresholds.
- Distinctive: line 109
Flaky test diagnosis: If a test passes/fails inconsistently, treat it as a bug — find the race condition, timing dependency, or shared …
- Very specific: line 116
Use systematic-debugging to find root cause before writing the fix test.
- Very specific: line 117
Use verification-before-completion before success claims.
- Very specific: line 118
Read testing-anti-patterns.md when introducing heavy mocking.
“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
Write failing tests first. Then write minimal code to pass.
Iron Law
No production code before a failing test proves the behavior is missing.
If code was written first, delete it and restart from a test. No exceptions.
This is the hardest rule to follow and the most important. Every rationalization to skip it leads to untested behavior that breaks later.
Cycle
- RED: Write one small failing test for one behavior.
- VERIFY RED: Run the test. Confirm it fails for the expected reason (not a syntax error or import issue).
- GREEN: Write the minimum production code to make the test pass. Nothing more.
VERIFY GREEN: Run the target test plus the suite for the module you changed. Confirm pass. Do not run the whole repo suite on every cycle — that belongs at the end of the task, scoped per
verification-before-completion.Report every failure the run shows, including ones you did not cause. Scope bounds which command you run; it never bounds what you report. If the module suite goes red on a test your change did not touch, name that test in your report as a pre-existing failure. A red test you watched scroll past and did not mention is a report falsified by omission — and the next person to run the suite inherits it as your bug.
- REFACTOR: Improve structure without changing behavior. Tests must stay green.
Repeat per behavior. Never skip VERIFY steps.
Test Infrastructure Check
Before writing the first test, verify the project has a test runner:
- Check for test config:
jest.config.*,vitest.config.*,pytest.ini,pyproject.toml [tool.pytest],go.mod,Cargo.toml,.rspec,phpunit.xml - Check for test script:
npm test,yarn test,make test, or equivalent - If no test infrastructure exists:
- Ask the user: "No test runner detected. Should I set up [recommended runner for this language/framework]?"
- If yes: install and configure the minimal test runner. Write one smoke test to confirm it works.
- If no: note that TDD requires a test runner and proceed only if the user provides an alternative.
Do not skip this step — a "failing test" that fails because the runner doesn't exist teaches nothing.
Right vs Wrong
Wrong — code first:
1. Write the handler function
2. Write tests to verify it works
3. All tests pass on first run ← this means the tests prove nothingRight — test first:
1. Write test: POST /users returns 201 with valid body
2. Run test → FAILS (handler doesn't exist yet) ← good
3. Write minimal handler to return 201
4. Run test → PASSES ← test proved the behavior was missing, now it works
5. Refactor handler if needed, tests stay greenRationalization Table — Do Not Skip Tests
| Temptation | Why it fails |
| "This is too simple to test" | Simple code has the longest lifespan. It will be changed by someone who doesn't know the intent. |
| "I'll write tests after" | After never comes. And tests written after pass immediately, proving nothing. |
| "I'm just refactoring, no new behavior" | If behavior doesn't change, existing tests must stay green. Run them. |
| "Tests slow me down" | Tests save you from debugging sessions that take 10x longer. |
| "The type system catches this" | Types catch shape errors, not logic errors. Test the logic. |
| "I need to see the shape of the code first" | Spike in a scratch file. Then delete it and TDD the real implementation. |
Test Quality Rules
- One behavior per test.
- Clear behavior-oriented test names (e.g.,
test_expired_token_returns_401). - Prefer real behavior checks over mock-only assertions.
- Cover edge and error paths for changed behavior.
- A test that has never been seen failing is not a test — it's a wish.
Anti-Patterns
- Writing tests after implementation.
- Adding multiple features before rerunning tests.
- Accepting passing tests that never failed first.
- Fixing bugs without a regression test.
- Testing mock behavior instead of real behavior.
Completion Checklist
- Every changed behavior has a test.
- Each new test was observed failing before implementation.
- Changed tests pass.
- The suite covering the changed module passes (scope per
verification-before-completion). - Any failure in that run which this change did not cause is named explicitly in the report as pre-existing — never silently passed over.
Advanced Test Strategy
For complex, high-risk, or hard-to-test behavior, go beyond basic unit tests while still following RED-GREEN-REFACTOR:
- Integration tests: Test real interactions between components (database, API, filesystem). Prefer real dependencies over mocks.
- E2E tests: For user-facing flows, verify the full path from input to output.
- Property-based tests: When behavior has invariants (e.g., "sort output is always ordered"), generate random inputs to find edge cases.
- Performance tests: When latency or throughput matters, add benchmarks with clear thresholds.
- Flaky test diagnosis: If a test passes/fails inconsistently, treat it as a bug — find the race condition, timing dependency, or shared state causing it.
- Coverage strategy: Focus coverage on behavior boundaries and error paths, not line counts. 80% meaningful coverage beats 100% trivial coverage.
Choose appropriate frameworks and libraries for the current stack. Write tests that are fast, deterministic, and maintainable.
Related
- Use
systematic-debuggingto find root cause before writing the fix test. - Use
verification-before-completionbefore success claims. - Read
testing-anti-patterns.mdwhen introducing heavy mocking.
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.

