TDD Skill
Announce at start: "Using TDD: writing test first for [behavior]."
When to use this skill
- •new features that can be unit tested
- •bug fixes (always add a regression test if practical)
- •refactors (protect behavior with tests first)
Research
Before writing tests, do research in parallel (waitForPreviousTools: false):
- •
search_webfor the project's testing framework best practices and latest patterns (scope tostack.mdversions). - •
search_webfor assertion styles and testing utilities available in the framework.
Rules
- •Prefer red -> green -> refactor.
- •If tests are hard, still add verification: minimal repro script, integration test, or clear manual steps.
- •Keep tests focused: one behavior per test where possible.
- •Name tests by behavior, not implementation details.
Process
- •Define the behavior change (what should be true after).
- •Write/adjust a test to capture it (make it fail first if possible).
- •Implement the minimal change to pass.
- •Refactor if needed (keep passing).
- •Run the relevant test suite + any linters in parallel where they are independent.
Output requirements
When you change code, include:
- •what tests you added/changed
- •how to run them
- •what they prove
Bite-sized granularity
Each step should be one action (2-5 minutes):
- •Write the failing test — step
- •Run it to confirm it fails — step
- •Implement the minimal code to make it pass — step
- •Run tests to confirm they pass — step
- •Commit — step
Don't combine these. Each step is independently verifiable.