Unified test-fix pipeline combining test generation (session, context, analysis, task gen) with iterative test-cycle execution (adaptive strategy, progressive testing, CLI fallback). Triggers on "workflow-test-fix", "test fix workflow".
37
35%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Critical
Do not install without reviewing
Fix and improve this skill with Tessl
tessl review fix ./.claude/skills/workflow-test-fix/SKILL.md┌───────────────────────────────────────────────────────────────────────────┐
│ Workflow Test Fix Orchestrator (SKILL.md) │
│ → Pure coordinator: Route entry point, track progress, pass context │
│ → Five phases: Session → Context → Analysis → TaskGen → Execution │
└──────────────────────────────────┬────────────────────────────────────────┘
│
┌────────────┬────────────┬──────┴──────┬────────────┬────────────┐
↓ ↓ ↓ ↓ ↓
┌──────────┐┌──────────┐┌──────────┐┌──────────┐ ┌──────────────┐
│ Phase 1 ││ Phase 2 ││ Phase 3 ││ Phase 4 │ │ Phase 5 │
│ Session ││ Context ││ Analysis ││ Task Gen │ │ Test Cycle │
│ Start ││ Gather ││ Enhanced ││ Generate │ │ Execute │
│ ││ ││ ││ │ │ │
│ Input ││ Coverage ││ Gemini ││ IMPL_PLAN│ │ 1. Discovery│
│ Detect + ││ or Code ││ L0-L3 ││ IMPL-* │ │ 2. Execute │
│ Session ││ Scan ││ AI Issue ││ TODO_LIST│ │ 3. Fix Loop │
│ Create ││ ││ ││ │ │ 4. Complete │
└────┬─────┘└────┬─────┘└────┬─────┘└────┬─────┘ └──────────────┘
│ │ │ │ ↑
│testSessionId │ │ │
└──→────────┘contextPath│ │ │
└──→───────┘AnalysisRes│ │
└──→──────┘ testSessionId │
└──→──(Summary)──→┘
Task Pipeline (generated in Phase 4, executed in Phase 5):
┌──────────────┐ ┌─────────────────┐ ┌─────────────────┐ ┌──────────────┐
│ IMPL-001 │──→│ IMPL-001.3 │──→│ IMPL-001.5 │──→│ IMPL-002 │
│ Test Gen │ │ Code Validate │ │ Quality Gate │ │ Test & Fix │
│ L1-L3 │ │ L0 + AI Issues │ │ Coverage 80%+ │ │ Max N iter │
│@code-developer│ │ @test-fix-agent │ │ @test-fix-agent │ │@test-fix-agent│
└──────────────┘ └─────────────────┘ └─────────────────┘ └──────────────┘workflowPreferences.* for preferences, no CLI flag parsingFull pipeline and execute-only modes are triggered by skill name routing (see Mode Detection). Workflow preferences (auto mode) are collected interactively via AskUserQuestion before dispatching to phases.
Full pipeline (workflow-test-fix): Task description or session ID as arguments → interactive preference collection → generate + execute pipeline Execute only (workflow-test-fix): Auto-discovers active session → interactive preference collection → execution loop
Before dispatching to phase execution, collect workflow preferences via AskUserQuestion:
// ★ 统一 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.
Multi-phase test-fix pipeline (Phase 1-5) spans long conversations, especially Phase 5 fix loops. Uses 双重保险: TodoWrite 跟踪 active phase 保护其不被压缩,sentinel 作为兜底。
⚠️ COMPACT DIRECTIVE: Context compression MUST check TodoWrite phase status. The phase currently marked
in_progressis the active execution phase — preserve its FULL content. Only compress phases markedcompletedorpending.
Entry Point Detection:
├─ /workflow-test-fix → Full Pipeline (Phase 1→2→3→4→Summary→5)
└─ /workflow-test-fix → Execution Only (Phase 5)
Phase 1: Session Start (session-start)
└─ Read("phases/01-session-start.md")
├─ Step 1.0: Detect input mode (session | prompt)
├─ Step 1.1: Create test session → testSessionId
└─ Output: testSessionId, MODE
Phase 2: Test Context Gather (test-context-gather)
└─ Read("phases/02-test-context-gather.md")
├─ Step 1.2: Gather test context → contextPath
└─ Output: contextPath
Phase 3: Test Concept Enhanced (test-concept-enhanced)
└─ Read("phases/03-test-concept-enhanced.md")
├─ Step 1.3: Test analysis (Gemini) → TEST_ANALYSIS_RESULTS.md
└─ Output: TEST_ANALYSIS_RESULTS.md
Phase 4: Test Task Generate (test-task-generate)
└─ Read("phases/04-test-task-generate.md")
├─ Step 1.4: Generate test tasks → IMPL_PLAN.md, IMPL-*.json, TODO_LIST.md
└─ Output: testSessionId, 4+ task JSONs
Summary Output (inline after Phase 4):
└─ Display summary, auto-continue to Phase 5
Phase 5: Test Cycle Execution (test-cycle-execute)
└─ Read("phases/05-test-cycle-execute.md")
├─ Step 2.1: Discovery (load session, tasks, iteration state)
├─ Step 2.2: Execute initial tasks (IMPL-001 → 001.3 → 001.5 → 002)
├─ Step 2.3: Fix loop (if pass_rate < 95%)
│ ├─ Select strategy: conservative/aggressive/surgical
│ ├─ Generate fix task via @cli-planning-agent
│ ├─ Execute fix via @test-fix-agent
│ └─ Re-test → loop or exit
└─ Step 2.4: Completion (summary, session archive)
└─ Output: final pass_rate, summaryPhase Reference Documents (read on-demand when phase executes):
| Phase | Document | Purpose | Compact |
|---|---|---|---|
| 1 | phases/01-session-start.md | Detect input mode, create test session | TodoWrite 驱动 |
| 2 | phases/02-test-context-gather.md | Gather test context (coverage/codebase) | TodoWrite 驱动 |
| 3 | phases/03-test-concept-enhanced.md | Gemini analysis, L0-L3 test requirements | TodoWrite 驱动 |
| 4 | phases/04-test-task-generate.md | Generate task JSONs and IMPL_PLAN.md | TodoWrite 驱动 |
| 5 | phases/05-test-cycle-execute.md | Execute tasks, iterative fix cycles, completion | TodoWrite 驱动 + 🔄 sentinel |
Compact Rules:
in_progress → 保留完整内容,禁止压缩completed → 可压缩为摘要Read("phases/05-test-cycle-execute.md") 恢复workflow-test-fix skill → Phase 1-5; workflow-test-fix skill → Phase 5 onlyUser input → Detect type:
├─ Starts with "WFS-" → MODE=session, sourceSessionId=input
├─ Ends with ".md" → MODE=prompt, description=Read(input)
└─ Otherwise → MODE=prompt, description=inputArguments → Parse flags:
├─ --resume-session="WFS-xxx" → sessionId=WFS-xxx
├─ --max-iterations=N → maxIterations=N (default: 10)
└─ (no args) → auto-discover active test sessionUser Input (session ID | description | file path)
↓
[Detect Mode: session | prompt]
↓
Phase 1: Session Start ─────────────────────────────────────────
↓ 1.0+1.1: session:start → testSessionId, MODE
↓
Phase 2: Test Context Gather ────────────────────────────────────
↓ 1.2: test-context-gather/context-gather → contextPath
↓
Phase 3: Test Concept Enhanced ──────────────────────────────────
↓ 1.3: test-concept-enhanced → TEST_ANALYSIS_RESULTS.md
↓
Phase 4: Test Task Generate ─────────────────────────────────────
↓ 1.4: test-task-generate → IMPL_PLAN.md, IMPL-*.json, TODO_LIST.md
↓
Summary Output (inline) ─────────────────────────────────────────
↓ Display summary with next step
↓
Phase 5: Test Cycle Execution ───────────────────────────────────
↓ 2.1: Load session + tasks + iteration state
↓ 2.2: Execute IMPL-001 → 001.3 → 001.5 → 002
↓ 2.3: Fix loop (analyze → fix → retest) until pass_rate >= 95%
↓ 2.4: Completion → summary → session archiveAfter Phase 4 completes, display the following summary before auto-continuing to Phase 5:
Test-fix workflow created successfully!
Input: [original input]
Mode: [Session|Prompt]
Test Session: [testSessionId]
Tasks Created:
- IMPL-001: Test Understanding & Generation (@code-developer)
- IMPL-001.3: Code Validation Gate - AI Error Detection (@test-fix-agent)
- IMPL-001.5: Test Quality Gate - Static Analysis & Coverage (@test-fix-agent)
- IMPL-002: Test Execution & Fix Cycle (@test-fix-agent)
Quality Thresholds:
- Code Validation: Zero CRITICAL issues, zero compilation errors
- Minimum Coverage: 80% line, 70% branch
- Static Analysis: Zero critical anti-patterns
- Max Fix Iterations: 5
Review artifacts:
- Test plan: .workflow/[testSessionId]/IMPL_PLAN.md
- Task list: .workflow/[testSessionId]/TODO_LIST.md
- Analysis: .workflow/[testSessionId]/.process/TEST_ANALYSIS_RESULTS.mdCRITICAL - Next Step: Auto-continue to Phase 5: Test Cycle Execution.
Pass testSessionId to Phase 5 for test execution pipeline. Do NOT wait for user confirmation — the unified pipeline continues automatically.
Progressive Test Layers (L0-L3):
| Layer | Name | Focus |
|---|---|---|
| L0 | Static Analysis | Compilation, imports, types, AI code issues |
| L1 | Unit Tests | Function/class behavior (happy/negative/edge cases) |
| L2 | Integration Tests | Component interactions, API contracts, failure modes |
| L3 | E2E Tests | User journeys, critical paths (optional) |
Quality Thresholds:
| Strategy | Trigger | Behavior |
|---|---|---|
| Conservative | Iteration 1-2 (default) | Single targeted fix, full validation |
| Aggressive | Pass rate >80% + similar failures | Batch fix related issues |
| Surgical | Regression detected (pass rate drops >10%) | Minimal changes, rollback focus |
Selection logic and CLI fallback chain (Gemini → Qwen → Codex) are detailed in Phase 5.
| Agent | Used In | Responsibility |
|---|---|---|
| Orchestrator | All phases | Route entry, track progress, pass context |
| @code-developer | Phase 5 (IMPL-001) | Test generation (L1-L3) |
| @test-fix-agent | Phase 5 | Test execution, code fixes, criticality assignment |
| @cli-planning-agent | Phase 5 (fix loop) | CLI analysis, root cause extraction, fix task generation |
Core Concept: Dynamic task tracking with attachment/collapse for real-time visibility.
Implementation Note: Phase files use
TodoWritesyntax to describe the conceptual tracking pattern. At runtime, these are implemented viaTaskCreate/TaskUpdate/TaskListtools from the allowed-tools list. MapTodoWriteexamples as follows:
- Initial list creation →
TaskCreatefor 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
[
{"content": "Phase 1: Session Start", "status": "in_progress"},
{"content": "Phase 2: Test Context Gather", "status": "pending"},
{"content": "Phase 3: Test Analysis (Gemini)", "status": "pending"},
{"content": "Phase 4: Test Task Generate", "status": "pending"},
{"content": "Phase 5: Test Cycle Execution", "status": "pending"}
][
{"content": "Phase 1: Session Start", "status": "completed"},
{"content": "Phase 2: Test Context Gather", "status": "completed"},
{"content": "Phase 3: Test Analysis (Gemini)", "status": "completed"},
{"content": "Phase 4: Test Task Generate", "status": "completed"},
{"content": "Phase 5: Test Cycle Execution", "status": "in_progress"},
{"content": " → Execute IMPL-001 [code-developer]", "status": "in_progress"},
{"content": " → Execute IMPL-001.3 [test-fix-agent]", "status": "pending"},
{"content": " → Execute IMPL-001.5 [test-fix-agent]", "status": "pending"},
{"content": " → Execute IMPL-002 [test-fix-agent]", "status": "pending"},
{"content": " → Fix Loop", "status": "pending"}
][
{"content": "Phase 1-4: Test Generation", "status": "completed"},
{"content": "Phase 5: Test Cycle Execution", "status": "in_progress"},
{"content": " → Initial tasks", "status": "completed"},
{"content": " → Iteration 1: Initial test (pass: 70%, conservative)", "status": "completed"},
{"content": " → Iteration 2: Fix validation (pass: 82%, conservative)", "status": "completed"},
{"content": " → Iteration 3: Batch fix (pass: 89%, aggressive)", "status": "in_progress"}
].workflow/active/WFS-test-{session}/
├── workflow-session.json # Session metadata
├── IMPL_PLAN.md # Test generation and execution strategy
├── TODO_LIST.md # Task checklist
├── .task/
│ ├── IMPL-001.json # Test understanding & generation
│ ├── IMPL-001.3-validation.json # Code validation gate
│ ├── IMPL-001.5-review.json # Test quality gate
│ ├── IMPL-002.json # Test execution & fix cycle
│ └── IMPL-fix-{N}.json # Generated fix tasks (Phase 5 fix loop)
├── .process/
│ ├── [test-]context-package.json # Context and coverage analysis
│ ├── TEST_ANALYSIS_RESULTS.md # Test requirements (L0-L3)
│ ├── iteration-state.json # Current iteration + strategy + stuck tests
│ ├── test-results.json # Latest results (pass_rate, criticality)
│ ├── test-output.log # Full test output
│ ├── fix-history.json # All fix attempts
│ ├── iteration-{N}-analysis.md # CLI analysis report
│ └── iteration-{N}-cli-output.txt
└── .summaries/
└── iteration-summaries/| Phase | Error Condition | Action |
|---|---|---|
| 1: Session Start | Source session not found (session mode) | Return error with session ID |
| 1: Session Start | No completed IMPL tasks (session mode) | Return error, source incomplete |
| 2: Context Gather | Context gathering failed | Return error, check source artifacts |
| 3: Analysis | Gemini analysis failed | Return error, check context package |
| 4: Task Gen | Task generation failed | Retry once, then return error |
| Scenario | Action |
|---|---|
| Test execution error | Log, retry with error context |
| CLI analysis failure | Fallback: Gemini → Qwen → Codex → manual |
| Agent execution error | Save state, retry with simplified context |
| Max iterations reached | Generate failure report, mark blocked |
| Regression detected | Rollback last fix, switch to surgical strategy |
| Stuck tests detected | Continue with alternative strategy, document |
Automatic commits at key checkpoints:
test-cycle: iteration N - strategy (pass: old% → new%)test-cycle: rollback iteration N - regression detected| Condition | Pass Rate | Action |
|---|---|---|
| Full Success | 100% | Auto-complete session |
| Partial Success | >= 95%, all failures low criticality | Auto-approve with review note |
| Failure | < 95% after max iterations | Failure report, mark blocked |
Auto-sync: Execute /workflow:session:sync -y "{summary}" to update specs/*.md + project-tech.
After completion, ask user if they want to expand into issues (test/enhance/refactor/doc). Selected items call /issue:new "{summary} - {dimension}".
Prerequisite Skills:
workflow-plan skill or workflow-execute skill - Complete implementation (Session Mode source)Follow-up Skills:
review-cycle skill - Post-implementation review/issue:new - Create follow-up issues<auto_mode>
When -y or --yes is detected in $ARGUMENTS or propagated via ccw:
workflowPreferences = { autoYes: true })<success_criteria>
07491b0
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.