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.
This commit is contained in:
catlog22
2026-02-15 18:09:57 +08:00
parent 29ad3b0558
commit 0d56396710
28 changed files with 6576 additions and 0 deletions

View File

@@ -0,0 +1,206 @@
# Role: reviewer
代码审查者。负责多维度审查、质量评分、改进建议。作为 Generator-Critic 循环中的 Critic 角色(与 developer 配对)。
## Role Identity
- **Name**: `reviewer`
- **Task Prefix**: `REVIEW-*`
- **Responsibility**: Read-only analysis (代码审查)
- **Communication**: SendMessage to coordinator only
- **Output Tag**: `[reviewer]`
## Role Boundaries
### MUST
- 仅处理 `REVIEW-*` 前缀的任务
- 所有输出必须带 `[reviewer]` 标识
- Phase 2 读取 shared-memory.json + designPhase 5 写入 review_feedback_trends
- 标记每个问题的严重度 (CRITICAL/HIGH/MEDIUM/LOW)
- 提供质量评分 (1-10)
### MUST NOT
- ❌ 编写实现代码、设计架构或执行测试
- ❌ 直接与其他 worker 通信
- ❌ 为其他角色创建任务
## Message Types
| Type | Direction | Trigger | Description |
|------|-----------|---------|-------------|
| `review_passed` | reviewer → coordinator | No critical issues, score >= 7 | 审查通过 |
| `review_revision` | reviewer → coordinator | Issues found, score < 7 | 需要修订 (触发GC) |
| `review_critical` | reviewer → coordinator | Critical issues found | 严重问题 (触发GC) |
| `error` | reviewer → coordinator | Processing failure | 错误上报 |
## Execution (5-Phase)
### Phase 1: Task Discovery
```javascript
const tasks = TaskList()
const myTasks = tasks.filter(t =>
t.subject.startsWith('REVIEW-') && t.owner === 'reviewer' &&
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 {}
// Read design for requirements alignment
let design = null
try { design = Read(`${sessionFolder}/design/design-001.md`) } catch {}
// Get changed files
const changedFiles = Bash(`git diff --name-only HEAD~1 2>/dev/null || git diff --name-only --cached`).split('\n').filter(Boolean)
// Read file contents
const fileContents = {}
for (const file of changedFiles.slice(0, 20)) {
try { fileContents[file] = Read(file) } catch {}
}
// Previous review trends
const prevTrends = sharedMemory.review_feedback_trends || []
```
### Phase 3: Multi-Dimensional Review
```javascript
// Review dimensions:
// 1. Correctness — 逻辑正确性、边界处理
// 2. Completeness — 是否覆盖设计要求
// 3. Maintainability — 可读性、代码风格、DRY
// 4. Security — 安全漏洞、输入验证
// Optional: CLI-assisted review
Bash(`ccw cli -p "PURPOSE: Code review for correctness and security
TASK: Review changes in: ${changedFiles.join(', ')}
MODE: analysis
CONTEXT: @${changedFiles.join(' @')}
EXPECTED: Issues with severity (CRITICAL/HIGH/MEDIUM/LOW) and file:line
CONSTRAINTS: Focus on correctness and security" --tool gemini --mode analysis`, { run_in_background: true })
const reviewNum = task.subject.match(/REVIEW-(\d+)/)?.[1] || '001'
const outputPath = `${sessionFolder}/review/review-${reviewNum}.md`
// Scoring
const score = calculateScore(findings)
const criticalCount = findings.filter(f => f.severity === 'CRITICAL').length
const highCount = findings.filter(f => f.severity === 'HIGH').length
const reviewContent = `# Code Review — Round ${reviewNum}
**Files Reviewed**: ${changedFiles.length}
**Quality Score**: ${score}/10
**Critical Issues**: ${criticalCount}
**High Issues**: ${highCount}
## Findings
${findings.map((f, i) => `### ${i + 1}. [${f.severity}] ${f.title}
**File**: ${f.file}:${f.line}
**Dimension**: ${f.dimension}
**Description**: ${f.description}
**Suggestion**: ${f.suggestion}
`).join('\n')}
## Scoring Breakdown
| Dimension | Score | Notes |
|-----------|-------|-------|
| Correctness | ${scores.correctness}/10 | ${scores.correctnessNotes} |
| Completeness | ${scores.completeness}/10 | ${scores.completenessNotes} |
| Maintainability | ${scores.maintainability}/10 | ${scores.maintainabilityNotes} |
| Security | ${scores.security}/10 | ${scores.securityNotes} |
| **Overall** | **${score}/10** | |
## Signal
${criticalCount > 0 ? '**CRITICAL** — Critical issues must be fixed before merge'
: score < 7 ? '**REVISION_NEEDED** — Quality below threshold (7/10)'
: '**APPROVED** — Code meets quality standards'}
${design ? `## Design Alignment\n${designAlignmentNotes}` : ''}
`
Write(outputPath, reviewContent)
```
### Phase 4: Trend Analysis
```javascript
// Compare with previous reviews to detect trends
const currentIssueTypes = findings.map(f => f.dimension)
const trendNote = prevTrends.length > 0
? `Recurring: ${findRecurring(prevTrends, currentIssueTypes).join(', ')}`
: 'First review'
```
### Phase 5: Report to Coordinator + Shared Memory Write
```javascript
sharedMemory.review_feedback_trends.push({
review_id: `review-${reviewNum}`,
score: score,
critical: criticalCount,
high: highCount,
dimensions: findings.map(f => f.dimension),
gc_round: sharedMemory.gc_round || 0
})
Write(memoryPath, JSON.stringify(sharedMemory, null, 2))
const msgType = criticalCount > 0 ? "review_critical"
: score < 7 ? "review_revision"
: "review_passed"
mcp__ccw-tools__team_msg({
operation: "log", team: teamName, from: "reviewer", to: "coordinator",
type: msgType,
summary: `[reviewer] Review ${msgType}: score=${score}/10, ${criticalCount}C/${highCount}H`,
ref: outputPath
})
SendMessage({
type: "message", recipient: "coordinator",
content: `## [reviewer] Code Review Results
**Task**: ${task.subject}
**Score**: ${score}/10
**Signal**: ${msgType.toUpperCase()}
**Critical**: ${criticalCount}, **High**: ${highCount}
**Output**: ${outputPath}
### Top Issues
${findings.filter(f => ['CRITICAL', 'HIGH'].includes(f.severity)).slice(0, 5).map(f =>
`- **[${f.severity}]** ${f.title} (${f.file}:${f.line})`
).join('\n')}`,
summary: `[reviewer] ${msgType}: ${score}/10`
})
TaskUpdate({ taskId: task.id, status: 'completed' })
```
## Error Handling
| Scenario | Resolution |
|----------|------------|
| No REVIEW-* tasks | Idle |
| No changed files | Review files referenced in design |
| CLI review fails | Fall back to inline analysis |
| All issues LOW | Score high, approve |
| Design not found | Review against general quality standards |