superpowers:test-driven-development

Guide teams through Red-Green-Refactor cycles with failing tests first.

Updated Jul 10, 2023
One-click install
npx skills add https://github.com/iamtatsuki05/dotfiles --skill superpowers-test-driven-development-iamtatsuki05
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: superpowers:test-driven-development
Source: https://github.com/iamtatsuki05/dotfiles/tree/main/dotfiles/.agent/skills/superpowers/test-driven-development
Command: npx skills add https://github.com/iamtatsuki05/dotfiles --skill superpowers-test-driven-development-iamtatsuki05

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Writing tests first clarifies intended behavior and prevents regression by driving design and implementation with a failing test that must be passed before code is accepted.

Core Features & Use Cases

  • Red-Green-Refactor cycle to chain development steps from failing test to passing implementation.
  • Emphasizes writing meaningful, executable tests that document intended behavior and guardrails against regressions.
  • Use cases include feature development, bug fixes, and safe refactoring across projects, teams, and stacks.

Quick Start

Start by writing a failing test for the intended behavior, then implement the simplest code to pass, and finally refactor.

Frequently Asked Questions about superpowers:test-driven-development

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
What is the test-driven development workflow for writing new software features?▼

Test-driven development is a workflow where you write a failing unit test before implementing production code. You iterate through a strict Red-Green-Refactor cycle, ensuring minimal code is written to pass the test and prevent regressions.

How do I start using TDD for bug fixes and refactoring existing code?▼

Start TDD for bug fixes by writing a failing test that captures the intended behavior, then implement the simplest code to pass it. This test-first approach documents behavior and provides guardrails for safe refactoring across software projects.

When should I use real tests over mocks in test-driven development?▼

You should use real tests over mocks in test-driven development to accurately document intended behavior. Executable tests validate actual software quality and prevent regressions, whereas excessive mocks can bypass real integration failures.

Does test-driven development work for any software stack and team size?▼

Test-driven development applies across diverse software projects, teams, and stacks. The Red-Green-Refactor cycle requires no specific dependencies, making it universally applicable for feature development, bug fixes, and refactoring.

Why write failing tests first instead of writing tests after the code?▼

Writing failing tests first clarifies the intended behavior before implementation, driving design decisions and preventing regression. This approach ensures every piece of production code is justified by a test and maintains strict software quality.

What are the limitations of using a strict Red-Green-Refactor cycle?▼

The strict Red-Green-Refactor cycle requires disciplined adherence to writing minimal production code. Teams must avoid skipping the failing test phase, as doing so compromises the test-first mechanism that guards against regressions.