tdd

Guide test-first development with red-green-refactor cycles and behavior-based tests.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you develop features and fix bugs with a disciplined test-first workflow that keeps attention on observable behavior instead of implementation details.

Core Features & Use Cases

  • Behavior-Focused Testing: Write tests against public interfaces so they survive refactors and describe what the system does.
  • Red-Green-Refactor Loop: Add one test at a time, implement the smallest change needed to pass, then improve the design once everything is green.
  • Mocking Guidance: Keep mocks at system boundaries and avoid mocking your own code, which leads to more reliable and maintainable tests.
  • Use Case: Ideal for adding a new feature, repairing a regression, or validating an integration path where correctness and long-term test stability matter.

Quick Start

Ask me to help plan the first behavior to test for your change and then guide me through a single red-green-refactor cycle.

Frequently Asked Questions about tdd

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

FAQPage Schema
How do I apply red-green-refactor for behavior-focused tests?

Red-green-refactor involves adding a failing test for observable behavior, implementing the smallest change to pass it, then refactoring. This workflow ensures tests verify public interfaces rather than internal implementation details.

What is the best way to write integration tests using mocking?

When writing integration tests, apply mocking only at system boundaries and avoid mocking your own code. This keeps behavior-focused tests reliable and maintainable across refactoring cycles.

Can I use test-first development for bug fixes and regressions?

Test-first development suits bug fixes and regressions by guiding you to write a failing behavior test that reproduces the defect, then implementing the minimal code change needed to turn it green.

Why do my tests break when I refactor my code?

Tests break during refactoring when they verify implementation details instead of public interfaces. Behavior-focused tests survive refactors because they describe what the system does, not how it does it.

When do I need behavior-based tests for feature work?

You need behavior-based tests for feature work when long-term test stability and correctness matter. They validate observable system behavior through a disciplined red-green-refactor loop.

Does test-first development require refactoring after every green cycle?

Test-first development requires refactoring after green to improve design once all tests pass. The red-green-refactor loop mandates minimal implementation per cycle followed by design improvements.