test-driven-development

Guide Red-Green-Refactor cycles with failing tests before production code.

Updated Dec 2, 2025
One-click install
npx skills add https://github.com/m16khb/claude-integration --skill test-driven-development-m16khb
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/m16khb/claude-integration/tree/main/.claude/skills/test-driven-development
Command: npx skills add https://github.com/m16khb/claude-integration --skill test-driven-development-m16khb

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill promotes a disciplined test-first approach, guiding Red-Green-Refactor cycles to ensure correct behavior before implementing code.

Core Features & Use Cases

  • Iron Law: NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST.
  • Red-Green-Refactor: Structured steps for experimental development.
  • AAA Pattern: Encourages clear test organization and naming.
  • Usage Scenario: Implement a new feature using a failing test, then write minimal production code.

Quick Start

Write a failing test for a new feature, then implement the smallest code to pass.

Frequently Asked Questions about test-driven-development

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

FAQPage Schema
What is test-driven development and why write tests before code?

Test-driven development (TDD) is a disciplined approach where you write a failing test first, then implement minimal code to pass it, then refactor. This ensures requirements are captured in automated tests before production code exists, preventing bugs and clarifying behavior upfront.

How do I implement test-driven development using the Red-Green-Refactor cycle?

Red-Green-Refactor is a structured TDD process: write a failing test (Red), implement minimal code to pass it (Green), then improve the code without breaking tests (Refactor). Repeat this cycle for each feature, bug fix, or behavior change to maintain code quality.

Can I apply test-driven development to existing features and bug fixes?

Yes. TDD applies to new features, bug fixes, refactoring, and behavior changes. For each task, write a failing test first that captures the requirement, implement the minimal code to satisfy it, then refactor with all tests passing to ensure correctness.

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

Test-first development (TDD) captures requirements before implementation, ensuring no production code executes without a failing test validating it. Writing tests after code often misses edge cases and treats testing as validation rather than design, leading to incomplete coverage and discovered bugs.

How does the AAA Pattern improve test organization in TDD?

The AAA Pattern (Arrange-Act-Assert) structures each test into three clear sections: set up inputs and state (Arrange), execute the code under test (Act), and verify the result (Assert). This naming convention makes tests readable, maintainable, and easier to debug.

Related Skills