test-driven-development

Enforces a test-first Red-Green-Refactor workflow for automated test and CI environments.

Updated Mar 16, 2026
One-click install
npx skills add https://github.com/chuangkevin/project-bridge --skill test-driven-development-chuangkevin
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/chuangkevin/project-bridge/tree/main/skill/superpowers/test-driven-development
Command: npx skills add https://github.com/chuangkevin/project-bridge --skill test-driven-development-chuangkevin

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Prevents untested or poorly specified production code by forcing behavior to be defined and verified before implementation, reducing regressions and design drift.

Core Features & Use Cases

  • Test-first workflow: Defines failing tests before writing implementation so the test proves the required behavior.
  • Red-Green-Refactor loop: Guides developers to watch failing tests, implement minimal changes to pass, then safely refactor.
  • Use Case: Add a new API endpoint by first writing an integration test that fails, implement the endpoint until the test passes, then refactor without breaking behavior.

Quick Start

Write a failing test that expresses the desired behavior, run the test to confirm it fails, implement the minimal code to make it pass, and then refactor while keeping tests green.

Frequently Asked Questions about test-driven-development

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

FAQPage Schema
How do I start writing tests first to prevent untested production code?

To start test-driven development, write a failing test that expresses the desired behavior, run it to confirm failure, implement minimal code to pass, then refactor while keeping tests green to prevent unverified behavior.

What is the red-green-refactor loop and how does it work for unit tests?

The red-green-refactor loop is a test-driven workflow where you watch unit tests fail, implement minimal changes to pass them, and safely refactor code while preserving green tests to reduce regressions and design drift.

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

Yes, test-driven development applies to new features, bug fixes, refactors, and behavior changes across codebases using automated tests and CI, ensuring behavior is verified before implementation to prevent regressions.

What is the best way to avoid unit tests that assert mocks or implementation details?

The best way to avoid testing implementation-specific details is to write failing tests that prove required behavior first, ensuring your automated tests validate actual behavior rather than asserting mocks or internal code structure.

Why does writing tests after implementation lead to poorly specified code?

Writing tests after implementation leads to poorly specified code because it forces behavior to be defined and verified before implementation, and skipping this step reduces your ability to catch regressions and prevent design drift.