test-driven-development

Guide test-driven development with red-green-refactor cycles for software projects.

1|1|Updated May 3, 2026
One-click install
npx skills add https://github.com/matt-riley/agent-skills --skill test-driven-development-matt-riley
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/matt-riley/agent-skills/tree/main/skills/test-driven-development
Command: npx skills add https://github.com/matt-riley/agent-skills --skill test-driven-development-matt-riley

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Use this skill to enforce confidence in code behavior by applying the test-driven development (TDD) cycle: write a failing test first, then implement minimal production code to pass it, and finally refactor.

Core Features & Use Cases

  • Red-Green-Refactor workflow: write a failing test, then minimal production code to pass, then refactor.
  • Coverage for features, bug fixes, refactors, and boundary-case handling through executable tests.
  • Tests serve as living documentation and guardrails that communicate expected behavior to future contributors.

Quick Start

Start by writing a minimal failing test that asserts the desired behavior, then implement the simplest code to pass.

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 for new features?▼

Test-driven development starts by writing a minimal failing test that asserts desired behavior, then implementing the simplest production code to pass it, and finally refactoring while keeping the test green.

What is the red-green-refactor cycle in unit testing?▼

The red-green-refactor cycle is a unit testing workflow where you write a failing test, implement minimal code to make it pass, and then refactor while maintaining the green test status.

Can I use TDD for bug fixes and boundary-case handling?▼

Yes, TDD applies to bug fixes, refactors, and boundary-case handling by first writing an executable test that captures the expected behavior or reproduces the bug before changing production code.

What's the best way to ensure code correctness during a refactor?▼

To ensure code correctness during a refactor, maintain green test status by using existing executable tests as guardrails while you clean up the code without altering its behavior.

Do I need a testing framework to start writing tests first?▼

You need a testing framework to execute tests and validate code correctness, but the TDD process itself only requires defining a failing test, implementing minimal code, and refactoring.

Why write tests first instead of after the production code?▼

Writing tests first enforces confidence in code behavior by ensuring every feature has executable guardrails that serve as living documentation and validate expected behavior before implementation.