beta

Test-Driven Development Workflow

Skills

Skill that enforces TDD workflow: write test first, see it fail, implement, refactor.

2203/26/2026
markdown1 file
SKILL.md1004 B

name: tdd description: Enforce test-driven development workflow. Use when implementing new features or fixing bugs — write the test first, then the implementation.

TDD Workflow

Follow this cycle for every change:

1. RED — Write a failing test

  • Write the test BEFORE any implementation
  • Test should describe the desired behavior
  • Run the test — it MUST fail
  • If it passes, the test is wrong or the feature already exists

2. GREEN — Make it pass

  • Write the MINIMUM code to make the test pass
  • Don't optimize, don't refactor, don't add extras
  • Just make the test green

3. REFACTOR — Clean up

  • Now improve the code
  • Extract functions, rename variables, reduce duplication
  • Run tests after each refactor — they must stay green

Rules

  • Never write implementation before the test
  • One test at a time
  • Each test should test ONE behavior
  • Use descriptive test names: "should return 404 when user not found"
  • Don't test implementation details — test behavior