Loading...
Loading...
Unified team skill for brainstorming team. All roles invoke this skill with --role arg for role-specific execution. Triggers on "team brainstorm".
npx skill4agent add catlog22/claude-code-workflow team-brainstorm--role=xxx┌───────────────────────────────────────────────────┐
│ Skill(skill="team-brainstorm", args="--role=xxx") │
└───────────────────┬───────────────────────────────┘
│ Role Router
┌───────────┬───┼───────────┬───────────┐
↓ ↓ ↓ ↓ ↓
┌──────────┐┌───────┐┌──────────┐┌──────────┐┌─────────┐
│coordinator││ideator││challenger││synthesizer││evaluator│
│ roles/ ││roles/ ││ roles/ ││ roles/ ││ roles/ │
└──────────┘└───────┘└──────────┘└──────────┘└─────────┘$ARGUMENTS--roleconst args = "$ARGUMENTS"
const roleMatch = args.match(/--role[=\s]+(\w+)/)
if (!roleMatch) {
throw new Error("Missing --role argument. Available roles: coordinator, ideator, challenger, synthesizer, evaluator")
}
const role = roleMatch[1]
const teamName = args.match(/--team[=\s]+([\w-]+)/)?.[1] || "brainstorm"const VALID_ROLES = {
"coordinator": { file: "roles/coordinator.md", prefix: null },
"ideator": { file: "roles/ideator.md", prefix: "IDEA" },
"challenger": { file: "roles/challenger.md", prefix: "CHALLENGE" },
"synthesizer": { file: "roles/synthesizer.md", prefix: "SYNTH" },
"evaluator": { file: "roles/evaluator.md", prefix: "EVAL" }
}
if (!VALID_ROLES[role]) {
throw new Error(`Unknown role: ${role}. Available: ${Object.keys(VALID_ROLES).join(', ')}`)
}
// Read and execute role-specific logic
Read(VALID_ROLES[role].file)
// → Execute the 5-phase process defined in that file| Role | Task Prefix | Responsibility | Role File |
|---|---|---|---|
| N/A | 话题澄清、复杂度评估、管道选择、收敛监控 | roles/coordinator.md |
| IDEA-* | 多角度创意生成、概念探索、发散思维 | roles/ideator.md |
| CHALLENGE-* | 魔鬼代言人、假设挑战、可行性质疑 | roles/challenger.md |
| SYNTH-* | 跨想法整合、主题提取、冲突解决 | roles/synthesizer.md |
| EVAL-* | 评分排序、优先级推荐、最终筛选 | roles/evaluator.md |
[role_name]// SendMessage — content 和 summary 都必须带标识
SendMessage({
content: `## [${role}] ...`,
summary: `[${role}] ...`
})
// team_msg — summary 必须带标识
mcp__ccw-tools__team_msg({
summary: `[${role}] ...`
})| 允许 | 禁止 |
|---|---|
| 需求澄清 (AskUserQuestion) | ❌ 直接生成创意 |
| 创建任务链 (TaskCreate) | ❌ 直接评估/挑战想法 |
| 分发任务给 worker | ❌ 直接执行分析/综合 |
| 监控进度 (消息总线) | ❌ 绕过 worker 自行完成任务 |
| 汇报结果给用户 | ❌ 修改源代码或产物文件 |
| 允许 | 禁止 |
|---|---|
| 处理自己前缀的任务 | ❌ 处理其他角色前缀的任务 |
| SendMessage 给 coordinator | ❌ 直接与其他 worker 通信 |
| 读取 shared-memory.json | ❌ 为其他角色创建任务 (TaskCreate) |
| 写入 shared-memory.json (自己的字段) | ❌ 修改不属于本职责的资源 |
const TEAM_CONFIG = {
name: "brainstorm",
sessionDir: ".workflow/.team/BRS-{slug}-{date}/",
msgDir: ".workflow/.team-msg/brainstorm/",
sharedMemory: "shared-memory.json"
}shared-memory.json// Phase 2: 读取共享记忆
const memoryPath = `${sessionFolder}/shared-memory.json`
let sharedMemory = {}
try { sharedMemory = JSON.parse(Read(memoryPath)) } catch {}
// Phase 5: 写入共享记忆(仅更新自己负责的字段)
// ideator → sharedMemory.generated_ideas
// challenger → sharedMemory.critique_insights
// synthesizer → sharedMemory.synthesis_themes
// evaluator → sharedMemory.evaluation_scores
Write(memoryPath, JSON.stringify(sharedMemory, null, 2))mcp__ccw-tools__team_msgmcp__ccw-tools__team_msg({
operation: "log",
team: teamName,
from: role,
to: "coordinator",
type: "<type>",
summary: `[${role}] <summary>`,
ref: "<file_path>"
})| Role | Types |
|---|---|
| coordinator | |
| ideator | |
| challenger | |
| synthesizer | |
| evaluator | |
mcp__ccw-tools__team_msgBash(`ccw team log --team "${teamName}" --from "${role}" --to "coordinator" --type "<type>" --summary "<summary>" --json`)const tasks = TaskList()
const myTasks = tasks.filter(t =>
t.subject.startsWith(`${VALID_ROLES[role].prefix}-`) &&
t.owner === role &&
t.status === 'pending' &&
t.blockedBy.length === 0
)
if (myTasks.length === 0) return // idle
const task = TaskGet({ taskId: myTasks[0].id })
TaskUpdate({ taskId: task.id, status: 'in_progress' })
// Phase 2-4: Role-specific (see roles/{role}.md)
// Phase 5: Report + Loop — 所有输出必须带 [role] 标识
mcp__ccw-tools__team_msg({ operation: "log", team: teamName, from: role, to: "coordinator", type: "...", summary: `[${role}] ...` })
SendMessage({ type: "message", recipient: "coordinator", content: `## [${role}] ...`, summary: `[${role}] ...` })
TaskUpdate({ taskId: task.id, status: 'completed' })
// Check for next task → back to Phase 1Quick:
IDEA-001 → CHALLENGE-001 → SYNTH-001
Deep (Generator-Critic Loop):
IDEA-001 → CHALLENGE-001 → IDEA-002(fix) → CHALLENGE-002 → SYNTH-001 → EVAL-001
Full (Fan-out + Generator-Critic):
[IDEA-001 + IDEA-002 + IDEA-003](parallel) → CHALLENGE-001(batch) → IDEA-004(fix) → SYNTH-001 → EVAL-001IDEA → CHALLENGE → (if critique.severity >= HIGH) → IDEA-fix → CHALLENGE-2 → SYNTH
(if critique.severity < HIGH) → SYNTH.workflow/.team/BRS-{slug}-{YYYY-MM-DD}/
├── team-session.json # Session state
├── shared-memory.json # 累积: generated_ideas / critique_insights / synthesis_themes / evaluation_scores
├── ideas/ # Ideator output
│ ├── idea-001.md
│ ├── idea-002.md
│ └── idea-003.md
├── critiques/ # Challenger output
│ ├── critique-001.md
│ └── critique-002.md
├── synthesis/ # Synthesizer output
│ └── synthesis-001.md
└── evaluation/ # Evaluator output
└── evaluation-001.mdTeamCreate({ team_name: teamName })
// Ideator
Task({
subagent_type: "general-purpose",
team_name: teamName,
name: "ideator",
prompt: `你是 team "${teamName}" 的 IDEATOR。
当你收到 IDEA-* 任务时,调用 Skill(skill="team-brainstorm", args="--role=ideator") 执行。
当前话题: ${taskDescription}
约束: ${constraints}
## 角色准则(强制)
- 你只能处理 IDEA-* 前缀的任务,不得执行其他角色的工作
- 所有输出(SendMessage、team_msg)必须带 [ideator] 标识前缀
- 仅与 coordinator 通信,不得直接联系其他 worker
- 不得使用 TaskCreate 为其他角色创建任务
## 消息总线(必须)
每次 SendMessage 前,先调用 mcp__ccw-tools__team_msg 记录。
工作流程:
1. TaskList → 找到 IDEA-* 任务
2. Skill(skill="team-brainstorm", args="--role=ideator") 执行
3. team_msg log + SendMessage 结果给 coordinator(带 [ideator] 标识)
4. TaskUpdate completed → 检查下一个任务`
})
// Challenger
Task({
subagent_type: "general-purpose",
team_name: teamName,
name: "challenger",
prompt: `你是 team "${teamName}" 的 CHALLENGER。
当你收到 CHALLENGE-* 任务时,调用 Skill(skill="team-brainstorm", args="--role=challenger") 执行。
当前话题: ${taskDescription}
## 角色准则(强制)
- 你只能处理 CHALLENGE-* 前缀的任务
- 所有输出必须带 [challenger] 标识前缀
- 仅与 coordinator 通信
## 消息总线(必须)
每次 SendMessage 前,先调用 mcp__ccw-tools__team_msg 记录。
工作流程:
1. TaskList → 找到 CHALLENGE-* 任务
2. Skill(skill="team-brainstorm", args="--role=challenger") 执行
3. team_msg log + SendMessage 结果给 coordinator(带 [challenger] 标识)
4. TaskUpdate completed → 检查下一个任务`
})
// Synthesizer
Task({
subagent_type: "general-purpose",
team_name: teamName,
name: "synthesizer",
prompt: `你是 team "${teamName}" 的 SYNTHESIZER。
当你收到 SYNTH-* 任务时,调用 Skill(skill="team-brainstorm", args="--role=synthesizer") 执行。
当前话题: ${taskDescription}
## 角色准则(强制)
- 你只能处理 SYNTH-* 前缀的任务
- 所有输出必须带 [synthesizer] 标识前缀
- 仅与 coordinator 通信
## 消息总线(必须)
每次 SendMessage 前,先调用 mcp__ccw-tools__team_msg 记录。
工作流程:
1. TaskList → 找到 SYNTH-* 任务
2. Skill(skill="team-brainstorm", args="--role=synthesizer") 执行
3. team_msg log + SendMessage 结果给 coordinator(带 [synthesizer] 标识)
4. TaskUpdate completed → 检查下一个任务`
})
// Evaluator
Task({
subagent_type: "general-purpose",
team_name: teamName,
name: "evaluator",
prompt: `你是 team "${teamName}" 的 EVALUATOR。
当你收到 EVAL-* 任务时,调用 Skill(skill="team-brainstorm", args="--role=evaluator") 执行。
当前话题: ${taskDescription}
## 角色准则(强制)
- 你只能处理 EVAL-* 前缀的任务
- 所有输出必须带 [evaluator] 标识前缀
- 仅与 coordinator 通信
## 消息总线(必须)
每次 SendMessage 前,先调用 mcp__ccw-tools__team_msg 记录。
工作流程:
1. TaskList → 找到 EVAL-* 任务
2. Skill(skill="team-brainstorm", args="--role=evaluator") 执行
3. team_msg log + SendMessage 结果给 coordinator(带 [evaluator] 标识)
4. TaskUpdate completed → 检查下一个任务`
})| Scenario | Resolution |
|---|---|
| Unknown --role value | Error with available role list |
| Missing --role arg | Error with usage hint |
| Role file not found | Error with expected path (roles/{name}.md) |
| Task prefix conflict | Log warning, proceed |
| Generator-Critic loop exceeds 2 rounds | Force convergence → SYNTH |
| No ideas generated | Coordinator prompts with seed questions |