test-driven-development

Enforce a red-green-refactor workflow with failing tests before production code.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Developers often implement production code without a clear, verifiable specification, resulting in regressions, ambiguous behavior, and manual debugging efforts; this Skill enforces a test-first workflow so behavior is specified, observed failing tests prove coverage, and fixes are validated automatically.

Core Features & Use Cases

  • Red-Green-Refactor Workflow: Write a minimal failing test, implement the simplest code to pass, then refactor while keeping tests green.
  • Verification Checklist: Emphasizes watching tests fail for the right reasons, confirming passing results, ensuring no new warnings or regressions, and avoiding test-only production APIs.
  • Anti-Pattern Guidance: Provides rules for mocking, test completeness, and avoiding tests that assert mock behavior.
  • Use Cases: Ideal for adding new features, fixing bugs, refactoring modules, and changing observable behavior in codebases with automated tests.

Quick Start

Write a focused failing test that specifies the desired behavior, run the test to confirm it fails, implement the minimal code to make it pass, and then 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
How do I start writing unit tests first when adding new features?

To start test-driven development, write a focused failing test that specifies the desired behavior, run it to confirm it fails for the right reasons, and implement minimal code to pass. This enforces a verifiable specification before production code is written.

What is the red-green-refactor workflow in test-driven development?

The red-green-refactor workflow is a test-driven development cycle where you write a minimal failing test, implement the simplest code to pass, and then refactor while keeping tests green. This ensures code behavior is specified and verified automatically.

Can I use mocking when doing test-first development?

You can use mocking during test-first development, but you should prefer assertions against real behavior rather than mocks. The workflow includes anti-pattern guidance to avoid tests that assert mock behavior and to ensure test completeness.

Does test-driven development work for fixing bugs and refactoring modules?

Test-driven development works for fixing bugs and refactoring modules by enforcing a failing test that specifies desired behavior before implementing fixes. It applies to changing observable behavior in codebases where automated tests can be executed.

Why do I need to observe a failing test before implementing production code?

You need to observe a failing test before implementing production code to prove coverage and confirm the test fails for the right reasons. This validates that the behavior is correctly specified before writing the minimal code to pass.