tddlisted
Install: claude install-skill oprogramadorreal/optimus-claude
# Test-Driven Development
Guide the user through Red-Green-Refactor cycles to implement a feature or fix a bug test-first. Each cycle: write a failing test (Red), write the minimum code to pass it (Green), clean up while tests stay green (Refactor). One behavior per cycle.
This skill is for **new features** and **bug fixes** — not refactoring. For restructuring existing code without changing behavior, use `/optimus:refactor` instead (existing tests verify behavior is preserved).
### The Iron Law
**No production code without a failing test first.** If implementation code is written before its test, delete it entirely and begin the cycle fresh. Do not preserve it as reference, do not adapt it — write the implementation from scratch once the failing test exists. This is the non-negotiable foundation of every step that follows.
> **Coming from plan mode?** TDD runs in **normal mode**, in a fresh conversation. If you were iterating on a plan-mode prompt generated by `/optimus:brainstorm` or `/optimus:jira`, **toggle plan mode off without approving** (see `$CLAUDE_PLUGIN_ROOT/references/skill-handoff.md` for client-specific controls), let Claude append the "Refined plan" section to the design or JIRA doc, then start a fresh conversation before invoking this skill — TDD will auto-detect the updated doc.
## Step 1: Pre-flight
Read `$CLAUDE_PLUGIN_ROOT/skills/init/references/multi-repo-detection.md` for workspace detection. If a multi-repo workspace is detected, process each re