test-driven-development

Guide software teams through the RED-GREEN-REFACTOR cycle with failing tests first.

8|1|Updated Mar 29, 2026
One-click install
npx skills add https://github.com/dxc-danny/superpowers-cn --skill test-driven-development-dxc-danny
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/dxc-danny/superpowers-cn/tree/main/skills/test-driven-development
Command: npx skills add https://github.com/dxc-danny/superpowers-cn --skill test-driven-development-dxc-danny

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Test-driven development (TDD) enforces writing failing tests before production code, ensuring the implementation aligns with intent and preventing regressions.

Core Features & Use Cases

  • Red-Green-Refactor cycle guiding feature work, bug fixes, and refactors.
  • Clear guardrails that production code is only written after tests exist.
  • Improved safety and maintainability through incremental, test-first development.

Quick Start

Write a failing test first for the next feature, then implement only enough code to make it pass.

Frequently Asked Questions about test-driven-development

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

FAQPage Schema
How does test-driven development improve software quality?

Test-driven development improves software quality by enforcing a test-first cycle where failing tests are written before production code, ensuring implementation aligns with intent and preventing regressions.

What is the red-green-refactor cycle in TDD?

The red-green-refactor cycle in TDD guides development by first writing a failing test (red), implementing minimal code to pass it (green), and then refactoring safely to improve maintainability.

How do I start writing tests before production code for a new feature?

To start test-first development, write a failing test defining the next feature's expected behavior, then implement only enough production code to make that specific test pass.

Can I use test-driven development for bug fixes and refactoring?

Yes, test-driven development applies to bug fixes and refactoring by guiding teams through incremental red-green-refactor cycles, ensuring changes are safely verified by failing tests before implementation.

When should I not use the test-first development approach?

You should avoid test-first development when exploring rapid prototypes where intent is unclear, as it requires defined success criteria to write failing tests before any production code exists.

Why write minimal production code to pass tests in TDD?

Writing minimal production code in TDD ensures the implementation strictly aligns with test intent, prevents over-engineering, and maintains safety through incremental, repeatable development cycles.