Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Unified TDD workflow skill combining 6-phase TDD planning with Red-Green-Refactor task chain generation, and 4-phase TDD verification with compliance reporting. Triggers on "workflow-tdd-plan", "workflow-tdd-verify".
.claude/skills/workflow-tdd-plan-plan/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-09 | ✗→✓ | ▲ Improved | — | — |
| case-21 | ✗→✓ | ▲ Improved | — | — |
| case-12 | ✗→✓ | ▲ Improved | — | — |
| case-18 | ✗→✓ | ▲ Improved | — | — |
| case-11 | ✗→✓ | ▲ Improved | — | — |
<purpose> Unified TDD workflow skill combining TDD planning (Red-Green-Refactor task chain generation with test-first development structure) and TDD verification (compliance validation with quality gate reporting). Produces IMPL_PLAN.md, task JSONs with internal TDD cycles, and TDD_COMPLIANCE_REPORT.md. Triggers on "workflow-tdd-plan" (plan mode) or "workflow-tdd-verify" (verify mode). </purpose>
<process>
┌──────────────────────────────────────────────────────────────────┐
│ Workflow TDD Orchestrator (SKILL.md) │
│ → Route by mode: plan | verify │
│ → Pure coordinator: Execute phases, parse outputs, pass context │
└──────────────────────────────────┬───────────────────────────────┘
│
┌───────────────────────┴───────────────────────┐
↓ ↓
┌─────────────┐ ┌───────────┐
│ Plan Mode │ │ Verify │
│ (default) │ │ Mode │
│ Phase 1-6 │ │ Phase 7 │
└──────┬──────┘ └───────────┘
│
┌─────┼─────┬─────┬─────┬─────┐
↓ ↓ ↓ ↓ ↓ ↓
┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐
│ 1 │ │ 2 │ │ 3 │ │ 4 │ │ 5 │ │ 6 │
│Ses│ │Ctx│ │Tst│ │Con│ │Gen│ │Val│
└───┘ └───┘ └───┘ └───┘ └─┬─┘ └───┘
↓
┌───────────┐
│ Confirm │─── Verify ──→ Phase 7
│ (choice) │─── Execute ─→ Skill("workflow-execute")
└───────────┘─── Review ──→ Display session status inlineBefore dispatching to phase execution, collect workflow preferences via AskUserQuestion:
javascript// ★ 统一 auto mode 检测:-y/--yes 从 $ARGUMENTS 或 ccw 传播 const autoYes = /\b(-y|--yes)\b/.test($ARGUMENTS) if (autoYes) { // 自动模式:跳过所有询问,使用默认值 workflowPreferences = { autoYes: true } } else { const prefResponse = AskUserQuestion({ questions: [ { question: "是否跳过所有确认步骤(自动模式)?", header: "Auto Mode", multiSelect: false, options: [ { label: "Interactive (Recommended)", description: "交互模式,包含确认步骤" }, { label: "Auto", description: "跳过所有确认,自动执行" } ] } ] }) workflowPreferences = { autoYes: prefResponse.autoMode === 'Auto' } }
workflowPreferences is passed to phase execution as context variable, referenced as workflowPreferences.autoYes within phases.
javascriptconst args = $ARGUMENTS const mode = detectMode(args) function detectMode(args) { // Skill trigger determines mode if (skillName === 'workflow-tdd-verify') return 'verify' return 'plan' // default: workflow-tdd-plan }
Multi-phase TDD planning (Phase 1-6/7) spans long conversations. Uses 双重保险: TodoWrite 跟踪 active phase 保护其不被压缩,sentinel 作为兜底。
> ⚠️ COMPACT DIRECTIVE: Context compression MUST check TodoWrite phase status. > The phase currently marked in_progress is the active execution phase — preserve its FULL content. > Only compress phases marked completed or pending.
Input Parsing:
└─ Convert user input to TDD structured format (GOAL/SCOPE/CONTEXT/TEST_FOCUS)
Phase 1: Session Discovery
└─ Read("phases/01-session-discovery.md")
└─ Output: sessionId (WFS-xxx)
Phase 2: Context Gathering
└─ Read("phases/02-context-gathering.md")
├─ Tasks attached: Analyze structure → Identify integration → Generate package
└─ Output: contextPath + conflictRisk
Phase 3: Test Coverage Analysis
└─ Read("phases/03-test-coverage-analysis.md")
├─ Tasks attached: Detect framework → Analyze coverage → Identify gaps
└─ Output: testContextPath
Phase 4: Conflict Resolution (conditional: conflictRisk ≥ medium)
└─ Decision (conflictRisk check):
├─ conflictRisk ≥ medium → Read("phases/04-conflict-resolution.md")
│ ├─ Tasks attached: Detect conflicts → Log analysis → Apply strategies
│ └─ Output: conflict-resolution.json
└─ conflictRisk < medium → Skip to Phase 5
Phase 5: TDD Task Generation
└─ Read("phases/05-tdd-task-generation.md")
├─ Tasks attached: Discovery → Planning → Output
└─ Output: IMPL_PLAN.md, IMPL-*.json, TODO_LIST.md
Phase 6: TDD Structure Validation
└─ Read("phases/06-tdd-structure-validation.md")
└─ Output: Validation report + Plan Confirmation Gate
Plan Confirmation (User Decision Gate):
└─ Decision (user choice):
├─ "Verify TDD Compliance" (Recommended) → Route to Phase 7 (tdd-verify)
├─ "Start Execution" → Skill(skill="workflow-execute")
└─ "Review Status Only" → Display session status inlinePhase 7: TDD Verification
└─ Read("phases/07-tdd-verify.md")
└─ Output: TDD_COMPLIANCE_REPORT.md with quality gate recommendationRead on-demand when phase executes using Read("phases/..."):
| Phase | Document | Purpose | Mode | Compact | |-------|----------|---------|------|---------| | 1 | phases/01-session-discovery.md | Create or discover TDD workflow session | plan | TodoWrite 驱动 | | 2 | phases/02-context-gathering.md | Gather project context and analyze codebase | plan | TodoWrite 驱动 | | 3 | phases/03-test-coverage-analysis.md | Analyze test coverage and framework detection | plan | TodoWrite 驱动 | | 4 | phases/04-conflict-resolution.md | Detect and resolve conflicts (conditional) | plan | TodoWrite 驱动 | | 5 | phases/05-tdd-task-generation.md | Generate TDD tasks with Red-Green-Refactor cycles | plan | TodoWrite 驱动 + sentinel | | 6 | phases/06-tdd-structure-validation.md | Validate TDD structure and present confirmation gate | plan | TodoWrite 驱动 + sentinel | | 7 | phases/07-tdd-verify.md | Full TDD compliance verification with quality gate | verify | TodoWrite 驱动 |
Compact Rules:
in_progress → 保留完整内容,禁止压缩completed → 可压缩为摘要Read() 恢复对应 phase 文件NO PRODUCTION CODE WITHOUT A FAILING TEST FIRSTEnforcement Method:
implementation includes test-first steps (Red → Green → Refactor)Verification: Phase 6 validates Red-Green-Refactor structure in all generated tasks
| Checkpoint | Validation Phase | Evidence Required | |------------|------------------|-------------------| | Test-first structure | Phase 5 | implementation has 3 steps | | Red phase exists | Phase 6 | Step 1: tdd_phase: "red" | | Green phase with test-fix | Phase 6 | Step 2: tdd_phase: "green" + test-fix-cycle | | Refactor phase exists | Phase 6 | Step 3: tdd_phase: "refactor" |
Red Flags - STOP and Reassess:
Why Order Matters:
Convert User Input to TDD Structured Format:
User: "Build authentication system"
Structured: TDD: Authentication System GOAL: Build authentication system SCOPE: Core authentication features CONTEXT: New implementation TEST_FOCUS: Authentication scenarios
User: "Add JWT authentication with email/password login and token refresh"
Structured: TDD: JWT Authentication GOAL: Implement JWT-based authentication SCOPE: Email/password login, token generation, token refresh endpoints CONTEXT: JWT token-based security, refresh token rotation TEST_FOCUS: Login flow, token validation, refresh rotation, error cases
User Input (task description)
↓
[Convert to TDD Structured Format]
↓ Structured Description:
↓ TDD: [Feature Name]
↓ GOAL: [objective]
↓ SCOPE: [boundaries]
↓ CONTEXT: [background]
↓ TEST_FOCUS: [test scenarios]
↓
Phase 1: session:start --auto "TDD: structured-description"
↓ Output: sessionId
↓
Phase 2: context-gather --session sessionId "structured-description"
↓ Input: sessionId + structured description
↓ Output: contextPath (context-package.json) + conflictRisk
↓
Phase 3: test-context-gather --session sessionId
↓ Input: sessionId
↓ Output: testContextPath (test-context-package.json)
↓
Phase 4: conflict-resolution [conditional: conflictRisk ≥ medium]
↓ Input: sessionId + contextPath + conflictRisk
↓ Output: conflict-resolution.json
↓ Skip if conflictRisk is none/low → proceed directly to Phase 5
↓
Phase 5: task-generate-tdd --session sessionId
↓ Input: sessionId + all accumulated context
↓ Output: IMPL_PLAN.md, IMPL-*.json, TODO_LIST.md
↓
Phase 6: TDD Structure Validation (internal)
↓ Validate Red-Green-Refactor structure
↓ Present Plan Confirmation Gate
↓
Plan Confirmation (User Decision Gate):
├─ "Verify TDD Compliance" (Recommended) → Route to Phase 7
├─ "Start Execution" → Skill(skill="workflow-execute")
└─ "Review Status Only" → Display session status inlineInput: --session sessionId (or auto-detect)
↓
Phase 7: Session discovery → Chain validation → Coverage analysis → Report
↓ Output: TDD_COMPLIANCE_REPORT.md with quality gateSession Memory Flow: Each phase receives session ID, which provides access to:
Core Concept: Dynamic task attachment and collapse for real-time visibility into TDD workflow execution.
> Implementation Note: Phase files use TodoWrite syntax to describe the conceptual tracking pattern. At runtime, these are implemented via TaskCreate/TaskUpdate/TaskList tools. Map as follows: > - Initial list creation → TaskCreate for each item > - Status changes → TaskUpdate({ taskId, status }) > - Sub-task attachment → TaskCreate + TaskUpdate({ addBlockedBy }) > - Sub-task collapse → TaskUpdate({ status: "completed" }) + TaskUpdate({ status: "deleted" }) for collapsed sub-items
in_progress, others as pendingLifecycle: Initial pending → Phase executed (tasks ATTACHED) → Sub-tasks executed sequentially → Phase completed (tasks COLLAPSED for 3/4/5, marked completed for 1/2/6) → Next phase → Repeat
json[ {"content": "Phase 1: Session Discovery", "status": "in_progress", "activeForm": "Executing session discovery"}, {"content": "Phase 2: Context Gathering", "status": "pending", "activeForm": "Executing context gathering"}, {"content": "Phase 3: Test Coverage Analysis", "status": "pending", "activeForm": "Executing test coverage analysis"}, {"content": "Phase 5: TDD Task Generation", "status": "pending", "activeForm": "Executing TDD task generation"}, {"content": "Phase 6: TDD Structure Validation", "status": "pending", "activeForm": "Validating TDD structure"} ]
Note: Phase 4 (Conflict Resolution) is added dynamically after Phase 2 if conflictRisk ≥ medium.
json[ {"content": "Phase 1: Session Discovery", "status": "completed"}, {"content": "Phase 2: Context Gathering", "status": "completed"}, {"content": "Phase 3: Test Coverage Analysis", "status": "in_progress"}, {"content": " → Detect test framework and conventions", "status": "in_progress"}, {"content": " → Analyze existing test coverage", "status": "pending"}, {"content": " → Identify coverage gaps", "status": "pending"}, {"content": "Phase 5: TDD Task Generation", "status": "pending"}, {"content": "Phase 6: TDD Structure Validation", "status": "pending"} ]
json[ {"content": "Phase 1: Session Discovery", "status": "completed"}, {"content": "Phase 2: Context Gathering", "status": "completed"}, {"content": "Phase 3: Test Coverage Analysis", "status": "completed"}, {"content": "Phase 5: TDD Task Generation", "status": "pending"}, {"content": "Phase 6: TDD Structure Validation", "status": "pending"} ]
json[ {"content": "Phase 1: Session Discovery", "status": "completed"}, {"content": "Phase 2: Context Gathering", "status": "completed"}, {"content": "Phase 3: Test Coverage Analysis", "status": "completed"}, {"content": "Phase 5: TDD Task Generation", "status": "in_progress"}, {"content": " → Discovery - analyze TDD requirements", "status": "in_progress"}, {"content": " → Planning - design Red-Green-Refactor cycles", "status": "pending"}, {"content": " → Output - generate IMPL tasks with internal TDD phases", "status": "pending"}, {"content": "Phase 6: TDD Structure Validation", "status": "pending"} ]
Note: See individual Phase descriptions for detailed TodoWrite Update examples.
After heavy phases (Phase 2-3), evaluate context window usage:
javascript Skill(skill="memory-capture")
Similar to workflow-plan, a planning-notes.md can accumulate context across phases if needed. See Phase 1 for initialization.
in_progress, report error to user, do not proceed| Error Type | Detection | Recovery Action | |------------|-----------|-----------------| | Parsing failure | Empty/malformed output | Retry once, then report | | Missing context-package | File read error | Re-run Phase 2 (context-gathering) | | Invalid task JSON | jq parse error | Report malformed file path | | Task count exceeds 18 | Count validation ≥19 | Request re-scope, split into multiple sessions | | Missing cli_execution.id | All tasks lack ID | Regenerate tasks with phase 0 user config | | Test-context missing | File not found | Re-run Phase 3 (test-coverage-analysis) | | Phase timeout | No response | Retry phase, check CLI connectivity | | CLI tool not available | Tool not in cli-tools.json | Fall back to alternative preferred tool |
| Pattern | Warning Message | Recommended Action | |---------|----------------|-------------------| | Task count >10 | High task count detected | Consider splitting into multiple sessions | | Missing test-fix-cycle | Green phase lacks auto-revert | Add max_iterations: 3 to task config | | Red phase missing test path | Test file path not specified | Add explicit test file paths | | Generic task names | Vague names like "Add feature" | Use specific behavior descriptions | | No refactor criteria | Refactor phase lacks completion criteria | Define clear refactor scope |
All warnings are advisory - they do not halt execution:
.process/tdd-warnings.logworkflow-execute skillPrerequisite Skills:
Called by Plan Mode (6 phases):
/workflow:session:start - Phase 1: Create or discover TDD workflow sessionphases/02-context-gathering.md - Phase 2: Gather project context and analyze codebase (inline)phases/03-test-coverage-analysis.md - Phase 3: Analyze existing test patterns and coverage (inline)phases/04-conflict-resolution.md - Phase 4: Detect and resolve conflicts (inline, conditional)memory-capture skill - Phase 4: Memory optimization (if context approaching limits)phases/05-tdd-task-generation.md - Phase 5: Generate TDD tasks with Red-Green-Refactor cycles (inline)Called by Verify Mode:
phases/07-tdd-verify.md - Phase 7: Test coverage and cycle analysis (inline)Follow-up Skills:
workflow-tdd-plan skill (tdd-verify phase) - Verify TDD compliance (can also invoke via verify mode)workflow-plan skill (plan-verify phase) - Verify plan quality and dependenciesSkill(skill="workflow-execute") - Begin TDD implementation</process>
<auto_mode> When workflowPreferences.autoYes is true (triggered by -y/--yes flag):
</auto_mode>
<success_criteria>
</success_criteria>
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-16 | pass→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-09 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-21 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-12 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-18 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-11 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-02 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-14 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-06 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-15 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-05 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-13 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-22 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-01 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-10 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-07 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-19 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-03 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-04 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-08 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-17 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-20 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted, and 17 counted toward the lift figure. The other 5 produced results that are not comparable between the two arms, so they are excluded from the headline rather than averaged into it. The headline lift of +64 percentage points is the difference between those two pass rates over the 17 comparable cases. 2 cases got worse with the skill loaded, and they are included in that figure.
The per-case answers from this run were removed by the retention sweep, so the case table below shows the verdicts without the text either arm produced. The counts above were recorded at the time and are unaffected. Answers are now kept for 180 days.
Other measured skills in the registry, with their headline benchmark lift.