test-driven-development

Enforce test-first implementation with a red-green-refactor cycle for software changes.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill prevents implementation-first coding by enforcing a test-first workflow for new features, bug fixes, refactors, and behavior changes.

Core Features & Use Cases

  • Red-Green-Refactor Discipline: Guides you to write a failing test, verify the failure, implement the minimum code, and then clean up safely.
  • Real-Behavior Validation: Encourages tests that exercise actual code paths instead of over-relying on mocks or test-only shortcuts.
  • Use Case: When adding a new API endpoint, use this Skill to define the expected behavior in a failing test before writing the endpoint logic.

Quick Start

Use the test-driven-development skill to add a failing test for the feature I want, then implement only enough code to make it 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 enforce a test-first workflow when adding new API endpoints?

Test-driven development enforces a test-first workflow by requiring a failing test that defines expected behavior before writing endpoint logic. You verify the failure, implement minimal code to satisfy assertions, then refactor safely within the red-green-refactor cycle.

What is the red-green-refactor cycle for unit tests?

The red-green-refactor cycle is a test-driven development process where you write a failing unit test, verify the failure, implement the minimum code to satisfy assertions, and then clean up safely. This enforces regression prevention and behavior verification.

When do I need to write tests first for bug fixes and refactoring?

You need test-driven development for bug fixes and refactoring when your workflow requires regression prevention and safe iteration on production code. It forces you to define expected behavior in a failing test before changing implementation logic.

Does test-driven development work with real-behavior validation instead of mocks?

Yes, test-driven development encourages real-behavior validation by exercising actual code paths instead of over-relying on mocks or test-only shortcuts. This ensures unit tests verify true production behavior throughout the red-green-refactor cycle.

What is the best way to prevent regressions when iterating on production code?

Test-driven development is the best way to prevent regressions when iterating on production code, as it requires a failing test before implementation and applies minimal code to satisfy assertions. This enforces behavior verification and safe iteration during refactoring.

Why does test-driven development require a failing test before implementation?

Test-driven development requires a failing test before implementation to prevent implementation-first coding and ensure the test validates target behavior. This confirms the test detects the missing feature before writing minimal code to satisfy assertions.