| name | tdd-workflow |
| description | Test-driven development execution workflow with red-green-refactor cycle, increment decomposition, and pause/continue rules. Use when building features or fixing bugs using TDD. Framework-agnostic with language-specific configs for Python, TypeScript, Go, and Ruby delegation. |
TDD Workflow
Core Principle
Never write implementation code before a failing test exists for that behavior.
Execution Flow
1. Setup
LANG = config_read("tech_stack", "unknown")
If LANG == "unknown": detect from project files (package.json → TypeScript, Gemfile → Ruby, go.mod → Go, pyproject.toml → Python)
If LANG == "unknown": AskUserQuestion("What language/framework?")
RUNNER = lookup LANG in [references/language-configs.md]
If LANG in [ruby]: delegate to `rspec-coder` or `minitest-coder` skill for runner details
INCREMENTS = decompose feature using patterns from [references/increments.md]
- Read requirements/plan
- Identify pattern (Data Transformation, CRUD, State Machine, Calculation, Integration)
- Break into ordered increments: degenerate → happy path → variations → edge cases → errors
For each INCREMENT in INCREMENTS:
TaskCreate(subject: INCREMENT.name, description: INCREMENT.test_description)
AskUserQuestion("Review increments. Adjust ordering or scope?", options: ["Looks good", "Modify"])
2. TDD Loop (per increment)
For each INCREMENT in INCREMENTS:
TaskUpdate(INCREMENT.task_id, status: "in_progress")
# RED
Write failing test to real file (not code block)
RUN = Bash(RUNNER.test_command)
If RUN.status == PASS: STOP — investigate unexpected pass
If RUN.status == FAIL (wrong reason): fix test, rerun
PAUSE → show test + failure output, wait for user
# GREEN
Write minimal implementation code
RUN = Bash(RUNNER.full_suite_command)
If RUN.status == FAIL: show output, PAUSE → ask user to fix or hand off
If RUN.status == PASS: auto-continue (no pause)
# REFACTOR
If improvement opportunities exist:
Refactor implementation and/or test code
RUN = Bash(RUNNER.full_suite_command)
If RUN.status == FAIL: revert refactor, PAUSE → discuss
If RUN.status == PASS: auto-continue (no pause)
TaskUpdate(INCREMENT.task_id, status: "completed")
Brief summary of what was implemented
→ immediately begin next increment (no pause between increments)