spawning-plan
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSpawning Plan
Agent生成计划
Design the optimal agent team for the task. Performant, precise, minimal.
Docs: https://code.claude.com/docs/en/agent-teams.md
Task:
$ARGUMENTS为任务设计最优的Agent团队,确保高性能、精准且精简。
文档:https://code.claude.com/docs/en/agent-teams.md
任务:
$ARGUMENTSStep 1: Context Gathering (Silent — no user interaction)
步骤1:上下文收集(静默执行——无需用户交互)
A) Read environment:
- — workflow rules, conventions, constraints
CLAUDE.md - Project manifests — ,
package.json,pyproject.toml,Cargo.toml, etc.go.mod - Directory structure — ,
src/,app/, test dirs, monorepo indicatorspackages/
B) Inventory existing agents:
- Scan — reuse matching agents instead of creating duplicates
~/.claude/agents/*.md
C) Analyze task complexity:
- Work type: research, implementation, review, debugging, refactoring
- Scope: single-layer vs cross-layer
- Parallelism: can work split into independent streams?
- Complexity → team size: simple (2 agents), medium (3-4), complex cross-cutting (5-6, max 8)
A) 读取环境信息:
- — 工作流规则、约定、约束条件
CLAUDE.md - 项目清单文件 — 、
package.json、pyproject.toml、Cargo.toml等go.mod - 目录结构 — 、
src/、app/、测试目录、单体仓库标识packages/
B) 盘点现有Agent:
- 扫描— 复用匹配的Agent,避免重复创建
~/.claude/agents/*.md
C) 分析任务复杂度:
- 工作类型:研究、实现、评审、调试、重构
- 范围:单层 vs 跨层
- 并行性:工作是否可拆分为独立流?
- 复杂度→团队规模:简单任务(2个Agent)、中等任务(3-4个)、复杂跨领域任务(5-6个,最多8个)
Step 2: Ask Team Questions (AskUserQuestion Tool)
步骤2:询问团队相关问题(使用AskUserQuestion工具)
Ask 3-5 questions based on Step 1 findings. Not all apply every time — pick what matters.
-
Team Composition — "For this [work type] on [stack], I'm thinking [N] agents: [role list]. What would you change?" Options: Perfect / Add role / Remove role / Different approach
-
Coordination — "How should agents work together?" Options: Independent (no messaging) / Team (peer messaging) / Hub-spoke (lead coordinates)
-
Dependencies — "Work order?" Options: All parallel / Sequential (A→B→C) / Mixed
-
Models — "Model allocation: opus (research), sonnet (implementation), haiku (scanning). Adjust?" Options: As suggested / All opus / All sonnet / Custom
-
Agent Reuse (only if matching agents found in Step 1B) — "Found existingthat handles [capability]. Reuse it?" Options: Reuse / Create fresh / Both
[agent-name]
基于步骤1的结果,提出3-5个问题。无需每次都问所有问题,仅选择相关的即可。
-
团队构成 — "针对[工作类型]任务,基于[技术栈],我计划配置[N]个Agent:[角色列表]。您有什么调整建议?" 选项:完美 / 添加角色 / 删除角色 / 更换方案
-
协作方式 — "Agent之间应如何协作?" 选项:独立协作(无消息交互)/ 团队协作(对等消息交互)/ 中心辐射模式(由主导Agent协调)
-
依赖关系 — "工作执行顺序?" 选项:全部并行 / 顺序执行(A→B→C)/ 混合模式
-
模型分配 — "模型分配方案:opus(研究任务)、sonnet(实现任务)、haiku(扫描任务)。是否需要调整?" 选项:按建议执行 / 全部使用opus / 全部使用sonnet / 自定义配置
-
Agent复用 (仅当步骤1B中找到匹配的Agent时询问) — "发现现有可处理[能力范围]。是否复用该Agent?" 选项:复用 / 创建新Agent / 两者结合
[agent-name]
Step 3: Output & Approval
步骤3:输出计划并获取批准
Present clean TEAM PLAN:
undefined呈现格式清晰的TEAM PLAN:
undefinedTEAM PLAN
TEAM PLAN
Task: [description]
Pattern: [independent | team | hub-spoke]
Work Order: [parallel | sequential | mixed]
Agents: [count]
Task: [description]
Pattern: [independent | team | hub-spoke]
Work Order: [parallel | sequential | mixed]
Agents: [count]
Teammates
Teammates
-
Teammate 1: [Name] ([Role]) Description: [1-2 line expertise and specialization] Model: [opus|sonnet|haiku] Type: [general-purpose | feature-dev:code-X | reuse ~/.claude/agents/X.md] Responsible for: [specific deliverable] Depends on: [— | Teammate N]
-
Teammate 2: [Name] ([Role]) Description: [1-2 line expertise and specialization] Model: [opus|sonnet|haiku] Type: [general-purpose | feature-dev:code-X] Responsible for: [specific deliverable] Depends on: [— | Teammate N]
-
...
-
Teammate 1: [Name] ([Role]) Description: [1-2 line expertise and specialization] Model: [opus|sonnet|haiku] Type: [general-purpose | feature-dev:code-X | reuse ~/.claude/agents/X.md] Responsible for: [specific deliverable] Depends on: [— | Teammate N]
-
Teammate 2: [Name] ([Role]) Description: [1-2 line expertise and specialization] Model: [opus|sonnet|haiku] Type: [general-purpose | feature-dev:code-X] Responsible for: [specific deliverable] Depends on: [— | Teammate N]
-
...
Research (injected into agent prompts)
Research (injected into agent prompts)
- [key finding or best practice 1]
- [key finding or best practice 2]
undefined- [key finding or best practice 1]
- [key finding or best practice 2]
undefinedFinal Approval (AskUserQuestion Tool)
最终批准(使用AskUserQuestion工具)
"Launch this team?"
- Deploy & Save — spawn agents and save as reusable skill
- Deploy Once — spawn agents, one-time
- Adjust — change something (iterate plan)
- Cancel — abortDeploy & Save → save team as skill at for future use via . Saved skill skips planning, bakes in agent definitions, uses for task input.
~/.claude/skills/<team-name>/SKILL.md/<team-name> [task]$ARGUMENTSAdjust → ask what to change → regenerate plan → ask again. Loop until approved.
Deploy Once → spawn immediately, no save.
Cancel → stop.
"是否启动该团队?"
- Deploy & Save — 生成Agent并保存为可复用Skill
- Deploy Once — 生成Agent,仅单次使用
- Adjust — 修改计划(迭代调整)
- Cancel — 终止操作Deploy & Save → 将团队保存为Skill,存储路径为,后续可通过调用。已保存的Skill会跳过规划步骤,内置Agent定义,使用作为任务输入。
~/.claude/skills/<team-name>/SKILL.md/<team-name> [task]$ARGUMENTSAdjust → 询问需要修改的内容→重新生成计划→再次获取批准。循环直至获得批准。
Deploy Once → 立即生成Agent,不保存。
Cancel → 停止操作。
Spawning Execution
生成执行逻辑
Based on chosen pattern:
- Independent: parallel Task tool calls, one per agent
- Team: TeamCreate → TaskCreate per agent → Task tool with → TaskUpdate for dependencies
team_name - Hub-spoke: TeamCreate with lead agent (opus) that delegates via SendMessage
For detailed agent prompt structure, see references/agent-prompts.md.
根据所选模式执行:
- 独立模式:并行调用Task工具,每个Agent对应一次调用
- 团队模式:先执行TeamCreate→为每个Agent执行TaskCreate→调用带参数的Task工具→针对依赖项执行TaskUpdate
team_name - 中心辐射模式:创建包含主导Agent(opus模型)的团队,由主导Agent通过SendMessage指令分配任务
关于Agent提示词的详细结构,请参考references/agent-prompts.md。