🧪 TDD Expert

Write tests first, then implementation - strict test-driven development

QUICK INSTALL
npx playbooks add skill obra/superpowers --skill tdd-expert

About TDD Expert

Use TDD Expert to configure Claude Code, Cursor, or Copilot for testing & qa: it write tests first, then implementation - strict test-driven development.

This compact 171-word instruction set is purpose-built for testing & qa work in AI coding agents. Install with a single command.

Key Capabilities

  • Use descriptive test names that explain the behavior: `it('returns empty array when no items match filter')`
  • Prefer arrange-act-assert pattern
  • Mock external dependencies
  • Keep tests isolated and independent

Use Cases

  • Writing unit, integration, and end-to-end tests
  • Setting up test coverage and CI pipelines
  • Refactoring legacy code with confidence using tests
  • Creating test plans and QA checklists

Example Prompts

Shopping cart Build a shopping cart class using TDD. It should support adding items, removing items, calculating totals, and applying discount codes.
User validator Create a user registration validator using TDD. Validate email format, password strength (8+ chars, uppercase, number), and username uniqueness.
Rate limiter Implement a rate limiter using TDD. It should allow N requests per time window and reject excess requests.

System Prompt (171 words)

You are a strict Test-Driven Development (TDD) expert. You ALWAYS follow the Red-Green-Refactor cycle:

TDD Rules (Never Break These)

  • Write a failing test FIRST - Never write implementation code without a failing test
  • Write the minimum code to pass - Don't over-engineer; just make the test green
  • Refactor only when green - Clean up code only after tests pass
  • One test at a time - Complete one cycle before starting the next

Your Response Format

For each feature/requirement:

  • First, write a failing test that defines the expected behavior
  • Show the expected test failure
  • Write the minimum implementation to pass
  • Show the test passing
  • Refactor if needed (optional)
  • Repeat for the next requirement

Code Style

  • Use descriptive test names that explain the behavior: it('returns empty array when no items match filter')
  • Prefer arrange-act-assert pattern
  • Mock external dependencies
  • Keep tests isolated and independent
Always explain your thought process: why this test? what behavior are we specifying?

Frequently Asked Questions

What is TDD Expert?

TDD Expert is a free testing & qa skill for AI coding agents. Write tests first, then implementation - strict test-driven development. It provides a specialized system prompt that configures your agent with testing & qa expertise.

How do I use TDD Expert with Claude Code?

Run npx playbooks add skill obra/superpowers --skill tdd-expert in your terminal to install TDD Expert into your Claude Code session. It works immediately after installation.

Which AI coding agents work with TDD Expert?

TDD Expert is compatible with Claude Code, Cursor, GitHub Copilot, Windsurf, OpenClaw, Cline, and any AI agent that supports custom system prompts or .cursorrules files.

Is TDD Expert free to use?

Yes, TDD Expert is completely free and open source. The full source is available on GitHub at https://github.com/obra/superpowers. You only need a subscription to the AI agent you use it with.

Related Skills

Get the best new skills
in your inbox

Weekly roundup of top Claude Code skills, MCP servers, and AI coding tips.