test-driven-development

Enforce failing tests before production code using the Red-Green-Refactor workflow.

Updated May 19, 2026
One-click install
npx skills add https://github.com/costrict-plugins-repo/anthropic-superpowers --skill test-driven-development-costrict-plugins-repo
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/costrict-plugins-repo/anthropic-superpowers/tree/main/skills/test-driven-development
Command: npx skills add https://github.com/costrict-plugins-repo/anthropic-superpowers --skill test-driven-development-costrict-plugins-repo

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Enforces failing tests before writing production code to prevent regressions.

Core Features & Use Cases

  • Red-Green-Refactor workflow: write a failing test, implement minimal code to pass, and refactor while tests stay green.
  • Regression protection: maintain a safety net that guards against unintended behavior changes during edits.
  • Use cases: feature development, bug fixes, and targeted refactoring across software projects.

Quick Start

Write a failing test, implement the smallest code to pass, then iterate on refactoring 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
What is the test-driven development workflow for preventing regressions?

Test-driven development enforces writing a failing unit test before writing production code to prevent software regressions. You then implement minimal code to pass the test, and refactor while keeping tests green.

How do I apply TDD when refactoring existing software projects?

To apply TDD during refactoring, maintain a safety net of green tests that guard against unintended behavior changes. Write targeted tests for existing behavior, verify they pass, then refactor incrementally while keeping tests green.

Can I use this test-driven development cycle for bug fixes and new feature development?

Yes, this test-driven development cycle is applicable to both new feature development and bug fixes across software projects. It guides developers through a repeatable cycle of writing failing tests before implementing minimal code to fix or build features.

What's the difference between writing unit tests before or after production code?

Writing unit tests before production code enforces failing tests initially, ensuring your test validates the feature. Writing tests after coding risks tests that simply mirror existing logic, missing the regression protection and minimal implementation discipline of TDD.

When should I not use the Red-Green-Refactor workflow?

You should avoid the Red-Green-Refactor workflow for exploratory prototyping or throwaway scripts where regression protection is unnecessary. TDD requires writing failing tests first, which adds overhead unsuitable for rapid, unstable software experiments.