| name | red-green-tdd |
| description | Implement a feature or bug fix using red/green test-driven development — write failing tests first, confirm they fail, then implement until green. Use for any new behavior or bug fix. |
Red/green TDD
Test-first development, strictly ordered. The argument to this skill is the
behavior to implement or the bug to fix.
Procedure
- Write the tests first. Express the desired behavior (or the bug's
failing case) as automated tests. Cover the obvious edge cases.
- RED — confirm the tests fail. Run the suite (
uv run pytest) and watch
the new tests fail. This step is mandatory: a test that already passes
exercises nothing and proves nothing about your implementation. If a new test
passes immediately, rewrite it until it genuinely fails.
- Implement. Write the minimal code that makes the tests pass.
- GREEN — confirm the whole suite passes. Not just the new tests; the
change must not break existing behavior. For long output, dispatch the
test-runner subagent.
- Refactor if needed, keeping the suite green.
Why
- Protects against the two classic agent failures: code that doesn't work, and
code that is never actually used.
- Leaves behind a permanent regression suite — as the project grows, this is
what keeps existing features working.