tdd
What it does
This skill guides an agent through building code by writing a test first, then the smallest code that passes it. It is for developers who want each change proven by a test that was written before the code.
When to use it
- βWhen you want new behavior built test-first, one small step at a time.
- βWhen you want a bug fixed by first writing a test that reproduces it.
- βWhen you want tests written from a source of truth, not from the code itself.
Skill link
https://github.com/Yeachan-Heo/oh-my-claudecode/blob/main/skills/tdd/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agentβs skills folder.
Example of what to ask your AI
βBuild the discount rule test-first, one small step at a time, using the examples in our pricing spec.β
5 new skills a week. 1 minute to read.
How it works
The agent writes the next test at an agreed point, confirms it fails for the expected reason, then writes the smallest change that makes it pass. It repeats this loop and saves refactoring for a later review step.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
TDD
Red-green in small steps, at seams that were agreed in advance. In a launch run the seam list is C2's approved output; outside launch, agree the seams with the user before the first test exists β a seam nobody approved gets no tests.
The loop
One test β one implementation β repeat:
- Write the next test at a seam. Run it. Watch it fail for the reason you expect β a test that cannot fail is not a test.
- Implement the smallest change that turns it green.
- Repeat. Each test is a tracer bullet: a narrow but complete path through the behavior, not a layer finished in isolation.
Rules
- Expected values come from an independent source of truth β a spec line, a worked example, a documented output. Never from the implementation under test: a test that asserts what the code happens to do is a mirror, not a check.
- Substitute at the seam's declared boundary class only β in-process, locally substitutable, owned-remote port, or true-external, the class C2 records for each seam. No substitutes inside the boundary the test is exercising.
- Refactoring is not part of the loop. It belongs to the review stage; the repair worker owns it. Do not refactor mid-red-green.
- A bug fix starts with the failing test that reproduces it β reproduction before theory, the debugger's rule.
- When proposing a seam, say in one line what it catches and what it lets through β a seam choice nobody can price is a guess, not a decision.
When no seam fits
If the behavior cannot be tested at any approved seam, stop and say so: report the missing seam as a finding (it feeds architecture-survey and refit) rather than inventing a seam or testing through internals.
Output
- The seam list used, with boundary classes and each seam's catch/miss line
- Red/green evidence β the failing run and the passing run
- Any seam-absence findings
FAQ
Do the tests copy what the code does?
No. Expected values come from an independent source, such as a spec or worked example, not from the code under test.
Where should the tests go?
Only at points that were agreed in advance, so no test is written for a point nobody approved.
When is refactoring done?
Not inside the red-green loop. It belongs to a later review stage.
Details
Original description by the author
Test-first at pre-agreed seams β one test, one implementation, tracer-bullet red/green; independent expected values; substitutions only at the seam's boundary class; launch Phase 4 reference.
Popularity
- GitHub stars
- 41k
- Ranking position
- #7027
- License
- MIT
- Updated
- 11/2/2026
Comments
- β¦
More skills from this repository
agent-doc-discipline
41kTeaches your agent to write instructions that other AI agents can follow on their own, with rules that can be checked and a clear reason behind each.
ai-slop-cleaner
41kHelps your agent tidy up AI-written code that works but is bloated or repetitive, removing extra code without changing what it does.
architecture-survey
41kHelps your agent review a codebase's structure and list the parts that are getting hard to change, with evidence, without changing anything itself.
ask-navigator
41kHelps your agent turn a fuzzy project into a map of clear decision questions, then work through them one at a time until the path is clear.
Similar skills
test-driven-development
311kTeaches your agent to write a failing test first, watch it fail, then write the smallest code that passes, before building any feature or fix.
verification-before-completion
311kTeaches your agent to run real checks and read their output before claiming that a task, fix, or build is complete or passing.
migrate-to-shoehorn
310kReplaces risky type casts in your test files with the shoehorn library, so tests can use partial data and still pass type checks.