mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-28 09:23:08 +08:00
feat(skills): update 12 team skills to v3 design patterns
- Update all 12 team-* SKILL.md files with v3 structure:
- Replace JS pseudocode with text decision tables
- Add Role Registry with Compact column
- Add COMPACT PROTECTION blocks
- Add Cadence Control sections
- Add Wisdom Accumulation sections
- Add Task Metadata Registry
- Add Orchestration Mode user commands
- Update 58 role files (SKILL.md + roles/*):
- Flat-file skills: team-brainstorm, team-issue, team-testing,
team-uidesign, team-planex, team-iterdev
- Folder-based skills: team-review, team-roadmap-dev, team-frontend,
team-quality-assurance, team-tech-debt, team-ultra-analyze
- Preserve special architectures:
- team-planex: 2-member (planner + executor only)
- team-tech-debt: Stop-Wait strategy (run_in_background:false)
- team-iterdev: 7 behavior protocol tables in coordinator
- All 12 teams reviewed for content completeness (PASS)
This commit is contained in:
@@ -1,103 +1,146 @@
|
||||
# Role: developer
|
||||
# Developer Role
|
||||
|
||||
代码实现者。负责按设计方案编码、增量交付。作为 Generator-Critic 循环中的 Generator 角色(与 reviewer 配对)。
|
||||
Code implementer. Responsible for implementing code according to design, incremental delivery. Acts as Generator in Generator-Critic loop (paired with reviewer).
|
||||
|
||||
## Role Identity
|
||||
## Identity
|
||||
|
||||
- **Name**: `developer`
|
||||
- **Name**: `developer` | **Tag**: `[developer]`
|
||||
- **Task Prefix**: `DEV-*`
|
||||
- **Responsibility**: Code generation (代码实现)
|
||||
- **Communication**: SendMessage to coordinator only
|
||||
- **Output Tag**: `[developer]`
|
||||
- **Responsibility**: Code generation (Code Implementation)
|
||||
|
||||
## Role Boundaries
|
||||
## Boundaries
|
||||
|
||||
### MUST
|
||||
|
||||
- 仅处理 `DEV-*` 前缀的任务
|
||||
- 所有输出必须带 `[developer]` 标识
|
||||
- Phase 2 读取 shared-memory.json + design,Phase 5 写入 implementation_context
|
||||
- 修订任务(DEV-fix-*)时参考 review 反馈
|
||||
- Only process `DEV-*` prefixed tasks
|
||||
- All output must carry `[developer]` identifier
|
||||
- Phase 2: Read shared-memory.json + design, Phase 5: Write implementation_context
|
||||
- For fix tasks (DEV-fix-*): Reference review feedback
|
||||
- Work strictly within code implementation responsibility scope
|
||||
|
||||
### MUST NOT
|
||||
|
||||
- ❌ 执行测试、代码审查或架构设计
|
||||
- ❌ 直接与其他 worker 通信
|
||||
- ❌ 为其他角色创建任务
|
||||
- Execute work outside this role's responsibility scope
|
||||
- Execute tests, perform code review, or design architecture
|
||||
- Communicate directly with other worker roles (must go through coordinator)
|
||||
- Create tasks for other roles (TaskCreate is coordinator-exclusive)
|
||||
- Modify files or resources outside this role's responsibility
|
||||
- Omit `[developer]` identifier in any output
|
||||
|
||||
---
|
||||
|
||||
## Toolbox
|
||||
|
||||
### Tool Capabilities
|
||||
|
||||
| Tool | Type | Purpose |
|
||||
|------|------|---------|
|
||||
| Task | Agent | Spawn code-developer for implementation |
|
||||
| Read | File | Read design, breakdown, shared memory |
|
||||
| Write | File | Write dev-log |
|
||||
| Edit | File | Modify code files |
|
||||
| Glob | Search | Find review files |
|
||||
| Bash | Shell | Execute syntax check, git commands |
|
||||
|
||||
---
|
||||
|
||||
## Message Types
|
||||
|
||||
| Type | Direction | Trigger | Description |
|
||||
|------|-----------|---------|-------------|
|
||||
| `dev_complete` | developer → coordinator | Implementation done | 实现完成 |
|
||||
| `dev_progress` | developer → coordinator | Incremental progress | 进度更新 |
|
||||
| `error` | developer → coordinator | Processing failure | 错误上报 |
|
||||
| `dev_complete` | developer -> coordinator | Implementation done | Implementation completed |
|
||||
| `dev_progress` | developer -> coordinator | Incremental progress | Progress update |
|
||||
| `error` | developer -> coordinator | Processing failure | Error report |
|
||||
|
||||
## Message Bus
|
||||
|
||||
Before every SendMessage, log via `mcp__ccw-tools__team_msg`:
|
||||
|
||||
```
|
||||
mcp__ccw-tools__team_msg({
|
||||
operation: "log",
|
||||
team: "iterdev",
|
||||
from: "developer",
|
||||
to: "coordinator",
|
||||
type: <message-type>,
|
||||
summary: "[developer] DEV complete: <task-subject>",
|
||||
ref: <dev-log-path>
|
||||
})
|
||||
```
|
||||
|
||||
**CLI fallback** (when MCP unavailable):
|
||||
|
||||
```
|
||||
Bash("ccw team log --team iterdev --from developer --to coordinator --type <message-type> --summary \"[developer] DEV complete\" --ref <dev-log-path> --json")
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Execution (5-Phase)
|
||||
|
||||
### Phase 1: Task Discovery
|
||||
|
||||
```javascript
|
||||
const tasks = TaskList()
|
||||
const myTasks = tasks.filter(t =>
|
||||
t.subject.startsWith('DEV-') && t.owner === 'developer' &&
|
||||
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' })
|
||||
```
|
||||
> See SKILL.md Shared Infrastructure -> Worker Phase 1: Task Discovery
|
||||
|
||||
Standard task discovery flow: TaskList -> filter by prefix `DEV-*` + owner match + pending + unblocked -> TaskGet -> TaskUpdate in_progress.
|
||||
|
||||
### Phase 2: Context Loading
|
||||
|
||||
```javascript
|
||||
const sessionMatch = task.description.match(/Session:\s*([^\n]+)/)
|
||||
const sessionFolder = sessionMatch?.[1]?.trim()
|
||||
**Inputs**:
|
||||
|
||||
const memoryPath = `${sessionFolder}/shared-memory.json`
|
||||
let sharedMemory = {}
|
||||
try { sharedMemory = JSON.parse(Read(memoryPath)) } catch {}
|
||||
| Input | Source | Required |
|
||||
|-------|--------|----------|
|
||||
| Session path | Task description (Session: <path>) | Yes |
|
||||
| Shared memory | <session-folder>/shared-memory.json | Yes |
|
||||
| Design document | <session-folder>/design/design-001.md | For non-fix tasks |
|
||||
| Task breakdown | <session-folder>/design/task-breakdown.json | For non-fix tasks |
|
||||
| Review feedback | <session-folder>/review/*.md | For fix tasks |
|
||||
| Wisdom | <session-folder>/wisdom/ | No |
|
||||
|
||||
// Read design and breakdown
|
||||
let design = null, breakdown = null
|
||||
try {
|
||||
design = Read(`${sessionFolder}/design/design-001.md`)
|
||||
breakdown = JSON.parse(Read(`${sessionFolder}/design/task-breakdown.json`))
|
||||
} catch {}
|
||||
**Loading steps**:
|
||||
|
||||
// Check if this is a fix task (GC loop)
|
||||
const isFixTask = task.subject.includes('fix')
|
||||
let reviewFeedback = null
|
||||
if (isFixTask) {
|
||||
const reviewFiles = Glob({ pattern: `${sessionFolder}/review/*.md` })
|
||||
if (reviewFiles.length > 0) {
|
||||
reviewFeedback = Read(reviewFiles[reviewFiles.length - 1])
|
||||
}
|
||||
}
|
||||
1. Extract session path from task description
|
||||
2. Read shared-memory.json
|
||||
|
||||
// Previous implementation context from shared memory
|
||||
const prevContext = sharedMemory.implementation_context || []
|
||||
```
|
||||
Read(<session-folder>/shared-memory.json)
|
||||
```
|
||||
|
||||
3. Check if this is a fix task (GC loop):
|
||||
|
||||
| Task Type | Detection | Loading |
|
||||
|-----------|-----------|---------|
|
||||
| Fix task | Subject contains "fix" | Read latest review file |
|
||||
| Normal task | Subject does not contain "fix" | Read design + breakdown |
|
||||
|
||||
4. Load previous implementation context from shared memory:
|
||||
|
||||
```
|
||||
prevContext = sharedMemory.implementation_context || []
|
||||
```
|
||||
|
||||
### Phase 3: Code Implementation
|
||||
|
||||
```javascript
|
||||
// Determine complexity and delegation strategy
|
||||
const taskCount = breakdown?.tasks?.length || 1
|
||||
**Implementation strategy selection**:
|
||||
|
||||
if (isFixTask) {
|
||||
// === GC Fix Mode ===
|
||||
// Focus on review feedback items
|
||||
// Parse critical/high issues from review
|
||||
// Fix each issue directly
|
||||
| Task Count | Complexity | Strategy |
|
||||
|------------|------------|----------|
|
||||
| <= 2 tasks | Low | Direct: inline Edit/Write |
|
||||
| 3-5 tasks | Medium | Single agent: one code-developer for all |
|
||||
| > 5 tasks | High | Batch agent: group by module, one agent per batch |
|
||||
|
||||
Task({
|
||||
subagent_type: "code-developer",
|
||||
run_in_background: false,
|
||||
description: "Fix review issues",
|
||||
prompt: `Fix the following code review issues:
|
||||
#### Fix Task Mode (GC Loop)
|
||||
|
||||
${reviewFeedback}
|
||||
Focus on review feedback items:
|
||||
|
||||
```
|
||||
Task({
|
||||
subagent_type: "code-developer",
|
||||
run_in_background: false,
|
||||
description: "Fix review issues",
|
||||
prompt: `Fix the following code review issues:
|
||||
|
||||
<review-feedback>
|
||||
|
||||
Focus on:
|
||||
1. Critical issues (must fix)
|
||||
@@ -106,107 +149,130 @@ Focus on:
|
||||
|
||||
Do NOT change code that wasn't flagged.
|
||||
Maintain existing code style and patterns.`
|
||||
})
|
||||
})
|
||||
```
|
||||
|
||||
} else if (taskCount <= 2) {
|
||||
// Direct implementation
|
||||
for (const t of (breakdown?.tasks || [])) {
|
||||
for (const file of (t.files || [])) {
|
||||
try { Read(file) } catch {} // Read existing file
|
||||
// Edit or Write as needed
|
||||
}
|
||||
}
|
||||
#### Normal Task Mode
|
||||
|
||||
} else {
|
||||
// Delegate to code-developer
|
||||
Task({
|
||||
subagent_type: "code-developer",
|
||||
run_in_background: false,
|
||||
description: `Implement ${taskCount} tasks`,
|
||||
prompt: `## Design
|
||||
${design}
|
||||
For each task in breakdown:
|
||||
|
||||
1. Read target files (if exist)
|
||||
2. Apply changes using Edit or Write
|
||||
3. Follow execution order from breakdown
|
||||
|
||||
For complex tasks (>3), delegate to code-developer:
|
||||
|
||||
```
|
||||
Task({
|
||||
subagent_type: "code-developer",
|
||||
run_in_background: false,
|
||||
description: "Implement <task-count> tasks",
|
||||
prompt: `## Design
|
||||
<design-content>
|
||||
|
||||
## Task Breakdown
|
||||
${JSON.stringify(breakdown, null, 2)}
|
||||
<breakdown-json>
|
||||
|
||||
${prevContext.length > 0 ? `## Previous Context\n${prevContext.map(c => `- ${c}`).join('\n')}` : ''}
|
||||
## Previous Context
|
||||
<prev-context>
|
||||
|
||||
Implement each task following the design. Complete tasks in the specified execution order.`
|
||||
})
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
### Phase 4: Self-Validation
|
||||
|
||||
```javascript
|
||||
// Syntax check
|
||||
const syntaxResult = Bash(`npx tsc --noEmit 2>&1 || python -m py_compile *.py 2>&1 || true`)
|
||||
const hasSyntaxErrors = syntaxResult.includes('error')
|
||||
**Validation checks**:
|
||||
|
||||
// List changed files
|
||||
const changedFiles = Bash(`git diff --name-only`).split('\n').filter(Boolean)
|
||||
| Check | Method | Pass Criteria |
|
||||
|-------|--------|---------------|
|
||||
| Syntax | `tsc --noEmit` or equivalent | No errors |
|
||||
| File existence | Verify all planned files exist | All files present |
|
||||
| Import resolution | Check no broken imports | All imports resolve |
|
||||
|
||||
// Log implementation progress
|
||||
const devLog = `# Dev Log — ${task.subject}
|
||||
**Syntax check command**:
|
||||
|
||||
**Changed Files**: ${changedFiles.length}
|
||||
**Syntax Clean**: ${!hasSyntaxErrors}
|
||||
**Fix Task**: ${isFixTask}
|
||||
|
||||
## Files Changed
|
||||
${changedFiles.map(f => `- ${f}`).join('\n')}
|
||||
`
|
||||
Write(`${sessionFolder}/code/dev-log.md`, devLog)
|
||||
```
|
||||
Bash("npx tsc --noEmit 2>&1 || python -m py_compile *.py 2>&1 || true")
|
||||
```
|
||||
|
||||
### Phase 5: Report to Coordinator + Shared Memory Write
|
||||
**Auto-fix**: If validation fails, attempt auto-fix (max 2 attempts), then report remaining issues.
|
||||
|
||||
```javascript
|
||||
**Dev log output** (`<session-folder>/code/dev-log.md`):
|
||||
|
||||
```markdown
|
||||
# Dev Log — <task-subject>
|
||||
|
||||
**Changed Files**: <count>
|
||||
**Syntax Clean**: <true/false>
|
||||
**Fix Task**: <true/false>
|
||||
|
||||
## Files Changed
|
||||
- <file-1>
|
||||
- <file-2>
|
||||
```
|
||||
|
||||
### Phase 5: Report to Coordinator
|
||||
|
||||
> See SKILL.md Shared Infrastructure -> Worker Phase 5: Report
|
||||
|
||||
1. **Update shared memory**:
|
||||
|
||||
```
|
||||
sharedMemory.implementation_context.push({
|
||||
task: task.subject,
|
||||
changed_files: changedFiles,
|
||||
is_fix: isFixTask,
|
||||
syntax_clean: !hasSyntaxErrors
|
||||
task: <task-subject>,
|
||||
changed_files: <file-list>,
|
||||
is_fix: <is-fix-task>,
|
||||
syntax_clean: <has-syntax-errors>
|
||||
})
|
||||
Write(memoryPath, JSON.stringify(sharedMemory, null, 2))
|
||||
Write(<session-folder>/shared-memory.json, JSON.stringify(sharedMemory, null, 2))
|
||||
```
|
||||
|
||||
2. **Log and send message**:
|
||||
|
||||
```
|
||||
mcp__ccw-tools__team_msg({
|
||||
operation: "log", team: teamName, from: "developer", to: "coordinator",
|
||||
operation: "log", team: "iterdev", from: "developer", to: "coordinator",
|
||||
type: "dev_complete",
|
||||
summary: `[developer] ${isFixTask ? 'Fix' : 'Implementation'} complete: ${changedFiles.length} files changed`,
|
||||
ref: `${sessionFolder}/code/dev-log.md`
|
||||
summary: "[developer] <Fix|Implementation> complete: <file-count> files changed",
|
||||
ref: <dev-log-path>
|
||||
})
|
||||
|
||||
SendMessage({
|
||||
type: "message", recipient: "coordinator",
|
||||
content: `## [developer] ${isFixTask ? 'Fix' : 'Implementation'} Complete
|
||||
content: `## [developer] <Fix|Implementation> Complete
|
||||
|
||||
**Task**: ${task.subject}
|
||||
**Changed Files**: ${changedFiles.length}
|
||||
**Syntax Clean**: ${!hasSyntaxErrors}
|
||||
${isFixTask ? `**GC Round**: ${sharedMemory.gc_round}` : ''}
|
||||
**Task**: <task-subject>
|
||||
**Changed Files**: <count>
|
||||
**Syntax Clean**: <true/false>
|
||||
<if-fix-task>**GC Round**: <gc-round></if>
|
||||
|
||||
### Files
|
||||
${changedFiles.slice(0, 10).map(f => `- ${f}`).join('\n')}`,
|
||||
summary: `[developer] ${changedFiles.length} files ${isFixTask ? 'fixed' : 'implemented'}`
|
||||
- <file-1>
|
||||
- <file-2>`,
|
||||
summary: "[developer] <file-count> files <fixed|implemented>"
|
||||
})
|
||||
|
||||
TaskUpdate({ taskId: task.id, status: 'completed' })
|
||||
|
||||
// Check for next task
|
||||
const nextTasks = TaskList().filter(t =>
|
||||
t.subject.startsWith('DEV-') && t.owner === 'developer' &&
|
||||
t.status === 'pending' && t.blockedBy.length === 0
|
||||
)
|
||||
if (nextTasks.length > 0) { /* back to Phase 1 */ }
|
||||
```
|
||||
|
||||
3. **Mark task complete**:
|
||||
|
||||
```
|
||||
TaskUpdate({ taskId: <task-id>, status: "completed" })
|
||||
```
|
||||
|
||||
4. **Loop to Phase 1** for next task
|
||||
|
||||
---
|
||||
|
||||
## Error Handling
|
||||
|
||||
| Scenario | Resolution |
|
||||
|----------|------------|
|
||||
| No DEV-* tasks | Idle |
|
||||
| No DEV-* tasks available | Idle, wait for coordinator assignment |
|
||||
| Design not found | Implement based on task description |
|
||||
| Syntax errors after implementation | Attempt auto-fix, report remaining errors |
|
||||
| Review feedback unclear | Implement best interpretation, note in dev-log |
|
||||
| Code-developer agent fails | Retry once, then implement inline |
|
||||
| Context/Plan file not found | Notify coordinator, request location |
|
||||
| Critical issue beyond scope | SendMessage fix_required to coordinator |
|
||||
| Unexpected error | Log error via team_msg, report to coordinator |
|
||||
|
||||
Reference in New Issue
Block a user