一键导入
test-driven-development
Use when ship-flow plan, execute, or verify needs TDD, test-first discipline, or RED-before-GREEN evidence for code-bearing tasks.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when ship-flow plan, execute, or verify needs TDD, test-first discipline, or RED-before-GREEN evidence for code-bearing tasks.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Use when writing a ship-flow plan for a shaped entity, especially implementation tasks, TDD needs, runtime commands, or scope anchoring. Layer A delegation: superpowers:writing-plans owns plan authoring; ship-flow:test-driven-development owns fallback TDD contracts.
Use when shaping vague, complex, or ambiguous ship-flow requests into a Shape Up pitch, including `/shape`, discussion, or skill-authoring work.
Use when shape finds UI, domain, contract, interface, visual ambiguity, affects_ui, design_required, or no design reference before plan.
Use when ship-flow needs execute-stage implementation from an approved plan, including wave tasks, blocked work, or PR feedback re-entry. Layer A delegation: superpowers:subagent-driven-development owns wave dispatch discipline.
Use when `/ship` should run ship-flow for an entity id or good-enough raw requirement; vague inputs need shape clarification.
Use when verify passed and ship-flow needs review, PR readiness, PR body drafting, or canonical docs sync. Layer A delegation: pr-review-toolkit:review-pr owns PR review persona philosophy.
| name | test-driven-development |
| description | Use when ship-flow plan, execute, or verify needs TDD, test-first discipline, or RED-before-GREEN evidence for code-bearing tasks. |
This is ship-flow's built-in TDD fallback contract. superpowers:test-driven-development is an optional enhancer, not a dependency: adopter projects are not required to install superpowers for ship-flow to require test-first work.
Core rule: every non-exempt code task carries a RED/GREEN/REFACTOR artifact trail from plan through execute and verify.
Use this skill when:
plan.md tasks for implementation work.superpowers:test-driven-development.Do not use it for docs-only/stage-artifact tasks, pure configuration, migrations validated by existing migration tooling, or pure refactors with existing coverage. Those tasks still need an explicit TDD: skip -- <reason>.
Each code-bearing task must include a tdd_contract block:
tdd_contract:
red_command: "<command that runs the new/changed failing test only>"
expected_red_failure: "<the missing behavior or failing assertion expected before implementation>"
green_command: "<command proving the new/changed test passes after implementation>"
refactor_check: "<command to re-run after cleanup; may equal green_command>"
The command can be a repo test runner, a focused shell test, or a small executable repro. It must be runnable by execute and auditable by verify.
| Stage | Responsibility |
|---|---|
| plan | Write the tdd_contract before implementation tasks are dispatched. |
| execute | Run red_command before production edits and record the expected RED failure; then implement minimally, run green_command, refactor only while green, and record evidence. |
| verify | Audit execute evidence. Missing RED-before-GREEN evidence is a finding with route_to: execute unless the task has a valid TDD: skip reason. |
Execute evidence must show:
RED command: command text and exit/failure snippet.Expected RED failure: why the failure proves the behavior was missing.GREEN command: command text and pass snippet after implementation.REFACTOR: either "not needed" or the command re-run after cleanup.If a test passes immediately during RED, stop and revise the test or the task. A passing RED command means it did not prove missing behavior.
If superpowers:test-driven-development is available, load it and follow its stricter discipline for the implementation cycle. If it is unavailable, do not block solely on that absence; this ship-flow artifact contract remains authoritative.
| Mistake | Correction |
|---|---|
Listing test in skills_needed but no tdd_contract | Add the concrete RED/GREEN commands to the task. |
| Writing one broad "run all tests" command for RED | Use the smallest command that proves the intended behavior is missing. |
| Marking migration/docs/config as skip without reason | Add TDD: skip -- <specific reason and alternate validation>. |
| Verifier accepts green tests only | Verify RED-before-GREEN evidence, not just final pass state. |