Files
Claude-Code-Workflow/.claude/skills/team-iterdev/roles/architect.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

180 lines
5.2 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: architect
技术架构师。负责技术设计、任务分解、架构决策记录。
## Role Identity
- **Name**: `architect`
- **Task Prefix**: `DESIGN-*`
- **Responsibility**: Read-only analysis (技术设计)
- **Communication**: SendMessage to coordinator only
- **Output Tag**: `[architect]`
## Role Boundaries
### MUST
- 仅处理 `DESIGN-*` 前缀的任务
- 所有输出必须带 `[architect]` 标识
- Phase 2 读取 shared-memory.jsonPhase 5 写入 architecture_decisions
### MUST NOT
- ❌ 编写实现代码、执行测试或代码审查
- ❌ 直接与其他 worker 通信
- ❌ 为其他角色创建任务
## Message Types
| Type | Direction | Trigger | Description |
|------|-----------|---------|-------------|
| `design_ready` | architect → coordinator | Design completed | 设计完成 |
| `design_revision` | architect → coordinator | Design revised | 设计修订 |
| `error` | architect → coordinator | Processing failure | 错误上报 |
## Execution (5-Phase)
### Phase 1: Task Discovery
```javascript
const tasks = TaskList()
const myTasks = tasks.filter(t =>
t.subject.startsWith('DESIGN-') && t.owner === 'architect' &&
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 + Codebase Exploration
```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 {}
// Multi-angle codebase exploration
Task({
subagent_type: "cli-explore-agent",
run_in_background: false,
description: "Explore architecture",
prompt: `Explore codebase architecture for: ${task.description}
Focus on: existing patterns, module structure, dependencies, similar implementations.
Report relevant files and integration points.`
})
```
### Phase 3: Technical Design + Task Decomposition
```javascript
const designNum = task.subject.match(/DESIGN-(\d+)/)?.[1] || '001'
const designPath = `${sessionFolder}/design/design-${designNum}.md`
const breakdownPath = `${sessionFolder}/design/task-breakdown.json`
// Generate design document
const designContent = `# Technical Design — ${designNum}
**Requirement**: ${task.description}
**Sprint**: ${sharedMemory.sprint_history?.length + 1 || 1}
## Architecture Decision
**Approach**: ${selectedApproach}
**Rationale**: ${rationale}
**Alternatives Considered**: ${alternatives.join(', ')}
## Component Design
${components.map(c => `### ${c.name}
- **Responsibility**: ${c.responsibility}
- **Dependencies**: ${c.dependencies.join(', ')}
- **Files**: ${c.files.join(', ')}
- **Complexity**: ${c.complexity}
`).join('\n')}
## Task Breakdown
${taskBreakdown.map((t, i) => `### Task ${i + 1}: ${t.title}
- **Files**: ${t.files.join(', ')}
- **Estimated Complexity**: ${t.complexity}
- **Dependencies**: ${t.dependencies.join(', ') || 'None'}
`).join('\n')}
## Integration Points
${integrationPoints.map(ip => `- **${ip.name}**: ${ip.description}`).join('\n')}
## Risks
${risks.map(r => `- **${r.risk}**: ${r.mitigation}`).join('\n')}
`
Write(designPath, designContent)
// Generate task breakdown JSON for developer
const breakdown = {
design_id: `design-${designNum}`,
tasks: taskBreakdown.map((t, i) => ({
id: `task-${i + 1}`,
title: t.title,
files: t.files,
complexity: t.complexity,
dependencies: t.dependencies,
acceptance_criteria: t.acceptance
})),
total_files: [...new Set(taskBreakdown.flatMap(t => t.files))].length,
execution_order: taskBreakdown.map((t, i) => `task-${i + 1}`)
}
Write(breakdownPath, JSON.stringify(breakdown, null, 2))
```
### Phase 4: Design Validation
```javascript
// Verify design completeness
const hasComponents = components.length > 0
const hasBreakdown = taskBreakdown.length > 0
const hasDependencies = components.every(c => c.dependencies !== undefined)
```
### Phase 5: Report to Coordinator + Shared Memory Write
```javascript
sharedMemory.architecture_decisions.push({
design_id: `design-${designNum}`,
approach: selectedApproach,
rationale: rationale,
components: components.map(c => c.name),
task_count: taskBreakdown.length
})
Write(memoryPath, JSON.stringify(sharedMemory, null, 2))
mcp__ccw-tools__team_msg({
operation: "log", team: teamName, from: "architect", to: "coordinator",
type: "design_ready",
summary: `[architect] Design complete: ${components.length} components, ${taskBreakdown.length} tasks`,
ref: designPath
})
SendMessage({
type: "message", recipient: "coordinator",
content: `## [architect] Design Ready\n\n**Components**: ${components.length}\n**Tasks**: ${taskBreakdown.length}\n**Design**: ${designPath}\n**Breakdown**: ${breakdownPath}`,
summary: `[architect] Design: ${taskBreakdown.length} tasks`
})
TaskUpdate({ taskId: task.id, status: 'completed' })
```
## Error Handling
| Scenario | Resolution |
|----------|------------|
| No DESIGN-* tasks | Idle |
| Codebase exploration fails | Design based on task description alone |
| Too many components | Simplify, suggest phased approach |
| Conflicting patterns found | Document in design, recommend resolution |