test-driven-development
Skill19 starsChanged 8 months agoMITView on GitHub
Rigorous TDD methodology enforcing RED-GREEN-REFACTOR discipline. Use when implementing features or fixing bugs during the implement phase. Tests must be written before production code - no exceptions.
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
- REPOZY/superpowers-optimizedtheir own version, first seen Nov 8, 2026
- lingyired/status-triotheir 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 repository16 other files it gives its agents.
- AGENTS.mdAGENTS.md
- brainstormingSkill
- documenting-decisionsSkill
- finishing-workSkill
- git-worktreesSkill
- implementing-plansSkill
- parallel-agentsSkill
- receiving-code-reviewSkill
- researching-codebaseSkill
- research-plan-implementSkill
- reviewing-codeSkill
- security-reviewSkill
- synthesizing-researchSkill
- systematic-debuggingSkill
- verification-before-completionSkill
- writing-plansSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
23 rules. 0 are common, 23 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 178 edited versions we read keep these.
23
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 11
Write tests first, then implementation.
- Distinctive: line 23
If you write code before the test, you must delete it and start over.
- Distinctive: line 30
Write ONE minimal test that demonstrates the required behavior:
- Distinctive: line 32
Test the public interface, not internals
- Distinctive: line 33
Never mock what you can use for real
- Distinctive: line 35
Run the test - it MUST fail
- Distinctive: line 48
If the test passes immediately, you've written it wrong or the feature already exists.
- Distinctive: line 52
Write the SIMPLEST code that makes the test pass:
- Distinctive: line 129
When executing plan steps that involve code:
- Distinctive: line 131
Before coding: Write failing test for the behavior
- Distinctive: line 132
Verify RED: Test fails for the right reason
- Distinctive: line 134
Verify GREEN: Test passes, no regressions
- Distinctive: line 136
Mark complete: Only after tests pass
- Distinctive: line 138
If a plan step doesn't mention tests, add them anyway.
- Distinctive: line 147
Don't depend on external state
- Distinctive: line 152
Test private methods directly
- Distinctive: line 173
Wrong: Write feature, then write tests to cover it
- Distinctive: line 174
Right: Write test, watch it fail, then write feature
- Distinctive: line 184
Right: Run test, observe failure, understand why
- Distinctive: line 189
Right: Never mock what you can use for real
- Distinctive: line 193
Wrong: Test that internal method X calls internal method Y
- Distinctive: line 194
Right: Test that public interface produces correct results
- Distinctive: line 198
Before marking a step complete:
“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 tests first, then implementation. No production code without a failing test.
Purpose
TDD ensures code correctness through disciplined test-first development. Tests written after implementation prove nothing - they pass immediately, providing no evidence the code works correctly. This skill enforces the RED-GREEN-REFACTOR cycle as a non-negotiable practice.
The Iron Law
NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST.
If you write code before the test, you must delete it and start over. The test drives the implementation, not the other way around.
The Cycle
RED: Write a Failing Test
Write ONE minimal test that demonstrates the required behavior:
- Test the public interface, not internals
- Never mock what you can use for real
- Name the test to describe the behavior
- Run the test - it MUST fail
Mandatory verification:
Run the test. Confirm it fails for the RIGHT reason:
- Missing function/method (expected)
- Wrong return value (expected)
- NOT: Syntax error
- NOT: Import error
- NOT: Test framework misconfigurationIf the test passes immediately, you've written it wrong or the feature already exists. Investigate before proceeding.
GREEN: Write Minimal Code
Write the SIMPLEST code that makes the test pass:
- No extra features
- No premature optimization
- No "while I'm here" additions
- Just enough to satisfy the test
Mandatory verification:
Run the test. Confirm:
- The new test passes
- All other tests still pass
- No new warnings or errorsREFACTOR: Improve Without Breaking
Improve code quality while keeping tests green:
- Remove duplication
- Improve names
- Extract helpers
- Simplify logic
After each change:
Run all tests. They must still pass.
If any test fails, revert the refactor.Cycle Example
Requirement: Function that validates email addresses
RED:
Write test: expect(isValidEmail("user@example.com")).toBe(true)
Run test: FAIL - isValidEmail is not defined
Correct failure reason: function doesn't exist yet
GREEN:
Write: function isValidEmail(email) { return true; }
Run test: PASS
All tests pass
RED:
Write test: expect(isValidEmail("invalid")).toBe(false)
Run test: FAIL - Expected false, got true
Correct failure reason: no validation logic yet
GREEN:
Write: function isValidEmail(email) { return email.includes("@"); }
Run test: PASS
All tests pass
REFACTOR:
Extract regex pattern to constant
Run tests: PASS
Continue improving...Common Rationalizations (Reject All)
| Rationalization | Reality |
| "I'll write tests after" | Tests written after pass immediately, proving nothing |
| "This is too simple to test" | Simple things become complex. Test it. |
| "I know this works" | Prove it with a test |
| "Testing slows me down" | Debugging untested code takes longer |
| "I'll just try it manually" | Manual testing isn't repeatable or systematic |
| "The code is obvious" | Make it obviously correct with a test |
| "I already wrote the code" | Delete it. Start with the test. |
Integration with Implement Phase
When executing plan steps that involve code:
- Before coding: Write failing test for the behavior
- Verify RED: Test fails for the right reason
- Write code: Minimal implementation
- Verify GREEN: Test passes, no regressions
- Refactor: Improve while green
- Mark complete: Only after tests pass
If a plan step doesn't mention tests, add them anyway. TDD is not optional.
Test Quality Guidelines
Good Tests
- Describe behavior, not implementation
- Fail for one reason only
- Run fast (milliseconds)
- Don't depend on external state
- Read like specifications
Bad Tests
- Test private methods directly
- Require specific execution order
- Mock what you can use for real (indicates bad design)
- Pass without verifying anything meaningful
- Break when refactoring internals
Edge Cases and Boundaries
Test these explicitly:
- Empty inputs
- Null/undefined values
- Boundary values (0, -1, MAX_INT)
- Invalid inputs
- Error conditions
- Concurrent access (if applicable)
Anti-Patterns
Writing Code First
Wrong: Write feature, then write tests to cover it Right: Write test, watch it fail, then write feature
Testing After the Fact
Wrong: "I'll add tests in a follow-up PR" Right: Tests are part of the implementation, not separate
Skipping RED Verification
Wrong: Assume test will fail, write code immediately Right: Run test, observe failure, understand why
Over-Mocking
Wrong: Mock every dependency to "isolate" the unit Right: Never mock what you can use for real
Testing Implementation Details
Wrong: Test that internal method X calls internal method Y Right: Test that public interface produces correct results
Verification Checklist
Before marking a step complete:
- Test was written BEFORE production code
- Test failed for the correct reason (not syntax/import errors)
- Implementation is minimal (no extra features)
- All tests pass (new and existing)
- Code was refactored while green
- No untested production code was added
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.

