test-driven-development

Guide red-green-refactor cycles by writing failing tests before implementation.

Updated Jan 7, 2026
One-click install
npx skills add https://github.com/Smooth-Operation/household-expense-tracker --skill test-driven-development-smooth-operation
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/Smooth-Operation/household-expense-tracker/tree/main/.claude/skills/testing/test-driven-development
Command: npx skills add https://github.com/Smooth-Operation/household-expense-tracker --skill test-driven-development-smooth-operation

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill helps developers adopt test-driven development by guiding the creation of failing tests before implementation.

Core Features & Use Cases

  • Establishes a RED/GREEN/REFACTOR workflow to guide incremental design and refactoring.
  • Encourages tests as a specification, catching regressions early across features, bug fixes, and refactors.
  • Use Case: When starting a new feature, write a failing test first, then implement minimal code to pass it.

Quick Start

Outline a failing test describing the desired behavior, run the test suite to observe the failure, implement the minimal code to pass the test, and then refactor for clarity and reliability.

Frequently Asked Questions about test-driven-development

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

FAQPage Schema
How do I practice test-driven development when adding new features?

Test-driven development requires writing a failing unit test that outlines the desired behavior before implementing any code. You then write the minimal code required to pass that test and finally refactor for clarity while preserving behavior.

What is the red-green-refactor cycle in software testing?

The red-green-refactor cycle is a test-driven development workflow where you first write a failing test, implement minimal code to make it pass, and then refactor the code for clarity. This iterative process guides incremental design and catches regressions early.

How do I use unit tests to fix bugs without breaking existing behavior?

When fixing bugs, you should first write a failing unit test that specifically reproduces the bug. Implement the code fix to turn the test green, ensuring your refactoring preserves the existing behavior while satisfying the new test requirements.

Does test-driven development work across different programming stacks?

Test-driven development applies across various languages and stacks for adding features, fixing bugs, and refactoring. The practice forces failing tests before coding, making it adaptable to any environment that supports unit tests and iterative development.

When should I not use test-driven development for refactoring?

You should avoid test-driven development during refactoring if you cannot first establish passing tests that verify the existing behavior. The refactoring phase requires a green test suite to ensure you preserve functionality while improving code clarity and reliability.

Why write failing tests before coding instead of testing after implementation?

Writing failing tests before coding establishes tests as a specification for your desired behavior, catching regressions early. This approach forces you to implement only the minimal code necessary to pass the test, preventing over-engineering and guiding incremental design.