team-testing
npx skills add https://github.com/catlog22/claude-code-workflow --skill team-testing
Agent 安装分布
Skill 文档
Team Testing
Unified team skill: progressive test coverage through Generator-Critic loops (generator<->executor), shared memory (defect pattern tracking), and dynamic layer selection. All team members invoke with --role=xxx to route to role-specific execution.
Architecture
âââââââââââââââââââââââââââââââââââââââââââââââââââââ
â Skill(skill="team-testing") â
â args="<task>" or args="--role=xxx" â
âââââââââââââââââââââ¬ââââââââââââââââââââââââââââââââ
â Role Router
âââââ --role present? âââââ
â NO â YES
â â
Orchestration Mode Role Dispatch
(auto â coordinator) (route to role.md)
â
ââââââ´âââââ¬ââââââââââââ¬ââââââââââââ¬ââââââââââââ
â â â â â
âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
âcoordinatorââstrategistââgenerator ââ executor ââ analyst â
â ââSTRATEGY-*ââTESTGEN-* ââTESTRUN-* ââTESTANA-*â
âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
Role Router
Input Parsing
Parse $ARGUMENTS to extract --role. If absent â Orchestration Mode (auto route to coordinator).
Role Registry
| Role | File | Task Prefix | Type | Compact |
|---|---|---|---|---|
| coordinator | roles/coordinator.md | (none) | orchestrator | â ï¸ å缩åå¿ é¡»é读 |
| strategist | roles/strategist.md | STRATEGY-* | pipeline | å缩åå¿ é¡»é读 |
| generator | roles/generator.md | TESTGEN-* | pipeline | å缩åå¿ é¡»é读 |
| executor | roles/executor.md | TESTRUN-* | pipeline | å缩åå¿ é¡»é读 |
| analyst | roles/analyst.md | TESTANA-* | pipeline | å缩åå¿ é¡»é读 |
â ï¸ COMPACT PROTECTION: è§è²æä»¶æ¯æ§è¡ææ¡£ï¼ä¸æ¯åèèµæãå½ context compression åçåï¼è§è²æä»¤ä» å©æè¦æ¶ï¼å¿ é¡»ç«å³
Readå¯¹åº role.md éæ°å è½½ååç»§ç»æ§è¡ãä¸å¾åºäºæè¦æ§è¡ä»»ä½ Phaseã
Dispatch
- Extract
--rolefrom arguments - If no
--roleâ route to coordinator (Orchestration Mode) - Look up role in registry â Read the role file â Execute its phases
Orchestration Mode
When invoked without --role, coordinator auto-starts. User just provides task description.
Invocation: Skill(skill="team-testing", args="<task-description>")
Lifecycle:
User provides task description
â coordinator Phase 1-3: Change scope analysis â TeamCreate â Create task chain
â coordinator Phase 4: spawn first batch workers (background) â STOP
â Worker executes â SendMessage callback â coordinator advances next step
â Loop until pipeline complete â Phase 5 report
User Commands (wake paused coordinator):
| Command | Action |
|---|---|
check / status |
Output execution status graph, no advancement |
resume / continue |
Check worker states, advance next step |
Shared Infrastructure
The following templates apply to all worker roles. Each role.md only needs to write Phase 2-4 role-specific logic.
Worker Phase 1: Task Discovery (shared by all workers)
Every worker executes the same task discovery flow on startup:
- Call
TaskList()to get all tasks - Filter: subject matches this role’s prefix + owner is this role + status is pending + blockedBy is empty
- No tasks â idle wait
- Has tasks â
TaskGetfor details âTaskUpdatemark in_progress
Resume Artifact Check (prevent duplicate output after resume):
- Check whether this task’s output artifact already exists
- Artifact complete â skip to Phase 5 report completion
- Artifact incomplete or missing â normal Phase 2-4 execution
Worker Phase 5: Report (shared by all workers)
Standard reporting flow after task completion:
- Message Bus: Call
mcp__ccw-tools__team_msgto log message- Parameters: operation=”log”, team=”testing”, from=, to=”coordinator”, type=, summary=”[] “, ref=
- CLI fallback: When MCP unavailable â
ccw team log --team <session-id> --from <role> --to coordinator --type <type> --summary "[<role>] ..." --json// team must be session ID
- SendMessage: Send result to coordinator (content and summary both prefixed with
[<role>]) - TaskUpdate: Mark task completed
- Loop: Return to Phase 1 to check next task
Wisdom Accumulation (all roles)
Cross-task knowledge accumulation. Coordinator creates wisdom/ directory at session initialization.
Directory:
<session-folder>/wisdom/
âââ learnings.md # Patterns and insights
âââ decisions.md # Architecture and design decisions
âââ conventions.md # Codebase conventions
âââ issues.md # Known risks and issues
Worker Load (Phase 2): Extract Session: <path> from task description, read wisdom directory files.
Worker Contribute (Phase 4/5): Write this task’s discoveries to corresponding wisdom files.
Role Isolation Rules
| Allowed | Forbidden |
|---|---|
| Process tasks with own prefix | Process tasks with other role prefixes |
| SendMessage to coordinator | Communicate directly with other workers |
| Read/write shared-memory.json (own fields) | Create tasks for other roles |
| Delegate to commands/ files | Modify resources outside own responsibility |
Coordinator additional restrictions: Do not write tests directly, do not execute tests, do not analyze coverage, do not bypass workers.
Output Tagging
All outputs must carry [role_name] prefix in both SendMessage content/summary and team_msg summary.
Message Bus (All Roles)
Every SendMessage before, must call mcp__ccw-tools__team_msg to log:
Parameters: operation=”log”, team=, from=, to=”coordinator”, type=, summary=”[] “, ref=
CRITICAL:
teammust be session ID (e.g., TST-xxx-date), NOT team name. Extract from Session: field in task description.
CLI fallback: When MCP unavailable â ccw team log --team <session-id> --from <role> --to coordinator --type <type> --summary "[<role>] ..." --json
Message types by role:
| Role | Types |
|---|---|
| coordinator | pipeline_selected, gc_loop_trigger, quality_gate, task_unblocked, error, shutdown |
| strategist | strategy_ready, error |
| generator | tests_generated, tests_revised, error |
| executor | tests_passed, tests_failed, coverage_report, error |
| analyst | analysis_ready, error |
Shared Memory
All roles read in Phase 2 and write in Phase 5 to shared-memory.json:
| Role | Field |
|---|---|
| strategist | test_strategy |
| generator | generated_tests |
| executor | execution_results, defect_patterns |
| analyst | analysis_report, coverage_history |
Team Configuration
| Setting | Value |
|---|---|
| Team name | testing |
| Session directory | .workflow/.team/TST-<slug>-<date>/ |
| Shared memory | shared-memory.json in session dir |
| Test layers | L1: Unit (80%), L2: Integration (60%), L3: E2E (40%) |
Three-Pipeline Architecture
Targeted (small-scope changes):
STRATEGY-001 â TESTGEN-001(L1 unit) â TESTRUN-001
Standard (progressive):
STRATEGY-001 â TESTGEN-001(L1) â TESTRUN-001(L1) â TESTGEN-002(L2) â TESTRUN-002(L2) â TESTANA-001
Comprehensive (full coverage):
STRATEGY-001 â [TESTGEN-001(L1) + TESTGEN-002(L2)](parallel) â [TESTRUN-001(L1) + TESTRUN-002(L2)](parallel) â TESTGEN-003(L3) â TESTRUN-003(L3) â TESTANA-001
Generator-Critic Loop
generator <-> executor loop (revise tests when coverage below target):
TESTGEN â TESTRUN â (if coverage < target) â TESTGEN-fix â TESTRUN-2
(if coverage >= target) â next layer or TESTANA
Cadence Control
Beat model: Event-driven, each beat = coordinator wake â process â spawn â STOP. Testing beat: strategy â generate â execute â analyze.
Beat Cycle (single beat)
âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
Event Coordinator Workers
âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
callback/resume âââ ââ handleCallback ââ
â mark completed â
â check pipeline â
ââ handleSpawnNext ââ¤
â find ready tasks â
â spawn workers ââââ¼âââ [Worker A] Phase 1-5
â (parallel OK) âââ¼âââ [Worker B] Phase 1-5
ââ STOP (idle) ââââââ â
â
callback âââââââââââââââââââââââââââââââââââââââââââ
(next beat) SendMessage + TaskUpdate(completed)
âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
Pipeline beat views:
Targeted (3 beats, strictly serial)
ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
Beat 1 2 3
â â â
STRATEGY â TESTGEN âââ TESTRUN
â² â²
pipeline pipeline
start done
STRATEGY=strategist TESTGEN=generator TESTRUN=executor
Standard (6 beats, progressive layers)
ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
Beat 1 2 3 4 5 6
â â â â â â
STRATEGY â TESTGEN-L1 â TESTRUN-L1 â TESTGEN-L2 â TESTRUN-L2 â TESTANA
â
coverage check
(< target â GC loop)
Comprehensive (5+ beats, parallel windows)
ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
Beat 1 2 3 4 5
â âââââââ´ââââââ ââââââââ´âââââââ â â
STRATEGY â TESTGEN-L1 ⥠TESTGEN-L2 â TESTRUN-L1 ⥠TESTRUN-L2 â TESTGEN-L3 â TESTRUN-L3 â TESTANA
â² â² â²
parallel parallel pipeline
window window done
Checkpoints:
| Trigger | Location | Behavior |
|---|---|---|
| Coverage below target | After TESTRUN-* | If coverage < target â create TESTGEN-fix task (GC loop); else proceed |
| GC loop limit | Max 3 rounds per layer | Exceeds limit â accept current coverage with warning |
| Pipeline stall | No ready + no running | Check missing tasks, report to user |
Stall Detection (coordinator handleCheck executes):
| Check | Condition | Resolution |
|---|---|---|
| Worker no response | in_progress task no callback | Report waiting task list, suggest user resume |
| Pipeline deadlock | no ready + no running + has pending | Check blockedBy dependency chain, report blocking point |
| GC loop exceeded | generator/executor iteration > 3 rounds | Terminate loop, accept current coverage with warning |
Task Metadata Registry
| Task ID | Role | Phase | Dependencies | Description |
|---|---|---|---|---|
| STRATEGY-001 | strategist | strategy | (none) | Analyze git diff, determine test layers, define coverage targets |
| TESTGEN-001 | generator | generate | STRATEGY-001 | Generate L1 unit tests |
| TESTRUN-001 | executor | execute | TESTGEN-001 | Execute L1 tests, collect coverage |
| TESTGEN-002 | generator | generate | TESTRUN-001 | Generate L2 integration tests (Standard/Comprehensive) |
| TESTRUN-002 | executor | execute | TESTGEN-002 | Execute L2 tests, collect coverage |
| TESTGEN-003 | generator | generate | TESTRUN-002 | Generate L3 E2E tests (Comprehensive only) |
| TESTRUN-003 | executor | execute | TESTGEN-003 | Execute L3 tests, collect coverage |
| TESTANA-001 | analyst | analyze | last TESTRUN-* | Defect pattern analysis, coverage gaps, quality report |
Coordinator Spawn Template
When coordinator spawns workers, use background mode (Spawn-and-Stop):
Task({
subagent_type: "general-purpose",
description: "Spawn <role> worker",
team_name: "testing",
name: "<role>",
run_in_background: true,
prompt: `You are team "testing" <ROLE>.
## Primary Directive
All your work must be executed through Skill to load role definition:
Skill(skill="team-testing", args="--role=<role>")
Current task: <task-description>
Session: <session-folder>
## Role Guidelines
- Only process <PREFIX>-* tasks, do not execute other role work
- All output prefixed with [<role>] identifier
- Only communicate with coordinator
- Do not use TaskCreate for other roles
- Call mcp__ccw-tools__team_msg before every SendMessage
## Workflow
1. Call Skill -> load role definition and execution logic
2. Follow role.md 5-Phase flow
3. team_msg + SendMessage results to coordinator
4. TaskUpdate completed -> check next task`
})
Unified Session Directory
.workflow/.team/TST-<slug>-<YYYY-MM-DD>/
âââ team-session.json # Session state
âââ shared-memory.json # Defect patterns / effective test patterns / coverage history
âââ wisdom/ # Cross-task knowledge
â âââ learnings.md
â âââ decisions.md
â âââ conventions.md
â âââ issues.md
âââ 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
Error Handling
| Scenario | Resolution |
|---|---|
| Unknown –role value | Error with available role list |
| Missing –role arg | Orchestration Mode â auto route to coordinator |
| Role file not found | Error with expected path (roles/.md) |
| Task prefix conflict | Log warning, proceed |
| Coverage never reaches target | After 3 GC loops, accept current coverage with warning |
| Test environment broken | Notify user, suggest manual fix |