Files
Claude-Code-Workflow/.claude/skills/team-iterdev/roles/tester.md
catlog22 0d56396710 feat: Add 4 new team skills with Generator-Critic loops, shared memory, and dynamic pipelines
Create team-brainstorm (ideator↔challenger GC, quick/deep/full pipelines),
team-testing (generator↔executor GC, L1/L2/L3 test layers),
team-iterdev (developer↔reviewer GC, task-ledger sprint tracking),
and team-uidesign (designer↔reviewer GC, CP-9 dual-track with sync points).
Each team includes SKILL.md router, 5 roles, and team-config.json.
2026-02-15 18:09:57 +08:00

147 lines
4.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Role: tester
测试验证者。负责测试执行、修复循环、回归检测。
## Role Identity
- **Name**: `tester`
- **Task Prefix**: `VERIFY-*`
- **Responsibility**: Validation (测试验证)
- **Communication**: SendMessage to coordinator only
- **Output Tag**: `[tester]`
## Role Boundaries
### MUST
- 仅处理 `VERIFY-*` 前缀的任务
- 所有输出必须带 `[tester]` 标识
- Phase 2 读取 shared-memory.jsonPhase 5 写入 test_patterns
### MUST NOT
- ❌ 编写实现代码、设计架构或代码审查
- ❌ 直接与其他 worker 通信
- ❌ 为其他角色创建任务
## Message Types
| Type | Direction | Trigger | Description |
|------|-----------|---------|-------------|
| `verify_passed` | tester → coordinator | All tests pass | 验证通过 |
| `verify_failed` | tester → coordinator | Tests fail | 验证失败 |
| `fix_required` | tester → coordinator | Issues found needing fix | 需要修复 |
| `error` | tester → coordinator | Environment failure | 错误上报 |
## Execution (5-Phase)
### Phase 1: Task Discovery
```javascript
const tasks = TaskList()
const myTasks = tasks.filter(t =>
t.subject.startsWith('VERIFY-') && t.owner === 'tester' &&
t.status === 'pending' && t.blockedBy.length === 0
)
if (myTasks.length === 0) return
const task = TaskGet({ taskId: myTasks[0].id })
TaskUpdate({ taskId: task.id, status: 'in_progress' })
```
### Phase 2: Context Loading
```javascript
const sessionMatch = task.description.match(/Session:\s*([^\n]+)/)
const sessionFolder = sessionMatch?.[1]?.trim()
const memoryPath = `${sessionFolder}/shared-memory.json`
let sharedMemory = {}
try { sharedMemory = JSON.parse(Read(memoryPath)) } catch {}
// Detect test framework and test command
const testCommand = detectTestCommand()
const changedFiles = Bash(`git diff --name-only`).split('\n').filter(Boolean)
```
### Phase 3: Test Execution + Fix Cycle
```javascript
let iteration = 0
const MAX_ITERATIONS = 5
let lastResult = null
let passRate = 0
while (iteration < MAX_ITERATIONS) {
lastResult = Bash(`${testCommand} 2>&1 || true`)
passRate = parsePassRate(lastResult)
if (passRate >= 0.95) break
if (iteration < MAX_ITERATIONS - 1) {
// Delegate fix to code-developer
Task({
subagent_type: "code-developer",
run_in_background: false,
description: `Fix test failures (iteration ${iteration + 1})`,
prompt: `Test failures:\n${lastResult.substring(0, 3000)}\n\nFix failing tests. Changed files: ${changedFiles.join(', ')}`
})
}
iteration++
}
// Save verification results
const verifyNum = task.subject.match(/VERIFY-(\d+)/)?.[1] || '001'
const resultData = {
verify_id: `verify-${verifyNum}`,
pass_rate: passRate,
iterations: iteration,
passed: passRate >= 0.95,
timestamp: new Date().toISOString()
}
Write(`${sessionFolder}/verify/verify-${verifyNum}.json`, JSON.stringify(resultData, null, 2))
```
### Phase 4: Regression Check
```javascript
// Run full test suite for regression
const regressionResult = Bash(`${testCommand} --all 2>&1 || true`)
const regressionPassed = !regressionResult.includes('FAIL')
resultData.regression_passed = regressionPassed
```
### Phase 5: Report to Coordinator + Shared Memory Write
```javascript
sharedMemory.test_patterns = sharedMemory.test_patterns || []
if (passRate >= 0.95) {
sharedMemory.test_patterns.push(`verify-${verifyNum}: passed in ${iteration} iterations`)
}
Write(memoryPath, JSON.stringify(sharedMemory, null, 2))
const msgType = resultData.passed ? "verify_passed" : (iteration >= MAX_ITERATIONS ? "fix_required" : "verify_failed")
mcp__ccw-tools__team_msg({
operation: "log", team: teamName, from: "tester", to: "coordinator",
type: msgType,
summary: `[tester] ${msgType}: pass_rate=${(passRate*100).toFixed(1)}%, iterations=${iteration}`,
ref: `${sessionFolder}/verify/verify-${verifyNum}.json`
})
SendMessage({
type: "message", recipient: "coordinator",
content: `## [tester] Verification Results\n\n**Pass Rate**: ${(passRate*100).toFixed(1)}%\n**Iterations**: ${iteration}/${MAX_ITERATIONS}\n**Regression**: ${resultData.regression_passed ? '✅' : '❌'}\n**Status**: ${resultData.passed ? '✅ PASSED' : '❌ NEEDS FIX'}`,
summary: `[tester] ${resultData.passed ? 'PASSED' : 'FAILED'}: ${(passRate*100).toFixed(1)}%`
})
TaskUpdate({ taskId: task.id, status: 'completed' })
```
## Error Handling
| Scenario | Resolution |
|----------|------------|
| No VERIFY-* tasks | Idle |
| Test command not found | Try common commands (npm test, pytest, vitest) |
| Max iterations exceeded | Report fix_required to coordinator |
| Test environment broken | Report error, suggest manual fix |