test-driven-development

Enforce RED-GREEN-REFACTOR with failing tests before production code.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Prevents shipping unverified or buggy implementations by forcing you to prove behavior with tests that fail first, then pass.

Core Features & Use Cases

  • Write failing tests first (RED): Start by capturing the intended behavior in a minimal test that fails for the right reason.
  • Implement the smallest change (GREEN): Add production code only to make the failing test pass while keeping other tests green.
  • Refactor safely (REFACTOR): Clean up implementation details without changing behavior, ensuring tests remain passing.

Use cases include non-trivial feature development, bug fixes, refactoring, and behavior changes where correctness and regression protection matter.

Quick Start

Ask an AI agent to implement a non-trivial feature using Test-Driven Development: create one minimal failing test first, run the tests until RED/ GREEN are correct, then implement the smallest production code change to pass and finally refactor while keeping the test suite green.

Frequently Asked Questions about test-driven-development

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

FAQPage Schema
What is the red-green-refactor cycle in test-driven development?

The red-green-refactor cycle in test-driven development requires writing a failing test (RED), implementing the smallest code change to pass it (GREEN), and cleaning up implementation details without altering behavior (REFACTOR).

How do I start writing unit tests before implementing new features?

To start writing unit tests before implementing new features, capture the intended behavior in a minimal failing test, run it to confirm it fails for the right reason, then add the smallest production code necessary to make it pass.

When should I use test-driven development for bug fixes?

Use test-driven development for bug fixes when you need regression prevention and proof of correct behavior. It forces you to write a failing test reproducing the bug first, ensuring the subsequent fix prevents future regressions.

Does test-driven development require running tests continuously?

Yes, test-driven development requires mandatory test execution. You must run tests to verify the RED phase fails correctly, confirm the GREEN phase passes, and ensure the REFACTOR phase keeps the entire test suite green.

What's the best way to prevent regressions during code refactoring?

The best way to prevent regressions during code refactoring is maintaining a passing test suite. Behavior-focused assertions verify correctness, allowing you to clean up implementation details safely without changing the original behavior.