test-driven-development

Enforce test-first development with RED/GREEN/REFACTOR workflows.

146|31|Updated Jul 25, 2025
One-click install
npx skills add https://github.com/bobmatnyc/claude-mpm --skill test-driven-development-bobmatnyc
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/bobmatnyc/claude-mpm/tree/main/src/claude_mpm/skills/bundled/testing/test-driven-development
Command: npx skills add https://github.com/bobmatnyc/claude-mpm --skill test-driven-development-bobmatnyc

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill enforces a strict test-first workflow (RED/GREEN/REFACTOR) to ensure code behavior is defined by tests, facilitate design decisions, and prevent regressions.

Core Features & Use Cases

  • Test-First Discipline: Enforce writing failing tests before implementing code.
  • RED/GREEN/REFACTOR Cycle: Guide through iterative development with visible verification moments.
  • Regression Protection: Adds tests that guard against future changes breaking behavior.
  • Clear API Design: Drives simpler, well-scoped interfaces through test-driven design.

Quick Start

  • Write a minimal failing test that describes the desired behavior.
  • Run tests to observe the failure (RED).
  • Implement the simplest code to pass the test (GREEN).
  • Run tests again to confirm success, then refactor if needed.

Frequently Asked Questions about test-driven-development

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

FAQPage Schema
How do I implement test-driven development in my workflow?

Test-driven development enforces writing failing tests before implementing code. Write a minimal failing test describing desired behavior, run it to confirm failure (RED), implement the simplest code to pass (GREEN), then refactor. This cycle applies to features, bug fixes, and refactoring across any project.

What's the RED/GREEN/REFACTOR cycle and why does it matter?

RED/GREEN/REFACTOR is a three-phase test-first workflow: RED means writing a failing test, GREEN means writing minimal code to pass it, and REFACTOR means improving code while tests stay green. This cycle ensures tests drive design, prevents regressions, and produces simpler, well-scoped APIs.

How does test-first development prevent regressions?

Test-first development builds a regression safety net by creating tests that guard against future changes breaking existing behavior. Every feature and fix gets a failing test first, ensuring coverage exists before implementation and protecting the codebase as it evolves.

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

Yes. Test-driven development applies to feature work, bug fixes, refactoring, and behavior changes. For bugs, write a failing test that reproduces the issue, then fix the code to make it pass. For refactoring, tests verify that behavior remains unchanged while you improve the implementation.

Does test-first development require specific testing frameworks or languages?

Test-driven development is a workflow discipline, not framework-specific. The RED/GREEN/REFACTOR cycle works with any testing framework, language, or platform. The core requirement is writing failing tests before implementation, regardless of your tech stack.

What's the difference between test-driven development and writing tests after code?

Test-first development writes failing tests before any implementation, letting tests drive design decisions and ensuring comprehensive coverage. Writing tests after code often results in tests that merely validate existing logic rather than guiding design, missing edge cases, and creating weaker regression protection.