Skip to content
Skillpedia
Testing41k Β· #7027

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.md

Copy 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

Use this skill to help me: https://github.com/Yeachan-Heo/oh-my-claudecode/blob/main/skills/tdd/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute β†’

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:

  1. 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.
  2. Implement the smallest change that turns it green.
  3. 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.

repo: Yeachan-Heo/oh-my-claudecode

Popularity

GitHub stars
41k
Ranking position
#7027
License
MIT
Updated
11/2/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills