test-driven-development

Automate the Red-Green-Refactor cycle to validate software behavior.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/garbray/claude-config --skill test-driven-development-garbray
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/garbray/claude-config/tree/main/config/skills/test-driven-development
Command: npx skills add https://github.com/garbray/claude-config --skill test-driven-development-garbray

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill enforces a disciplined approach to software development by ensuring you write tests before coding, helping prevent regressions and guiding design toward verifiable behavior.

Core Features & Use Cases

  • Red-Green-Refactor cycle: Write a failing test first, confirm failure, implement minimal production code to satisfy the test, then refactor without changing behavior.
  • Design clarity through tests: Encourages small, well-scoped units with explicit interfaces that are validated by tests.
  • Use case: When starting a feature or fixing a bug, begin with a failing test to lock in intended behavior before implementation.

Quick Start

Follow the Red-Green-Refactor cycle: write a failing test, run tests to see the failure, implement the minimal code to pass, and refactor while all tests remain green.

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 how does the red-green-refactor cycle work?

Test-driven development is an approach where you write a failing test, implement minimal code to pass it, then refactor. The cycle enforces verifiable behavior by validating intended outcomes before production logic exists.

How do I start writing tests before code to fix a bug or add a feature?

To start writing tests before code, write a failing test that locks in the intended behavior for your bug fix or feature. Run it to confirm failure, implement minimal production code to pass, then refactor while tests stay green.

Does test-driven development require a specific testing framework to work?

Test-driven development requires a testing framework that provides deterministic test outcomes. You need an environment enforcing a failing test before any production code is written, across new features, bug fixes, and refactoring tasks.

When should I not use test-driven development for my software workflow?

You should avoid test-driven development when deterministic test outcomes are not possible or practical. The workflow requires stable, predictable results to validate behavior, making it unsuitable for non-deterministic environments.

Why write failing tests first instead of writing tests after implementation?

Writing failing tests first prevents regressions and guides design toward small, well-scoped units with explicit interfaces. It ensures your tests validate intended behavior rather than just confirming existing implementation logic.