
Team Quality Assurance
- 66 installs
- 2.1k repo stars
- Updated June 18, 2026
- catlog22/claude-code-workflow
Review code and ensure quality standards
About
Automates code review and quality checks for team-quality-assurance. Teams use this to enforce standards and catch issues early.
- Code quality
- Automated review
Team Quality Assurance by the numbers
- 66 all-time installs (skills.sh)
- Ranked #528 of 1,352 Code Review & Quality skills by installs in the Skillselion catalog
- Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/catlog22/claude-code-workflow --skill team-quality-assuranceAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 66 |
|---|---|
| repo stars | ★ 2.1k |
| Last updated | June 18, 2026 |
| Repository | catlog22/claude-code-workflow ↗ |
What it does
Review code and ensure quality standards
Files
Team Quality Assurance
Orchestrate multi-agent QA: scout -> strategist -> generator -> executor -> analyst. Supports discovery, testing, and full closed-loop modes with parallel generation and GC loops.
Architecture
Skill(skill="team-quality-assurance", args="task description")
|
SKILL.md (this file) = Router
|
+--------------+--------------+
| |
no --role flag --role <name>
| |
Coordinator Worker
roles/coordinator/role.md roles/<name>/role.md
|
+-- analyze -> dispatch -> spawn workers -> STOP
|
+-------+-------+-------+-------+-------+
v v v v v
[scout] [strat] [gen] [exec] [analyst]
team-worker agents, each loads roles/<role>/role.mdRole Registry
| Role | Path | Prefix | Inner Loop |
|---|---|---|---|
| coordinator | roles/coordinator/role.md | — | — |
| scout | roles/scout/role.md | SCOUT-* | false |
| strategist | roles/strategist/role.md | QASTRAT-* | false |
| generator | roles/generator/role.md | QAGEN-* | false |
| executor | roles/executor/role.md | QARUN-* | dynamic |
| analyst | roles/analyst/role.md | QAANA-* | false |
Role Router
Parse $ARGUMENTS:
- Has
--role <name>-> Readroles/<name>/role.md, execute Phase 2-4 - No
--role->@roles/coordinator/role.md, execute entry router
Shared Constants
- Session prefix:
QA - Session path:
.workflow/.team/QA-<slug>-<date>/ - Team name:
quality-assurance - CLI tools:
ccw cli --mode analysis(read-only),ccw cli --mode write(modifications) - Message bus:
mcp__ccw-tools__team_msg(session_id=<session-id>, ...)
Worker Spawn Template
Coordinator spawns workers using this template:
Agent({
subagent_type: "team-worker",
description: "Spawn <role> worker",
team_name: "quality-assurance",
name: "<role>",
run_in_background: true,
prompt: `## Role Assignment
role: <role>
role_spec: <skill_root>/roles/<role>/role.md
session: <session-folder>
session_id: <session-id>
team_name: quality-assurance
requirement: <task-description>
inner_loop: <true|false>
## Progress Milestones
session_id: <session-id>
Report progress via team_msg at natural phase boundaries (context loaded -> core work done -> verification).
Report blockers immediately via team_msg type="blocker".
Report completion via team_msg type="task_complete" after final SendMessage.
Read role_spec file (@<skill_root>/roles/<role>/role.md) to load Phase 2-4 domain instructions.
Execute built-in Phase 1 (task discovery) -> role Phase 2-4 -> built-in Phase 5 (report).`
})User Commands
| Command | Action |
|---|---|
check / status | View pipeline status graph |
resume / continue | Advance to next step |
--mode=discovery | Force discovery mode |
--mode=testing | Force testing mode |
--mode=full | Force full QA mode |
Completion Action
When pipeline completes, coordinator presents:
AskUserQuestion({
questions: [{
question: "Quality Assurance pipeline complete. What would you like to do?",
header: "Completion",
multiSelect: false,
options: [
{ label: "Archive & Clean (Recommended)", description: "Archive session, clean up team" },
{ label: "Keep Active", description: "Keep session for follow-up work" },
{ label: "Export Results", description: "Export deliverables to target directory" }
]
}]
})Session Directory
.workflow/.team/QA-<slug>-<date>/
├── .msg/messages.jsonl # Team message bus
├── .msg/meta.json # Session state + shared memory
├── wisdom/ # Cross-task knowledge
├── scan/ # Scout output
├── strategy/ # Strategist output
├── tests/ # Generator output (L1/, L2/, L3/)
├── results/ # Executor output
└── analysis/ # Analyst outputSpecs Reference
- specs/pipelines.md — Pipeline definitions and task registry
- specs/team-config.json — Team configuration and shared memory schema
Error Handling
| Scenario | Resolution |
|---|---|
| Unknown --role value | Error with available role list |
| Role not found | Error with expected path (roles/<name>/role.md) |
| CLI tool fails | Worker fallback to direct implementation |
| Scout finds no issues | Report clean scan, skip to testing mode |
| GC loop exceeded | Accept current coverage with warning |
| Fast-advance conflict | Coordinator reconciles on next callback |
| Completion action fails | Default to Keep Active |
Quality Analyst
Analyze defect patterns, coverage gaps, test effectiveness, and generate comprehensive quality reports. Maintain defect pattern database and provide quality scoring.
Phase 2: Context Loading
| Input | Source | Required |
|---|---|---|
| Task description | From task subject/description | Yes |
| Session path | Extracted from task description | Yes |
| .msg/meta.json | <session>/wisdom/.msg/meta.json | Yes |
| Discovered issues | meta.json -> discovered_issues | No |
| Test strategy | meta.json -> test_strategy | No |
| Generated tests | meta.json -> generated_tests | No |
| Execution results | meta.json -> execution_results | No |
| Historical patterns | meta.json -> defect_patterns | No |
1. Extract session path from task description 2. Read .msg/meta.json for all accumulated QA data 3. Read coverage data from coverage/coverage-summary.json if available 4. Read layer execution results from <session>/results/run-*.json 5. Select analysis mode:
| Data Points | Mode |
|---|---|
| <= 5 issues + results | Direct inline analysis |
| > 5 | CLI-assisted deep analysis via gemini |
Phase 3: Multi-Dimensional Analysis
Five analysis dimensions:
1. Defect Pattern Analysis: Group issues by type/perspective, identify patterns with >= 2 occurrences, record type/count/files/description 2. Coverage Gap Analysis: Compare actual coverage vs layer targets, identify per-file gaps (< 50% coverage), severity: critical (< 20%) / high (< 50%) 3. Test Effectiveness: Per layer -- files generated, pass rate, iterations needed, coverage achieved. Effective = pass_rate >= 95% AND iterations <= 2 4. Quality Trend: Compare against coverage_history. Trend: improving (delta > 5%), declining (delta < -5%), stable 5. Quality Score (0-100 starting from 100):
| Factor | Impact |
|---|---|
| Security issues | -10 per issue |
| Bug issues | -5 per issue |
| Coverage gap | -0.5 per gap percentage |
| Test failures | -(100 - pass_rate) * 0.3 per layer |
| Effective test layers | +5 per layer |
| Improving trend | +3 |
For CLI-assisted mode:
PURPOSE: Deep quality analysis on QA results to identify defect patterns and improvement opportunities
TASK: Classify defects by root cause, identify high-density files, analyze coverage gaps vs risk, generate recommendations
MODE: analysisPhase 4: Report Generation & Output
1. Generate quality report markdown with: score, defect patterns, coverage analysis, test effectiveness, quality trend, recommendations 2. Write report to <session>/analysis/quality-report.md 3. Update <session>/wisdom/.msg/meta.json:
defect_patterns: identified patterns arrayquality_score: calculated scorecoverage_history: append new data point (date, coverage, quality_score, issues)
Score-based recommendations:
| Score | Recommendation |
|---|---|
| >= 80 | Quality is GOOD. Maintain current testing practices. |
| 60-79 | Quality needs IMPROVEMENT. Focus on coverage gaps and recurring patterns. |
| < 60 | Quality is CONCERNING. Recommend comprehensive review and testing effort. |
Analyze Task
Parse user task -> detect QA capabilities -> build dependency graph -> design roles.
CONSTRAINT: Text-level analysis only. NO source code reading, NO codebase exploration.
Signal Detection
| Keywords | Capability | Prefix |
|---|---|---|
| scan, discover, find issues, audit | scout | SCOUT |
| strategy, plan, test layers, coverage | strategist | QASTRAT |
| generate tests, write tests, create tests | generator | QAGEN |
| run tests, execute, fix tests | executor | QARUN |
| analyze, report, quality score | analyst | QAANA |
QA Mode Detection
| Condition | Mode |
|---|---|
| Keywords: discovery, scan, issues, bug-finding | discovery |
| Keywords: test, coverage, TDD, unit, integration | testing |
| Both keyword types OR no clear match | full |
Dependency Graph
Natural ordering tiers for QA pipeline:
- Tier 0: scout (issue discovery)
- Tier 1: strategist (strategy requires scout discoveries)
- Tier 2: generator (generation requires strategy)
- Tier 3: executor (execution requires generated tests)
- Tier 4: analyst (analysis requires execution results)
Pipeline Definitions
Discovery Mode: SCOUT -> QASTRAT -> QAGEN(L1) -> QARUN(L1) -> QAANA
Testing Mode: QASTRAT -> QAGEN(L1) -> QARUN(L1) -> QAGEN(L2) -> QARUN(L2) -> QAANA
Full Mode: SCOUT -> QASTRAT -> [QAGEN(L1) || QAGEN(L2)] -> [QARUN(L1) || QARUN(L2)] -> QAANA -> SCOUT(regression)Complexity Scoring
| Factor | Points |
|---|---|
| Per capability | +1 |
| Cross-domain (test + discovery) | +2 |
| Parallel tracks | +1 per track |
| Serial depth > 3 | +1 |
Results: 1-3 Low, 4-6 Medium, 7+ High
Role Minimization
- Cap at 6 roles (coordinator + 5 workers)
- Merge overlapping capabilities
- Absorb trivial single-step roles
Output
Write <session>/task-analysis.json:
{
"task_description": "<original>",
"pipeline_mode": "<discovery|testing|full>",
"capabilities": [{ "name": "<cap>", "prefix": "<PREFIX>", "keywords": ["..."] }],
"dependency_graph": { "<TASK-ID>": { "role": "<role>", "addBlockedBy": ["..."], "priority": "P0|P1|P2" } },
"roles": [{ "name": "<role>", "prefix": "<PREFIX>", "inner_loop": false }],
"complexity": { "score": 0, "level": "Low|Medium|High" },
"gc_loop_enabled": true
}Dispatch Tasks
Create task chains from dependency graph with proper addBlockedBy relationships.
Workflow
1. Read task-analysis.json -> extract pipeline_mode and dependency_graph 2. Read specs/pipelines.md -> get task registry for selected pipeline 3. Topological sort tasks (respect addBlockedBy) 4. Validate all owners exist in role registry (SKILL.md) 5. For each task (in order):
- TaskCreate with structured description (see template below)
- TaskUpdate with addBlockedBy + owner assignment
6. Update session.json with pipeline.tasks_total 7. Validate chain (no orphans, no cycles, all refs valid)
Task Description Template
PURPOSE: <goal> | Success: <criteria>
TASK:
- <step 1>
- <step 2>
CONTEXT:
- Session: <session-folder>
- Layer: <L1-unit|L2-integration|L3-e2e> (if applicable)
- Upstream artifacts: <list>
- Shared memory: <session>/wisdom/.msg/meta.json
EXPECTED: <artifact path> + <quality criteria>
CONSTRAINTS: <scope limits>
---
InnerLoop: <true|false>
RoleSpec: ~ or <project>/.claude/skills/team-quality-assurance/roles/<role>/role.mdPipeline Task Registry
Discovery Mode
SCOUT-001 (scout): Multi-perspective issue scanning
addBlockedBy: []
QASTRAT-001 (strategist): Test strategy formulation
addBlockedBy: [SCOUT-001]
QAGEN-001 (generator): L1 unit test generation
addBlockedBy: [QASTRAT-001], meta: layer=L1
QARUN-001 (executor): L1 test execution + fix cycles
addBlockedBy: [QAGEN-001], inner_loop: true, meta: layer=L1
QAANA-001 (analyst): Quality analysis report
addBlockedBy: [QARUN-001]Testing Mode
QASTRAT-001 (strategist): Test strategy formulation
addBlockedBy: []
QAGEN-L1-001 (generator): L1 unit test generation
addBlockedBy: [QASTRAT-001], meta: layer=L1
QARUN-L1-001 (executor): L1 test execution + fix cycles
addBlockedBy: [QAGEN-L1-001], inner_loop: true, meta: layer=L1
QAGEN-L2-001 (generator): L2 integration test generation
addBlockedBy: [QARUN-L1-001], meta: layer=L2
QARUN-L2-001 (executor): L2 test execution + fix cycles
addBlockedBy: [QAGEN-L2-001], inner_loop: true, meta: layer=L2
QAANA-001 (analyst): Quality analysis report
addBlockedBy: [QARUN-L2-001]Full Mode
SCOUT-001 (scout): Multi-perspective issue scanning
addBlockedBy: []
QASTRAT-001 (strategist): Test strategy formulation
addBlockedBy: [SCOUT-001]
QAGEN-L1-001 (generator-1): L1 unit test generation
addBlockedBy: [QASTRAT-001], meta: layer=L1
QAGEN-L2-001 (generator-2): L2 integration test generation
addBlockedBy: [QASTRAT-001], meta: layer=L2
QARUN-L1-001 (executor-1): L1 test execution + fix cycles
addBlockedBy: [QAGEN-L1-001], inner_loop: true, meta: layer=L1
QARUN-L2-001 (executor-2): L2 test execution + fix cycles
addBlockedBy: [QAGEN-L2-001], inner_loop: true, meta: layer=L2
QAANA-001 (analyst): Quality analysis report
addBlockedBy: [QARUN-L1-001, QARUN-L2-001]
SCOUT-002 (scout): Regression scan after fixes
addBlockedBy: [QAANA-001]InnerLoop Flag Rules
- executor: dynamic per pipeline mode:
- Discovery/Testing:
true(serial layer chain, single executor handles GC loops) - Full:
falsefor parallel QARUN tasks (QARUN-L1-001 and QARUN-L2-001 have independent blockedBy, each gets own worker) - scout, strategist, generator, analyst: always false
Dependency Validation
- No orphan tasks (all tasks have valid owner)
- No circular dependencies
- All addBlockedBy references exist
- Session reference in every task description
- RoleSpec reference in every task description
Log After Creation
mcp__ccw-tools__team_msg({
operation: "log",
session_id: <session-id>,
from: "coordinator",
type: "pipeline_selected",
data: { pipeline: "<mode>", task_count: <N> }
})Monitor Pipeline
Event-driven pipeline coordination. Beat model: coordinator wake -> process -> spawn -> STOP.
Constants
- SPAWN_MODE: background
- ONE_STEP_PER_INVOCATION: true
- FAST_ADVANCE_AWARE: true
- WORKER_AGENT: team-worker
- MAX_GC_ROUNDS: 3
Handler Router
| Source | Handler |
|---|---|
| Message contains [scout], [strategist], [generator], [executor], [analyst] | handleCallback |
| "capability_gap" | handleAdapt |
| "check" or "status" | handleCheck |
| "resume" or "continue" | handleResume |
| All tasks completed | handleComplete |
| Default | handleSpawnNext |
handleCallback
Worker completed. Process and advance.
1. Parse message to identify role and task ID:
| Message Pattern | Role Detection |
|---|---|
[scout] or task ID SCOUT-* | scout |
[strategist] or task ID QASTRAT-* | strategist |
[generator] or task ID QAGEN-* | generator |
[executor] or task ID QARUN-* | executor |
[analyst] or task ID QAANA-* | analyst |
2. Check if progress update (inner loop) or final completion 3. Progress -> update session state, STOP 4. Completion -> mark task done via TaskUpdate(status="completed"), remove from active_workers 5. Check for checkpoints:
- QARUN-* completes -> read meta.json for coverage:
- coverage >= target OR gc_rounds >= MAX_GC_ROUNDS -> proceed to handleSpawnNext
- coverage < target AND gc_rounds < MAX_GC_ROUNDS -> create GC fix tasks, increment gc_rounds
GC Fix Task Creation (when coverage below target):
TaskCreate({
subject: "QAGEN-fix-<round>: Fix tests for <layer> (GC #<round>)",
description: "PURPOSE: Fix failing tests and improve coverage | Success: Coverage meets target
TASK:
- Load execution results and failing test details
- Fix broken tests and add missing coverage
CONTEXT:
- Session: <session-folder>
- Layer: <layer>
- Previous results: <session>/results/run-<layer>.json
EXPECTED: Fixed test files | Improved coverage
CONSTRAINTS: Only modify test files | No source changes
---
InnerLoop: false
RoleSpec: ~ or <project>/.claude/skills/team-quality-assurance/roles/generator/role.md"
})
TaskCreate({
subject: "QARUN-gc-<round>: Re-execute <layer> (GC #<round>)",
description: "PURPOSE: Re-execute tests after fixes | Success: Coverage >= target
TASK: Execute test suite, measure coverage, report results
CONTEXT:
- Session: <session-folder>
- Layer: <layer>
EXPECTED: <session>/results/run-<layer>-gc-<round>.json
CONSTRAINTS: Read-only execution
---
InnerLoop: false
RoleSpec: ~ or <project>/.claude/skills/team-quality-assurance/roles/executor/role.md"
})
TaskUpdate({ taskId: "QARUN-gc-<round>", addBlockedBy: ["QAGEN-fix-<round>"] })6. -> handleSpawnNext
handleCheck
Read-only status report, then STOP.
Worker Progress (from message bus):
Before generating status output, read worker milestones:
const progressMsgs = mcp__ccw-tools__team_msg({
operation: "list", session_id: sessionId, type: "progress", last: 50
})
const blockerMsgs = mcp__ccw-tools__team_msg({
operation: "list", session_id: sessionId, type: "blocker", last: 10
})
// Aggregate latest milestone per task
const taskProgress = {}
for (const msg of (progressMsgs.result?.messages || [])) {
const tid = msg.data?.task_id
if (tid && (!taskProgress[tid] || msg.ts > taskProgress[tid].ts)) {
taskProgress[tid] = { phase: msg.data.phase, pct: msg.data.progress_pct, ts: msg.ts }
}
}Include in status output:
- Per-worker latest milestone (phase + progress_pct) next to task status
- Active blockers section (if any blockerMsgs found)
Output:
[coordinator] QA Pipeline Status
[coordinator] Mode: <pipeline_mode>
[coordinator] Progress: <done>/<total> (<pct>%)
[coordinator] GC Rounds: <gc_rounds>/3
[coordinator] Pipeline Graph:
SCOUT-001: <done|run|wait> <summary>
QASTRAT-001: <done|run|wait> <summary>
QAGEN-001: <done|run|wait> <summary>
QARUN-001: <done|run|wait> <summary>
QAANA-001: <done|run|wait> <summary>
[coordinator] Active Workers: <list with elapsed time>
[coordinator] Ready: <pending tasks with resolved deps>
[coordinator] Commands: 'resume' to advance | 'check' to refreshThen STOP.
handleResume
1. No active workers -> handleSpawnNext 2. Has active -> check each status
- completed -> mark done via TaskUpdate
- in_progress -> still running
3. Some completed -> handleSpawnNext 4. All running -> report status, STOP
handleSpawnNext
Find ready tasks, spawn workers, STOP.
1. Collect from TaskList():
- completedSubjects: status = completed
- inProgressSubjects: status = in_progress
- readySubjects: status = pending AND all blockedBy in completedSubjects
2. No ready + work in progress -> report waiting, STOP 3. No ready + nothing in progress -> handleComplete 4. Has ready -> for each: a. Determine role from task prefix:
| Prefix | Role | inner_loop |
|---|---|---|
| SCOUT-* | scout | false |
| QASTRAT-* | strategist | false |
| QAGEN-* | generator | false |
| QARUN-* | executor | dynamic |
| QAANA-* | analyst | false |
b. Check inner_loop: parse task description InnerLoop: field (NOT role.md default)
- InnerLoop: true AND same-role worker already active -> skip (worker picks up next task)
- InnerLoop: false OR no active same-role worker -> spawn new worker
c. TaskUpdate -> in_progress d. team_msg log -> task_unblocked e. Spawn team-worker:
Agent({
subagent_type: "team-worker",
description: "Spawn <role> worker for <subject>",
team_name: "quality-assurance",
name: "<role>",
run_in_background: true,
prompt: `## Role Assignment
role: <role>
role_spec: ~ or <project>/.claude/skills/team-quality-assurance/roles/<role>/role.md
session: <session-folder>
session_id: <session-id>
team_name: quality-assurance
requirement: <task-description>
inner_loop: <true|false>
## Current Task
- Task ID: <task-id>
- Task: <subject>
## Progress Milestones
session_id: <session-id>
Report progress via team_msg at natural phase boundaries (context loaded -> core work done -> verification).
Report blockers immediately via team_msg type="blocker".
Report completion via team_msg type="task_complete" after final SendMessage.
Read role_spec file to load Phase 2-4 domain instructions.
Execute built-in Phase 1 (task discovery) -> role Phase 2-4 -> built-in Phase 5 (report).`
})f. Add to active_workers 5. Update session, output summary, STOP
handleComplete
Pipeline done. Generate report and completion action.
1. Verify all tasks (including GC fix/recheck tasks) have status "completed" or "deleted" 2. If any tasks incomplete -> return to handleSpawnNext 3. If all complete:
- Read final state from meta.json (quality_score, coverage, gc_rounds)
- Generate summary (deliverables, stats, discussions)
4. Read session.completion_action:
- interactive -> AskUserQuestion (Archive/Keep/Export)
- auto_archive -> Archive & Clean (status=completed, TeamDelete)
- auto_keep -> Keep Active (status=paused)
handleAdapt
Capability gap reported mid-pipeline.
1. Parse gap description 2. Check if existing role covers it -> redirect 3. Role count < 6 -> generate dynamic role-spec in <session>/role-specs/ 4. Create new task, spawn worker 5. Role count >= 6 -> merge or pause
Fast-Advance Reconciliation
On every coordinator wake: 1. Read team_msg entries with type="fast_advance" 2. Sync active_workers with spawned successors 3. No duplicate spawns
Phase 4: State Persistence
After every handler execution: 1. Reconcile active_workers with actual TaskList states 2. Remove entries for completed/deleted tasks 3. Write updated meta.json 4. STOP (wait for next callback)
Error Handling
| Scenario | Resolution |
|---|---|
| Session file not found | Error, suggest re-initialization |
| Worker callback from unknown role | Log info, scan for other completions |
| Pipeline stall (no ready, no running, has pending) | Check blockedBy chains, report to user |
| GC loop exceeded | Accept current coverage with warning, proceed |
| Scout finds 0 issues | Skip to testing mode, proceed to QASTRAT |
Coordinator Role
Orchestrate team-quality-assurance: analyze -> dispatch -> spawn -> monitor -> report.
Identity
- Name: coordinator | Tag: [coordinator]
- Responsibility: Parse requirements -> Mode selection -> Create team -> Dispatch tasks -> Monitor progress -> Report results
Boundaries
MUST
- Parse task description and detect QA mode
- Create team and spawn team-worker agents in background
- Dispatch tasks with proper dependency chains
- Monitor progress via callbacks and route messages
- Maintain session state
- Handle GC loop (generator-executor coverage cycles)
- Execute completion action when pipeline finishes
MUST NOT
- Read source code or explore codebase (delegate to workers)
- Execute scan, test, or analysis work directly
- Modify test files or source code
- Spawn workers with general-purpose agent (MUST use team-worker)
- Generate more than 6 worker roles
Command Execution Protocol
When coordinator needs to execute a specific phase: 1. Read commands/<command>.md 2. Follow the workflow defined in the command 3. Commands are inline execution guides, NOT separate agents 4. Execute synchronously, complete before proceeding
Entry Router
| Detection | Condition | Handler |
|---|---|---|
| Worker callback | Message contains [scout], [strategist], [generator], [executor], [analyst] | -> handleCallback (monitor.md) |
| Status check | Args contain "check" or "status" | -> handleCheck (monitor.md) |
| Manual resume | Args contain "resume" or "continue" | -> handleResume (monitor.md) |
| Capability gap | Message contains "capability_gap" | -> handleAdapt (monitor.md) |
| Pipeline complete | All tasks completed | -> handleComplete (monitor.md) |
| Interrupted session | Active session in .workflow/.team/QA-* | -> Phase 0 |
| New session | None of above | -> Phase 1 |
For callback/check/resume/adapt/complete: load @commands/monitor.md, execute handler, STOP.
Phase 0: Session Resume Check
1. Scan .workflow/.team/QA-*/session.json for active/paused sessions 2. No sessions -> Phase 1 3. Single session -> reconcile (audit TaskList, reset in_progress->pending, rebuild team, kick first ready task) 4. Multiple -> AskUserQuestion for selection
Phase 1: Requirement Clarification
TEXT-LEVEL ONLY. No source code reading.
1. Parse task description and extract flags 2. QA Mode Selection:
| Condition | Mode |
|---|---|
Explicit --mode=discovery flag | discovery |
Explicit --mode=testing flag | testing |
Explicit --mode=full flag | full |
| Task description contains: discovery/scan/issue keywords | discovery |
| Task description contains: test/coverage/TDD keywords | testing |
| No explicit flag and no keyword match | full (default) |
3. Clarify if ambiguous (AskUserQuestion: scope, deliverables, constraints) 4. Delegate to @commands/analyze.md 5. Output: task-analysis.json 6. CRITICAL: Always proceed to Phase 2, never skip team workflow
Phase 2: Create Team + Initialize Session
1. Resolve workspace paths (MUST do first):
project_root= result ofBash({ command: "pwd" })skill_root=<project_root>/.claude/skills/team-quality-assurance
2. Generate session ID: QA-<slug>-<date> 3. Create session folder structure 4. TeamCreate with team name "quality-assurance" 5. Read specs/pipelines.md -> select pipeline based on mode 6. Register roles in session.json 7. Initialize shared infrastructure (wisdom/*.md) 8. Initialize pipeline via team_msg state_update:
mcp__ccw-tools__team_msg({
operation: "log", session_id: "<id>", from: "coordinator",
type: "state_update", summary: "Session initialized",
data: {
pipeline_mode: "<discovery|testing|full>",
pipeline_stages: [...],
team_name: "quality-assurance",
discovered_issues: [],
test_strategy: {},
generated_tests: {},
execution_results: {},
defect_patterns: [],
coverage_history: [],
quality_score: null
}
})9. Write session.json
Phase 3: Create Task Chain
Delegate to @commands/dispatch.md: 1. Read dependency graph from task-analysis.json 2. Read specs/pipelines.md for selected pipeline's task registry 3. Topological sort tasks 4. Create tasks via TaskCreate, then TaskUpdate with addBlockedBy 5. Update session.json
Phase 4: Spawn-and-Stop
Delegate to @commands/monitor.md#handleSpawnNext: 1. Find ready tasks (pending + all addBlockedBy dependencies resolved) 2. Spawn team-worker agents (see SKILL.md Spawn Template) 3. Output status summary 4. STOP
Phase 5: Report + Completion Action
1. Generate summary (deliverables, pipeline stats, quality score, GC rounds) 2. Execute completion action per session.completion_action:
- interactive -> AskUserQuestion (Archive/Keep/Export)
- auto_archive -> Archive & Clean
- auto_keep -> Keep Active
Error Handling
| Error | Resolution |
|---|---|
| Task too vague | AskUserQuestion for clarification |
| Session corruption | Attempt recovery, fallback to manual |
| Worker crash | Reset task to pending, respawn |
| Dependency cycle | Detect in analysis, halt |
| Scout finds nothing | Skip to testing mode |
| GC loop stuck > 3 | Accept current coverage with warning |
| quality_score < 60 | Report with WARNING, suggest re-run |
Test Executor
inner_loop: dynamic — Dispatch sets per-task:truefor serial layer chains (discovery/testing mode),falsefor parallel layer execution (full mode where QARUN-L1-001 and QARUN-L2-001 run independently). When false, each QARUN task gets its own worker.
Run test suites, collect coverage data, and perform automatic fix cycles when tests fail. Implements the execution side of the Generator-Executor (GC) loop.
Phase 2: Environment Detection
| Input | Source | Required |
|---|---|---|
| Task description | From task subject/description | Yes |
| Session path | Extracted from task description | Yes |
| .msg/meta.json | <session>/wisdom/.msg/meta.json | Yes |
| Test strategy | meta.json -> test_strategy | Yes |
| Generated tests | meta.json -> generated_tests | Yes |
| Target layer | task description layer: L1/L2/L3 | Yes |
1. Extract session path and target layer from task description 2. Load validation specs: Run ccw spec load --category validation for verification rules and acceptance criteria 3. Read .msg/meta.json for strategy and generated test file list 3. Detect test command by framework:
| Framework | Command |
|---|---|
| vitest | npx vitest run --coverage --reporter=json --outputFile=test-results.json |
| jest | npx jest --coverage --json --outputFile=test-results.json |
| pytest | python -m pytest --cov --cov-report=json -v |
| mocha | npx mocha --reporter json > test-results.json |
| unknown | npm test -- --coverage |
4. Get test files from generated_tests[targetLayer].files
Phase 3: Iterative Test-Fix Cycle
Max iterations: 5. Pass threshold: 95% or all tests pass.
Per iteration: 1. Run test command, capture output 2. Parse results: extract passed/failed counts, parse coverage from output or coverage/coverage-summary.json 3. If all pass (0 failures) -> exit loop (success) 4. If pass rate >= 95% and iteration >= 2 -> exit loop (good enough) 5. If iteration >= MAX -> exit loop (report current state) 6. Extract failure details (error lines, assertion failures) 7. Delegate fix via CLI tool with constraints:
- ONLY modify test files, NEVER modify source code
- Fix: incorrect assertions, missing imports, wrong mocks, setup issues
- Do NOT: skip tests, add
@ts-ignore, useas any
8. Increment iteration, repeat
Phase 4: Result Analysis & Output
1. Build result data: layer, framework, iterations, pass_rate, coverage, tests_passed, tests_failed, all_passed 2. Save results to <session>/results/run-<layer>.json 3. Save last test output to <session>/results/output-<layer>.txt 4. Update <session>/wisdom/.msg/meta.json under execution_results[layer] and top-level execution_results.pass_rate, execution_results.coverage 5. Message type: tests_passed if all_passed, else tests_failed
Test Generator
Generate test code according to strategist's strategy and layers. Support L1 unit tests, L2 integration tests, L3 E2E tests. Follow project's existing test patterns and framework conventions.
Phase 2: Strategy & Pattern Loading
| Input | Source | Required |
|---|---|---|
| Task description | From task subject/description | Yes |
| Session path | Extracted from task description | Yes |
| .msg/meta.json | <session>/wisdom/.msg/meta.json | Yes |
| Test strategy | meta.json -> test_strategy | Yes |
| Target layer | task description layer: L1/L2/L3 | Yes |
1. Extract session path and target layer from task description 2. Read .msg/meta.json for test strategy (layers, coverage targets) 3. Determine if this is a GC fix task (subject contains "fix") 4. Load layer config from strategy: level, name, target_coverage, focus_files 5. Learn existing test patterns -- find 3 similar test files via Glob(**/*.{test,spec}.{ts,tsx,js,jsx}) 6. Detect test conventions: file location (colocated vs __tests__), import style, describe/it nesting, framework (vitest/jest/pytest)
Phase 3: Test Code Generation
Mode selection:
| Condition | Mode |
|---|---|
| GC fix task | Read failure info from <session>/results/run-<layer>.json, fix failing tests only |
| <= 3 focus files | Direct: inline Read source -> Write test file |
| > 3 focus files | Batch by module, delegate via CLI tool |
Direct generation flow (per source file): 1. Read source file content, extract exports 2. Determine test file path following project conventions 3. If test exists -> analyze missing cases -> append new tests via Edit 4. If no test -> generate full test file via Write 5. Include: happy path, edge cases, error cases per export
GC fix flow: 1. Read execution results and failure output from results directory 2. Read each failing test file 3. Fix assertions, imports, mocks, or test setup 4. Do NOT modify source code, do NOT skip/ignore tests
General rules:
- Follow existing test patterns exactly (imports, naming, structure)
- Target coverage per layer config
- Do NOT use
anytype assertions or@ts-ignore
Phase 4: Self-Validation & Output
1. Collect generated/modified test files 2. Run syntax check (TypeScript: tsc --noEmit, or framework-specific) 3. Auto-fix syntax errors (max 3 attempts) 4. Write test metadata to <session>/wisdom/.msg/meta.json under generated_tests[layer]:
- layer, files list, count, syntax_clean, mode, gc_fix flag
5. Message type: tests_generated for new, tests_revised for GC fix iterations
Multi-Perspective Scout
Scan codebase from multiple perspectives (bug, security, test-coverage, code-quality, UX) to discover potential issues. Produce structured scan results with severity-ranked findings.
Phase 2: Context & Scope Assessment
| Input | Source | Required |
|---|---|---|
| Task description | From task subject/description | Yes |
| Session path | Extracted from task description | Yes |
| .msg/meta.json | <session>/wisdom/.msg/meta.json | No |
1. Extract session path and target scope from task description 2. Determine scan scope: explicit scope from task or **/* default 3. Get recent changed files: git diff --name-only HEAD~5 2>/dev/null || echo "" 4. Read .msg/meta.json for historical defect patterns (defect_patterns) 5. Select scan perspectives based on task description:
- Default:
["bug", "security", "test-coverage", "code-quality"] - Add
"ux"if task mentions UX/UI
6. Assess complexity to determine scan strategy:
| Complexity | Condition | Strategy |
|---|---|---|
| Low | < 5 changed files, no specific keywords | ACE search + Grep inline |
| Medium | 5-15 files or specific perspective requested | CLI fan-out (3 core perspectives) |
| High | > 15 files or full-project scan | CLI fan-out (all perspectives) |
Phase 3: Multi-Perspective Scan
Low complexity: Use mcp__ace-tool__search_context for quick pattern-based scan.
Medium/High complexity: CLI fan-out -- one ccw cli --mode analysis per perspective:
For each active perspective, build prompt:
PURPOSE: Scan code from <perspective> perspective to discover potential issues
TASK: Analyze code patterns for <perspective> problems, identify anti-patterns, check for common issues
MODE: analysis
CONTEXT: @<scan-scope>
EXPECTED: List of findings with severity (critical/high/medium/low), file:line references, description
CONSTRAINTS: Focus on actionable findings onlyExecute via: ccw cli -p "<prompt>" --tool gemini --mode analysis
After all perspectives complete:
- Parse CLI outputs into structured findings
- Deduplicate by file:line (merge perspectives for same location)
- Compare against known defect patterns from .msg/meta.json
- Rank by severity: critical > high > medium > low
Tech Profile Scan
After scanning, emit context-aware trigger signals (based on detected codebase characteristics):
1. Check scan findings → signals (sql_detected, auth_detected, injection_risk, eval_usage) 2. Check quality issues → risk signals (test_gap, legacy_patterns, perf_sensitive) 3. Include tech_profile in Phase 5 state_update data
Phase 4: Result Aggregation
1. Build discoveredIssues array from critical + high findings (with id, severity, perspective, file, line, description) 2. Write scan results to <session>/scan/scan-results.json:
- scan_date, perspectives scanned, total findings, by_severity counts, findings detail, issues_created count
3. Update <session>/wisdom/.msg/meta.json: merge discovered_issues field 4. Contribute to wisdom/issues.md if new patterns found
Test Strategist
Analyze change scope, determine test layers (L1-L3), define coverage targets, and generate test strategy document. Create targeted test plans based on scout discoveries and code changes.
Phase 2: Context & Change Analysis
| Input | Source | Required |
|---|---|---|
| Task description | From task subject/description | Yes |
| Session path | Extracted from task description | Yes |
| .msg/meta.json | <session>/wisdom/.msg/meta.json | Yes |
| Discovered issues | meta.json -> discovered_issues | No |
| Defect patterns | meta.json -> defect_patterns | No |
1. Extract session path from task description 2. Read .msg/meta.json for scout discoveries and historical patterns 3. Analyze change scope: git diff --name-only HEAD~5 4. Categorize changed files:
| Category | Pattern |
|---|---|
| Source | `\.(ts |
| Test | `\.(test |
| Config | `\.(json |
5. Detect test framework from package.json / project files 6. Check existing coverage baseline from coverage/coverage-summary.json 7. Select analysis mode:
| Total Scope | Mode |
|---|---|
| <= 5 files + issues | Direct inline analysis |
| 6-15 | Single CLI analysis |
| > 15 | Multi-dimension CLI analysis |
Phase 3: Strategy Generation
Layer Selection Logic:
| Condition | Layer | Target |
|---|---|---|
| Has source file changes | L1: Unit Tests | 80% |
| >= 3 source files OR critical issues | L2: Integration Tests | 60% |
| >= 3 critical/high severity issues | L3: E2E Tests | 40% |
| No changes but has scout issues | L1 focused on issue files | 80% |
For CLI-assisted analysis, use:
PURPOSE: Analyze code changes and scout findings to determine optimal test strategy
TASK: Classify changed files by risk, map issues to test requirements, identify integration points, recommend test layers with coverage targets
MODE: analysisBuild strategy document with: scope analysis, layer configs (level, name, target_coverage, focus_files, rationale), priority issues list.
Validation: Verify strategy has layers, targets > 0, covers discovered issues, and framework detected.
Phase 4: Output & Persistence
1. Write strategy to <session>/strategy/test-strategy.md 2. Update <session>/wisdom/.msg/meta.json: merge test_strategy field with scope, layers, coverage_targets, test_framework 3. Contribute to wisdom/decisions.md with layer selection rationale
QA Pipelines
Pipeline definitions and task registry for team-quality-assurance.
Pipeline Modes
| Mode | Description | Entry Role |
|---|---|---|
| discovery | Scout-first: issue discovery then testing | scout |
| testing | Skip scout, direct test pipeline | strategist |
| full | Complete QA closed loop + regression scan | scout |
Pipeline Definitions
Discovery Mode (5 tasks, serial)
SCOUT-001 -> QASTRAT-001 -> QAGEN-001 -> QARUN-001 -> QAANA-001| Task ID | Role | Dependencies | Description |
|---|---|---|---|
| SCOUT-001 | scout | (none) | Multi-perspective issue scanning |
| QASTRAT-001 | strategist | SCOUT-001 | Change scope analysis + test strategy |
| QAGEN-001 | generator | QASTRAT-001 | L1 unit test generation |
| QARUN-001 | executor | QAGEN-001 | L1 test execution + fix cycles |
| QAANA-001 | analyst | QARUN-001 | Defect pattern analysis + quality report |
Testing Mode (6 tasks, progressive layers)
QASTRAT-001 -> QAGEN-L1-001 -> QARUN-L1-001 -> QAGEN-L2-001 -> QARUN-L2-001 -> QAANA-001| Task ID | Role | Dependencies | Layer | Description |
|---|---|---|---|---|
| QASTRAT-001 | strategist | (none) | — | Test strategy formulation |
| QAGEN-L1-001 | generator | QASTRAT-001 | L1 | L1 unit test generation |
| QARUN-L1-001 | executor | QAGEN-L1-001 | L1 | L1 test execution + fix cycles |
| QAGEN-L2-001 | generator | QARUN-L1-001 | L2 | L2 integration test generation |
| QARUN-L2-001 | executor | QAGEN-L2-001 | L2 | L2 test execution + fix cycles |
| QAANA-001 | analyst | QARUN-L2-001 | — | Quality analysis report |
Full Mode (8 tasks, parallel windows + regression)
SCOUT-001 -> QASTRAT-001 -> [QAGEN-L1-001 || QAGEN-L2-001] -> [QARUN-L1-001 || QARUN-L2-001] -> QAANA-001 -> SCOUT-002| Task ID | Role | Dependencies | Layer | Description |
|---|---|---|---|---|
| SCOUT-001 | scout | (none) | — | Multi-perspective issue scanning |
| QASTRAT-001 | strategist | SCOUT-001 | — | Test strategy formulation |
| QAGEN-L1-001 | generator-1 | QASTRAT-001 | L1 | L1 unit test generation (parallel) |
| QAGEN-L2-001 | generator-2 | QASTRAT-001 | L2 | L2 integration test generation (parallel) |
| QARUN-L1-001 | executor-1 | QAGEN-L1-001 | L1 | L1 test execution + fix cycles (parallel) |
| QARUN-L2-001 | executor-2 | QAGEN-L2-001 | L2 | L2 test execution + fix cycles (parallel) |
| QAANA-001 | analyst | QARUN-L1-001, QARUN-L2-001 | — | Quality analysis report |
| SCOUT-002 | scout | QAANA-001 | — | Regression scan after fixes |
GC Loop
Generator-Executor iterate per test layer until coverage targets are met:
QAGEN -> QARUN -> (if coverage < target) -> QAGEN-fix -> QARUN-gc
(if coverage >= target) -> next layer or QAANA- Max iterations: 3 per layer
- After 3 iterations: accept current coverage with warning
Coverage Targets
| Layer | Name | Default Target |
|---|---|---|
| L1 | Unit Tests | 80% |
| L2 | Integration Tests | 60% |
| L3 | E2E Tests | 40% |
Scan Perspectives
| Perspective | Focus |
|---|---|
| bug | Logic errors, crash paths, null references |
| security | Vulnerabilities, auth bypass, data exposure |
| test-coverage | Untested code paths, missing assertions |
| code-quality | Anti-patterns, complexity, maintainability |
| ux | User-facing issues, accessibility (optional) |
Session Directory
.workflow/.team/QA-<slug>-<YYYY-MM-DD>/
├── .msg/messages.jsonl # Message bus log
├── .msg/meta.json # Session state + cross-role state
├── wisdom/ # Cross-task knowledge
│ ├── learnings.md
│ ├── decisions.md
│ ├── conventions.md
│ └── issues.md
├── scan/ # Scout output
│ └── scan-results.json
├── strategy/ # Strategist output
│ └── test-strategy.md
├── tests/ # Generator output
│ ├── L1-unit/
│ ├── L2-integration/
│ └── L3-e2e/
├── results/ # Executor output
│ ├── run-001.json
│ └── coverage-001.json
└── analysis/ # Analyst output
└── quality-report.md{
"team_name": "quality-assurance",
"version": "1.0.0",
"description": "质量保障团队 - 融合\"软件测试\"和\"问题发现\"两大能力域,形成发现→验证→修复→回归的闭环",
"skill_entry": "team-quality-assurance",
"invocation": "Skill(skill=\"team-quality-assurance\", args=\"--role=coordinator ...\")",
"roles": {
"coordinator": {
"name": "coordinator",
"responsibility": "Orchestration",
"task_prefix": null,
"description": "QA 团队协调者。编排 pipeline:需求澄清 → 模式选择 → 团队创建 → 任务分发 → 监控协调 → 质量门控 → 结果汇报",
"message_types_sent": ["mode_selected", "gc_loop_trigger", "quality_gate", "task_unblocked", "error", "shutdown"],
"message_types_received": ["scan_ready", "issues_found", "strategy_ready", "tests_generated", "tests_revised", "tests_passed", "tests_failed", "analysis_ready", "quality_report", "error"],
"commands": ["dispatch", "monitor"]
},
"scout": {
"name": "scout",
"responsibility": "Orchestration (多视角扫描编排)",
"task_prefix": "SCOUT-*",
"description": "多视角问题侦察员。主动扫描代码库,从 bug、安全、UX、测试覆盖、代码质量等多个视角发现潜在问题",
"message_types_sent": ["scan_ready", "issues_found", "error"],
"message_types_received": [],
"commands": ["scan"],
"cli_tools": ["gemini"],
"cli_tools": ["gemini"]
},
"strategist": {
"name": "strategist",
"responsibility": "Orchestration (策略制定)",
"task_prefix": "QASTRAT-*",
"description": "测试策略师。分析变更范围,确定测试层级(L1-L3),定义覆盖率目标",
"message_types_sent": ["strategy_ready", "error"],
"message_types_received": [],
"commands": ["analyze-scope"],
"cli_tools": ["gemini"],
"cli_tools": ["gemini"]
},
"generator": {
"name": "generator",
"responsibility": "Code generation (测试代码生成)",
"task_prefix": "QAGEN-*",
"description": "测试用例生成器。按策略和层级生成测试代码,支持 L1/L2/L3",
"message_types_sent": ["tests_generated", "tests_revised", "error"],
"message_types_received": [],
"commands": ["generate-tests"],
"cli_tools": ["gemini"],
"cli_tools": ["gemini"]
},
"executor": {
"name": "executor",
"responsibility": "Validation (测试执行与修复)",
"task_prefix": "QARUN-*",
"description": "测试执行者。运行测试套件,收集覆盖率数据,失败时自动修复循环",
"message_types_sent": ["tests_passed", "tests_failed", "coverage_report", "error"],
"message_types_received": [],
"commands": ["run-fix-cycle"],
"cli_tools": ["gemini"]
},
"analyst": {
"name": "analyst",
"responsibility": "Read-only analysis (质量分析)",
"task_prefix": "QAANA-*",
"description": "质量分析师。分析缺陷模式、覆盖率差距、测试有效性,生成综合质量报告",
"message_types_sent": ["analysis_ready", "quality_report", "error"],
"message_types_received": [],
"commands": ["quality-report"],
"cli_tools": ["gemini"]
}
},
"pipeline_modes": {
"discovery": {
"description": "Scout先行扫描 → 全流程",
"stages": ["SCOUT", "QASTRAT", "QAGEN", "QARUN", "QAANA"],
"entry_role": "scout"
},
"testing": {
"description": "跳过 Scout → 直接测试",
"stages": ["QASTRAT", "QAGEN-L1", "QARUN-L1", "QAGEN-L2", "QARUN-L2", "QAANA"],
"entry_role": "strategist"
},
"full": {
"description": "完整 QA 闭环 + 回归扫描",
"stages": ["SCOUT", "QASTRAT", "QAGEN-L1", "QAGEN-L2", "QARUN-L1", "QARUN-L2", "QAANA", "SCOUT-REG"],
"entry_role": "scout",
"parallel_stages": [["QAGEN-L1", "QAGEN-L2"], ["QARUN-L1", "QARUN-L2"]]
}
},
"gc_loop": {
"max_iterations": 3,
"trigger": "coverage < target",
"participants": ["generator", "executor"],
"flow": "QAGEN-fix → QARUN-gc → evaluate"
},
"shared_memory": {
"file": "shared-memory.json",
"fields": {
"discovered_issues": { "owner": "scout", "type": "array" },
"test_strategy": { "owner": "strategist", "type": "object" },
"generated_tests": { "owner": "generator", "type": "object" },
"execution_results": { "owner": "executor", "type": "object" },
"defect_patterns": { "owner": "analyst", "type": "array" },
"coverage_history": { "owner": "analyst", "type": "array" },
"quality_score": { "owner": "analyst", "type": "number" }
}
},
"collaboration_patterns": [
"CP-1: Linear Pipeline (Discovery/Testing mode)",
"CP-2: Review-Fix Cycle (GC loop: Generator ↔ Executor)",
"CP-3: Fan-out (Scout multi-perspective scan)",
"CP-5: Escalation (Worker → Coordinator → User)",
"CP-9: Dual-Track (Full mode: L1 + L2 parallel)",
"CP-10: Post-Mortem (Analyst quality report)"
],
"session_directory": {
"pattern": ".workflow/.team/QA-{slug}-{date}",
"subdirectories": ["scan", "strategy", "results", "analysis"]
},
"test_layers": {
"L1": { "name": "Unit Tests", "default_target": 80 },
"L2": { "name": "Integration Tests", "default_target": 60 },
"L3": { "name": "E2E Tests", "default_target": 40 }
}
}