Install any skill in seconds. Free to start, no credit card required.
Get Started Free →End-to-end test-fix workflow generate test sessions with progressive layers (L0-L3), then execute iterative fix cycles until pass rate >= 95%. Combines test-fix-gen and test-cycle-execute into a unified pipeline. Triggers on "workflow:test-fix-cycle".
.claude/skills/catlog22-workflow-test-fix-cycle/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-10 | ✗→✓ | ▲ Improved | 255% | 0% |
| case-07 | ✗→✓ | ▲ Improved | 310% | 0% |
| case-08 | ✗→✓ | ▲ Improved | 348% | 0% |
| case-11 | ✗→✓ | ▲ Improved | 563% | 0% |
| case-12 | ✗→✓ | ▲ Improved | 181% | 0% |
End-to-end test-fix workflow pipeline: generate test sessions with progressive layers (L0-L3), AI code validation, and task generation (Phase 1), then execute iterative fix cycles with adaptive strategy engine until pass rate >= 95% (Phase 2).
┌────────────────────────────────────────────────────────────────────────────┐
│ Workflow Test-Fix Cycle Orchestrator (SKILL.md) │
│ → Full pipeline: Test generation + Iterative execution │
│ → Phase dispatch: Read phase docs, execute, pass context │
└───────────────┬────────────────────────────────────────────────────────────┘
│
┌────────────┴────────────────────────┐
↓ ↓
┌─────────────────────────┐ ┌─────────────────────────────┐
│ Phase 1: Test-Fix Gen │ │ Phase 2: Test-Cycle Execute │
│ phases/01-test-fix-gen │ │ phases/02-test-cycle-execute │
│ 5 sub-phases: │ │ 3 stages: │
│ ① Create Session │ │ ① Discovery │
│ ② Gather Context │ │ ② Main Loop (iterate) │
│ ③ Test Analysis (Gemini)│ │ ③ Completion │
│ ④ Generate Tasks │ │ │
│ ⑤ Summary │ │ Agents (via spawn_agent): │
│ │ │ @cli-planning-agent │
│ Agents (via spawn_agent)│ │ @test-fix-agent │
│ @test-context-search │ │ │
│ @context-search │ │ Strategy: conservative → │
│ @cli-execution │ │ aggressive → surgical │
│ @action-planning │ │ │
└────────┬────────────────┘ └────────────┬──────────────────┘
↓ ↓
IMPL-001..002.json Pass Rate >= 95%
TEST_ANALYSIS_RESULTS.md Auto-complete session
Task Pipeline:
┌──────────────┐ ┌─────────────────┐ ┌─────────────────┐ ┌──────────────┐
│ 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 10 iter │
│@code-developer│ │ @test-fix-agent │ │ @test-fix-agent │ │@test-fix-agent│
└──────────────┘ └─────────────────┘ └─────────────────┘ └──────────────┘
│
Fix Loop: │
┌──────────────────┘
↓
┌──────────┐
│ @cli-plan│───→ IMPL-fix-N.json
│ agent │
├──────────┤
│@test-fix │───→ Apply & re-test
│ agent │
└──────────┘Phase 1 generates test session and tasks. Phase 2 executes iterative fix cycles until pass rate >= 95% or max iterations reached. Between Phase 1 and Phase 2, you MUST stop and wait for user confirmation before proceeding to execution. Phase 2 runs autonomously once approved.
Create a new subagent with task assignment.
javascriptconst agentId = spawn_agent({ agent_type: "{agent_type}", message: ` ## TASK ASSIGNMENT ### MANDATORY FIRST STEPS (Agent Execute) 1. Run: `ccw spec load --category "planning execution"` ## TASK CONTEXT ${taskContext} ## DELIVERABLES ${deliverables} ` })
Get results from subagent (only way to retrieve results).
javascriptconst result = wait_agent({ timeout_ms: 1800000 // 30 minutes }) if (result.timed_out) { followup_task({ target: agentId, message: "STATUS_CHECK: Report current progress, findings so far, and estimated remaining work." }) const status = wait_agent({ timeout_ms: 180000 }) // 3 min if (status.timed_out) { followup_task({ target: agentId, message: "FINALIZE: Output all current findings immediately. Time limit reached.", interrupt: true }) const forced = wait_agent({ timeout_ms: 180000 }) // 3 min if (forced.timed_out) { close_agent({ target: agentId }) } } }
Assign new work to active subagent (for clarification or follow-up).
javascriptfollowup_task({ target: agentId, message: ` ## CLARIFICATION ANSWERS ${answers} ## NEXT STEP Continue with plan generation. ` })
Clean up subagent resources (irreversible).
javascriptclose_agent({ target: agentId })
workflow-test-fix-cycle <input> [options]
# Input (Phase 1 - Test Generation)
source-session-id WFS-* session ID (Session Mode - test validation for completed implementation)
feature description Text description of what to test (Prompt Mode)
/path/to/file.md Path to requirements file (Prompt Mode)
# Options (Phase 2 - Cycle Execution)
--max-iterations=N Custom iteration limit (default: 10)
# Examples
workflow-test-fix-cycle WFS-user-auth-v2 # Session Mode
workflow-test-fix-cycle "Test the user authentication API endpoints in src/auth/api.ts" # Prompt Mode - text
workflow-test-fix-cycle ./docs/api-requirements.md # Prompt Mode - file
workflow-test-fix-cycle "Test user registration" --max-iterations=15 # With custom iterations
# Resume (Phase 2 only - session already created)
workflow-test-fix-cycle --resume-session="WFS-test-user-auth" # Resume interrupted sessionQuality Gate: Test pass rate >= 95% (criticality-aware) or 100% Max Iterations: 10 (default, adjustable) CLI Tools: Gemini → Qwen → Codex (fallback chain)
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) |
Key Features:
Detailed specifications: See the test-task-generate workflow tool for complete L0-L3 requirements and quality thresholds.
Input → Detect Mode (session | prompt | resume)
│
├─ resume mode → Skip to Phase 2
│
└─ session/prompt mode → Phase 1
│
Phase 1: Test-Fix Generation (phases/01-test-fix-gen.md)
├─ Sub-phase 1.1: Create Test Session → testSessionId
├─ Sub-phase 1.2: Gather Test Context (spawn_agent) → contextPath
├─ Sub-phase 1.3: Test Generation Analysis (spawn_agent → Gemini) → TEST_ANALYSIS_RESULTS.md
├─ Sub-phase 1.4: Generate Test Tasks (spawn_agent) → IMPL-*.json, IMPL_PLAN.md, TODO_LIST.md
└─ Sub-phase 1.5: Phase 1 Summary
│
⛔ MANDATORY CONFIRMATION GATE
│ Present plan summary → request_user_input → User approves/cancels
│ NEVER auto-proceed to Phase 2
│
Phase 2: Test-Cycle Execution (phases/02-test-cycle-execute.md)
├─ Discovery: Load session, tasks, iteration state
├─ Main Loop (for each task):
│ ├─ Execute → Test → Calculate pass_rate
│ ├─ 100% → SUCCESS: Next task
│ ├─ 95-99% + low criticality → PARTIAL SUCCESS: Approve
│ └─ <95% → Fix Loop:
│ ├─ Select strategy: conservative/aggressive/surgical
│ ├─ spawn_agent(@cli-planning-agent) → IMPL-fix-N.json
│ ├─ spawn_agent(@test-fix-agent) → Apply fix & re-test
│ └─ Re-test → Back to decision
└─ Completion: Final validation → Summary → Sync session state → Auto-complete sessionfunctions.update_plan initializationphases/01-*.md, phases/02-*.md)Read: phases/01-test-fix-gen.md
5 sub-phases that create a test session and generate task JSONs:
testSessionIdcontextPathTEST_ANALYSIS_RESULTS.mdIMPL-001.json, IMPL-001.3.json, IMPL-001.5.json, IMPL-002.json, IMPL_PLAN.md, TODO_LIST.mdAgents Used (via spawn_agent):
test_context_search_agent (agent_type: test_context_search_agent) - Context gathering (Session Mode)context_search_agent (agent_type: context_search_agent) - Context gathering (Prompt Mode)cli_execution_agent (agent_type: cli_execution_agent) - Test analysis with Geminiaction_planning_agent (agent_type: action_planning_agent) - Task JSON generationRead: phases/02-test-cycle-execute.md
3-stage iterative execution with adaptive strategy:
Agents Used (via spawn_agent):
cli_planning_agent (agent_type: cli_planning_agent) - Failure analysis, root cause extraction, fix task generationtest_fix_agent (agent_type: test_fix_agent) - Test execution, code fixes, criticality assignmentStrategy Engine: conservative (iteration 1-2) → aggressive (pass >80%) → surgical (regression)
{projectRoot}/.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 2)
├── .process/
│ ├── [test-]context-package.json # Context and coverage analysis
│ ├── TEST_ANALYSIS_RESULTS.md # Test requirements and strategy (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/javascript// Initialize progress tracking after input parsing functions.update_plan([ { id: "phase-1", title: "Phase 1: Test-Fix Generation", status: "in_progress" }, { id: "phase-2", title: "Phase 2: Test-Cycle Execution", status: "pending" } ])
javascript// After Phase 1 completes (before mandatory confirmation gate) functions.update_plan([ { id: "phase-1", status: "completed" }, { id: "phase-2", status: "in_progress" } ]) // After Phase 2 completes (pass rate >= 95% or max iterations) functions.update_plan([{ id: "phase-2", status: "completed" }])
javascript// When --resume-session skips Phase 1 functions.update_plan([ { id: "phase-1", title: "Phase 1: Test-Fix Generation", status: "completed" }, { id: "phase-2", title: "Phase 2: Test-Cycle Execution", status: "in_progress" } ])
| Phase | Scenario | Action | |-------|----------|--------| | 1.1 | Source session not found (session mode) | Return error with session ID | | 1.1 | No completed IMPL tasks (session mode) | Return error, source incomplete | | 1.2 | Context gathering failed | Return error, check source artifacts | | 1.2 | Agent timeout | Retry with extended timeout, close_agent, then return error | | 1.3 | Gemini analysis failed | Return error, check context package | | 1.4 | Task generation failed | Retry once, then return error | | 2 | Test execution error | Log, retry with error context | | 2 | CLI analysis failure | Fallback: Gemini → Qwen → Codex → manual | | 2 | Agent execution error | Save state, close_agent, retry with simplified context | | 2 | Max iterations reached | Generate failure report, mark blocked | | 2 | Regression detected | Rollback last fix, switch to surgical strategy | | 2 | Stuck tests detected | Continue with alternative strategy, document in failure report |
Lifecycle Error Handling:
javascripttry { const agentId = spawn_agent({ message: "..." }); const result = wait_agent({ timeout_ms: 1800000 }); // 30 minutes // ... process result ... close_agent({ target: agentId }); } catch (error) { if (agentId) close_agent({ target: agentId }); throw error; }
Phase 1 (Generation):
functions.update_plan with 2 top-level phasesphases/01-test-fix-gen.md for detailed sub-phase executionPhase 2 (Execution):
phases/02-test-cycle-execute.md for detailed execution logicfunctions.update_planResume Mode:
--resume-session provided, skip Phase 1Prerequisite Skills:
workflow-plan or workflow-execute - Complete implementation (Session Mode)Phase 1 Agents (used by phases/01-test-fix-gen.md via spawn_agent):
test_context_search_agent (agent_type: test_context_search_agent) - Test coverage analysis (Session Mode)context_search_agent (agent_type: context_search_agent) - Codebase analysis (Prompt Mode)cli_execution_agent (agent_type: cli_execution_agent) - Test requirements with Geminiaction_planning_agent (agent_type: action_planning_agent) - Task JSON generationPhase 2 Agents (used by phases/02-test-cycle-execute.md via spawn_agent):
cli_planning_agent (agent_type: cli_planning_agent) - CLI analysis, root cause extraction, task generationtest_fix_agent (agent_type: test_fix_agent) - Test execution, code fixes, criticality assignmentFollow-up:
$session-sync -y "Test-fix cycle complete: {pass_rate}% pass rate"| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-10 | fail→pass | 8,284 | 2,565 | -69% | 1 | 1 | 0% | 1,523 | 5,413 | +255% | 0 | 0 | — |
case-01 | fail→fail | 3,385 | 7,867 | +132% | 1 | 1 | 0% | 499 | 5,432 | +989% | 0 | 0 | — |
case-02 | fail→fail | 4,740 | 22,490 | +374% | 1 | 1 | 0% | 301 | 5,298 | +1660% | 0 | 0 | — |
case-03 | fail→fail | 5,439 | 5,710 | +5% | 1 | 1 | 0% | 908 | 5,178 | +470% | 0 | 0 | — |
case-04 | pass→fail | 17,512 | 9,458 | -46% | 1 | 1 | 0% | 3,642 | 5,543 | +52% | 0 | 0 | — |
case-05 | pass→fail | 8,545 | 10,170 | +19% | 1 | 1 | 0% | 1,922 | 5,310 | +176% | 0 | 0 | — |
case-06 | pass→pass | 8,804 | 13,008 | +48% | 1 | 1 | 0% | 1,129 | 7,498 | +564% | 0 | 0 | — |
case-07 | fail→pass | 8,154 | 4,809 | -41% | 1 | 1 | 0% | 1,393 | 5,715 | +310% | 0 | 0 | — |
case-08 | fail→pass | 17,857 | 1,868 | -90% | 1 | 1 | 0% | 1,151 | 5,159 | +348% | 0 | 0 | — |
case-09 | fail→fail | 5,458 | 2,883 | -47% | 1 | 1 | 0% | 930 | 5,414 | +482% | 0 | 0 | — |
case-11 | fail→pass | 5,489 | 5,885 | +7% | 1 | 1 | 0% | 916 | 6,071 | +563% | 0 | 0 | — |
case-12 | fail→pass | 10,895 | 2,320 | -79% | 1 | 1 | 0% | 1,852 | 5,197 | +181% | 0 | 0 | — |
case-13 | fail→pass | 10,181 | 8,078 | -21% | 1 | 1 | 0% | 1,779 | 6,201 | +249% | 0 | 0 | — |
case-14 | fail→pass | 9,354 | 2,541 | -73% | 1 | 1 | 0% | 1,688 | 5,314 | +215% | 0 | 0 | — |
case-15 | fail→pass | 6,263 | 1,935 | -69% | 1 | 1 | 0% | 946 | 5,229 | +453% | 0 | 0 | — |
case-16 | fail→pass | 8,640 | 4,794 | -45% | 1 | 1 | 0% | 1,511 | 5,764 | +281% | 0 | 0 | — |
case-17 | fail→pass | 16,058 | 1,830 | -89% | 1 | 1 | 0% | 1,440 | 5,166 | +259% | 0 | 0 | — |
case-18 | fail→pass | 13,942 | 1,984 | -86% | 1 | 1 | 0% | 2,382 | 5,117 | +115% | 0 | 0 | — |
case-19 | fail→pass | 10,215 | 6,400 | -37% | 1 | 1 | 0% | 1,734 | 5,831 | +236% | 0 | 0 | — |
case-20 | fail→pass | 8,345 | 2,781 | -67% | 1 | 1 | 0% | 1,480 | 5,396 | +265% | 0 | 0 | — |
case-21 | fail→pass | 7,623 | 2,821 | -63% | 1 | 1 | 0% | 1,354 | 5,371 | +297% | 0 | 0 | — |
case-22 | fail→fail | 10,717 | 2,646 | -75% | 1 | 1 | 0% | 1,352 | 5,381 | +298% | 0 | 0 | — |
case-23 | fail→fail | 8,402 | 4,324 | -49% | 1 | 1 | 0% | 1,089 | 5,304 | +387% | 0 | 0 | — |
case-24 | fail→pass | 13,489 | 3,103 | -77% | 1 | 1 | 0% | 1,560 | 5,388 | +245% | 0 | 0 | — |
case-25 | fail→pass | 7,045 | 2,638 | -63% | 1 | 1 | 0% | 1,060 | 5,331 | +403% | 0 | 0 | — |
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. 25 cases were attempted, and 20 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 +56 percentage points is the difference between those two pass rates over the 20 comparable cases. 3 cases got worse with the skill loaded, and they are included in that figure.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.