| name | test-driven-development |
| description | Use when implementing a feature, fixing a bug, or changing behavior in Cursor and you want a disciplined red-green-refactor workflow. |
Test-Driven Development
Goal
Write the failing test first, then the smallest implementation that makes it pass.
Workflow
- Write one failing test for one behavior.
- Run it and confirm it fails for the right reason.
- Implement the minimal code needed to pass.
- Re-run the test and nearby checks.
- Refactor while keeping everything green.
- Repeat for the next behavior.
Rules
- No production code before a failing test unless the user explicitly asks to skip TDD.
- Keep tests focused on behavior, not incidental implementation details.
- Prefer real code paths over heavy mocking.
- If the test passes immediately, you are probably testing existing behavior or the wrong thing.
- Use
verification-before-completion before claiming the bug or feature is finished.
Good Test Qualities
- one behavior
- clear name
- obvious expected outcome
- minimal setup
- catches the intended regression