Skip to content
/tddStable

Test-driven development workflow. Writes tests first, then implements minimal code to pass.

TestingDevelopmentΒ· 1 min read

Quick import: Download the .md file and save it to .claude/commands/ (Claude Code), .cursorrules (Cursor), or paste as a system prompt in ChatGPT, Gemini, or any LLM API.

#What it does

The /tdd skill follows strict test-driven development: write failing tests first, then implement the minimal code to make them pass, then refactor.

#How to use

bash
/tdd Implement email validation utility

#Workflow

  1. Red β€” Write failing tests that describe the expected behavior
  2. Green β€” Implement the minimal code to pass all tests
  3. Refactor β€” Clean up the implementation without changing behavior
  4. Verify β€” Run the full test suite to ensure nothing broke

#What you get

  • Tests that document behavior, not implementation details
  • Minimal, focused implementations
  • High confidence that the code works as specified
  • Natural documentation through test names

#Example

bash
> /tdd Create a function that validates email addresses
 
# Step 1: Writing tests...
βœ“ should accept valid emails ([email protected])
βœ“ should reject missing @ symbol
βœ“ should reject missing domain
βœ“ should accept subdomains ([email protected])
βœ— All 4 tests failing (expected)
 
# Step 2: Implementing...
βœ“ All 4 tests passing
 
# Step 3: Refactoring...
βœ“ Extracted regex to constant, added JSDoc
βœ“ All tests still passing
Orel OhayonΒ·
View all skills