Test Driven Development

Use when implementing a feature, fixing a bug, or changing behavior in Cursor and you want a disciplined red-green-refactor workflow.

6bnbn 2d382bb 2 files · 2.3 KB Updated

File contents

Test-Driven Development

Goal

Write the failing test first, then the smallest implementation that makes it pass.

Workflow

  1. Write one failing test for one behavior.
  2. Run it and confirm it fails for the right reason.
  3. Implement the minimal code needed to pass.
  4. Re-run the test and nearby checks.
  5. Refactor while keeping everything green.
  6. 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

6bnbn/flowpilot/tree/main/兼容codex@cursor一键安装技能/cursor一键安装技能/skills/test-driven-development commit 2d382bb099

Frequently asked questions

npx skillmds@latest add 6bnbn/test-driven-development