| name | tdd |
| description | Test-driven development workflow. Use when the user says /tdd or wants to build a feature test-first. Guides red-green-refactor cycle. |
Test-Driven Development
Guide the user through a red-green-refactor TDD cycle.
Workflow
-
Clarify — Ask the user what feature or fix they want to build. Understand the expected behavior.
-
Write failing test — Write a test that describes the desired behavior. The test should be specific and minimal.
-
Run test (red) — Run the test to confirm it fails:
cd fastapi-backend && python -m pytest tests/<test_file>.py -x -q
Show the failure output. This is the "red" phase.
-
Implement — Write the minimum code to make the test pass. No more, no less.
-
Run test (green) — Run the test again to confirm it passes. This is the "green" phase.
-
Refactor — If the implementation can be improved, refactor while keeping the test green.
-
Full suite — Run the full test suite to ensure nothing else broke:
cd fastapi-backend && python -m pytest tests/ -x -q
-
Repeat — Ask if the user wants to add another test case or move on.