test-driven-development

Guide developers through RED-GREEN-REFACTOR cycles with mandatory test verification.

1|Updated May 16, 2026
One-click install
npx skills add https://github.com/devMoez/titan --skill test-driven-development-devmoez
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/devMoez/titan/tree/main/skills/software-development/test-driven-development
Command: npx skills add https://github.com/devMoez/titan --skill test-driven-development-devmoez

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Test-Driven Development (TDD) solves the problem of shipping unverified code by forcing you to define expected behavior in a failing test before writing production logic, reducing regressions and hidden bugs.

Core Features & Use Cases

  • RED-GREEN-REFACTOR discipline: Write a minimal failing test (RED), add the simplest code to pass (GREEN), then clean up design without breaking behavior (REFACTOR).
  • Verification at each step: Explicitly run the targeted test to confirm the correct failure reason and confirm passing before moving on.
  • Regressive-proof workflow: Use the full test suite after each change to ensure new code does not break existing behavior.

Use cases:

  • Implementing new features with clear acceptance criteria
  • Fixing bugs by reproducing them in a failing test before coding the fix
  • Refactoring or changing behavior while keeping tests green to guard against unintended changes

Quick Start

Tell Titan to follow strict TDD for a feature by first writing a failing test, running it to confirm failure, then writing the minimal code to pass, and finally running the full test suite to ensure no regressions.

Frequently Asked Questions about test-driven-development

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

FAQPage Schema
How does test-driven development prevent regressions when writing new features?

Test-driven development prevents regressions by forcing you to write a failing test that defines expected behavior before adding production logic. Running the full test suite after each change ensures new code does not break existing functionality.

What is the RED-GREEN-REFACTOR cycle in unit testing?

The RED-GREEN-REFACTOR cycle is a unit testing discipline where you write a minimal failing test (RED), add the simplest code to pass it (GREEN), and then clean up the design without breaking behavior (REFACTOR). Verification is required at each step.

How do I fix a bug using a failing test before coding the fix?

To fix a bug using a failing test, you first reproduce the exact bug in a targeted test to confirm the failure reason. You then write the minimal production code required to turn that failing test green, followed by running the full test suite to prevent regressions.

Can I use test-driven development for refactoring existing code safely?

You can use test-driven development for refactoring by keeping existing tests green to guard against unintended changes. The discipline enforces explicit test verification before and after modifying behavior, ensuring your refactoring efforts do not introduce hidden bugs.

Do I need to run the full test suite after every single code change in TDD?

Running the full test suite after every code change is required in this TDD workflow to ensure new code does not break existing behavior. This regressive-proof step verifies that minimal code additions maintain overall software reliability.