test-driven-development

Enforces red-green-refactor test-driven development workflow before writing implementation code.

Updated May 8, 2026
One-click install
npx skills add https://github.com/tomw200082-collab/gt-factory-os-production-brain --skill test-driven-development-tomw200082-collab
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/tomw200082-collab/gt-factory-os-production-brain/tree/main/.claude/skills/test-driven-development
Command: npx skills add https://github.com/tomw200082-collab/gt-factory-os-production-brain --skill test-driven-development-tomw200082-collab

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Developers often write production code first and bolt tests on afterward, producing tests that pass immediately and prove nothing. This Skill enforces a strict test-first discipline so every behavior change is covered by a test that was watched failing before implementation. ## Core Features & Use Cases - Red-Green-Refactor Cycle: Guides writing one failing test, verifying it fails for the right reason, writing minimal code to pass, then refactoring while staying green. - Rationalization Detection: Lists common excuses for skipping TDD ("too simple to test", "I'll test after") with concrete rebuttals and red flags that trigger a restart. - Test Quality Rules: A companion reference defines how to write honest tests — name the break each test catches, assert real behavior instead of mocks, and run a mutation check. - Use Case: When fixing a bug where empty emails are accepted, write a failing test asserting the rejection error, watch it fail, implement the minimal validation, and confirm all tests pass. ## Quick Start Use the test-driven-development skill to implement this feature by writing a failing test first, then the minimal 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 practice test-driven development on a new feature?▼

Write one minimal failing test describing the desired behavior, run it to confirm it fails for the right reason, then write the simplest code that passes. Refactor only while tests stay green, then repeat the cycle for the next behavior.

How do I write a failing test for a bug fix?▼

Write a test that reproduces the bug by asserting the correct behavior, such as expecting an error for empty input. Run it to watch it fail, implement the minimal fix, and confirm the test passes along with the rest of the suite.

Should I use mocks in unit tests?▼

Prefer real code and assert on real behavior; never assert on the mock itself. Mock only slow or external dependencies after learning their side effects, and mirror the complete real data structure in mock responses.

When is it acceptable to skip test-driven development?▼

Exceptions are limited to throwaway prototypes, generated code, and configuration files, and only with explicit approval from your human partner. Exploratory code is allowed but must be deleted and rewritten test-first.

Why does my test pass immediately without implementation?▼

A test that passes immediately is testing existing behavior or is tautological, proving nothing. Fix the test so it fails because the feature is missing, then implement until it passes.