test-driven-development

Enforces red-green-refactor TDD workflow requiring failing tests before writing production code.

1|Updated Oct 11, 2025
One-click install
npx skills add https://github.com/ibytechaos/claude --skill test-driven-development-ibytechaos
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/ibytechaos/claude/tree/main/plugins/superpowers/skills/test-driven-development
Command: npx skills add https://github.com/ibytechaos/claude --skill test-driven-development-ibytechaos

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? It prevents untested production code by enforcing a strict test-first discipline, eliminating the false confidence of tests written after implementation that pass immediately and prove nothing. ## Core Features & Use Cases - Red-Green-Refactor Cycle: Guides writing a failing test, verifying it fails for the right reason, writing minimal code to pass, then refactoring while staying green. - Anti-Rationalization Rules: Counters common excuses like "I'll test after" or "deleting code is wasteful" with concrete rebuttals and red-flag checklists. - Testing Anti-Patterns Reference: Covers testing mock behavior, test-only methods in production classes, incomplete mocks, and mocking without understanding dependencies. - Use Case: When fixing a bug where empty emails are accepted, write a failing test asserting the rejection error first, watch it fail, then implement the minimal validation to make it 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 step by step?

Follow the red-green-refactor cycle: write one minimal failing test, run it to confirm it fails for the expected reason, write the simplest code to pass it, verify all tests pass, then refactor while keeping tests green. Repeat for each new behavior.

Why should tests be written before implementation code?

Tests written after code pass immediately, which proves nothing about whether they test the right behavior. Watching a test fail first confirms it actually exercises the missing feature and catches real bugs rather than mirroring the implementation.

When is it acceptable to skip TDD?

Only for throwaway prototypes, generated code, or configuration files, and only with explicit approval from your human partner. Exploration is fine, but the exploratory code should be discarded and rewritten test-first.

Why is testing mock behavior a bad practice?

Asserting on mock elements verifies the mock exists, not that the component works. Tests should exercise real behavior; if isolation requires mocks, assert on the component's observable behavior rather than mock internals.

What should I do if a test is too complicated to write?

A hard-to-write test signals an unclear or overly coupled design. Simplify the interface, use dependency injection instead of heavy mocking, and extract test helpers rather than adding test-only methods to production classes.