test-driven-development

Enforce test-driven development by requiring failing tests before production changes.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Test-driven development prevents shipping unverified or regression-prone changes by forcing every behavior change to start from a failing test that proves the code meets the intended requirements.

Core Features & Use Cases

  • Iron Law enforcement: NO production code without a failing test first, including the rule to delete and restart if you write code before the failing test.
  • Red-Green-Refactor discipline: Watch the test fail, implement minimal code to pass, then refactor while keeping tests green, with explicit verification steps for RED and GREEN.
  • Test quality guardrails: Good Tests and Red Flags guidance that stops common rationalizations (like “tests after”) and avoids vague, coupled, or mock-only assertions.

Use case example: When fixing a bug where “empty email is accepted,” write a failing test that asserts the expected error, implement the smallest validation change to make the test pass, then refactor without changing behavior while re-running the full suite.

Quick Start

Ask your human partner or AI to guide you to write a single minimal failing test for the next behavior you want, then implement only enough code to make that test pass before refactoring.

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 for a new feature using test-driven development?

To start test-driven development, write a single minimal failing test that asserts the next behavior you want, implement only enough production code to make it pass, then refactor while keeping the test suite green.

What is the red-green-refactor cycle and how does it prevent bug regressions?

The red-green-refactor cycle enforces writing a failing test (red), implementing minimal code to pass it (green), and refactoring without changing behavior, preventing regressions by verifying every code change meets requirements.

How do I apply TDD to fix a bug where empty input is incorrectly accepted?

To fix a bug where empty input is accepted using TDD, write a failing unit test asserting the expected validation error, implement the smallest code change to make it pass, then refactor and run the full suite.

Can I use mocking in test-driven development without creating mock-only assertions?

You can use mocking in test-driven development when unavoidable, but you must avoid mock-only assertions by verifying the actual behavior and outputs of the system rather than simply asserting that mocks were called.

When should I not write tests after production code in TDD?

You should never write tests after production code in TDD because the Iron Law requires a failing test first; if you write code before the failing test, you must delete the code and restart the cycle.

What are common anti-patterns and red flags to avoid during test-first development?

Common red flags in test-first development include rationalizing tests after writing code, writing vague or coupled tests, and relying on mock-based assertions instead of verifying real behavior and pristine outputs.