test-driven-development

Enforce a test-first workflow with failing tests before production changes.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It prevents regressions and weak verification by forcing you to define correct behavior as a failing test before writing or changing production code.

Core Features & Use Cases

  • Fail-first discipline: Write a minimal test that demonstrates the missing behavior, confirm it fails for the right reason, then implement only what makes it pass.
  • Red-Green-Refactor loop: Re-run tests to validate the red state, ensure green passes without warnings/errors, and only then refactor while keeping behavior unchanged.
  • Anti-rationalization guardrails: Stops common shortcuts like “test after,” “skip just once,” “adapt existing code,” or treating tests as optional.

Quick Start

Use this skill when you are about to implement a feature, bug fix, refactor, or behavior change, and write a failing test that captures the single behavior you intend to deliver.

Frequently Asked Questions about test-driven-development

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

FAQPage Schema
How do I use test-driven development to prevent regressions when refactoring code?

Test-driven development prevents regressions by enforcing a test-first workflow: write a failing test that captures the intended behavior, implement the minimal production change to pass it, and refactor only after all tests pass.

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

The red-green-refactor loop in TDD involves writing a minimal failing test to validate the red state, implementing the smallest code change to achieve a green passing state, and then refactoring while keeping behavior unchanged.

How to write a failing unit test before implementing a new feature?

Write a failing unit test by defining one minimal test that demonstrates the missing behavior, verify the failure occurs for the expected reason, then implement only the production code required to make that specific test pass.

When should I use a test-first workflow instead of testing after implementation?

Use a test-first workflow whenever correctness must be proven and regressions prevented before code review or merge, applying it to new features, bug fixes, refactors, and behavior changes to stop common shortcuts like adapting existing code.

Does test-driven development work for fixing bugs and changing behavior?

Yes, test-driven development works for fixing bugs and changing behavior by requiring you to write a failing test that captures the single behavior you intend to deliver before writing or changing any production code.