
Agent Teams Playbook
- 293 installs
- 160 repo stars
- Updated July 18, 2026
- kimyx0207/agent-teams-playbook
agent-teams-playbook is a cross-runtime Claude Code skill that generates executable multi-agent orchestration plans with a 6-stage workflow, 5 scenario templates, and skill-discovery fallback chains for developers who ne
About
agent-teams-playbook is a version 4.7 orchestration skill for Claude Code, Codex, OpenClaw, and Cursor that turns complex coding work into governed multi-agent runs. The playbook enforces six stages—planning setup, task analysis and skill discovery, team assembly, parallel execution, quality review, and delivery—before any teammate starts work. A mandatory 3-step fallback chain scans local skills, calls find-skills for external matches, then degrades to general-purpose subagents when nothing fits. Five orchestration scenarios range from prompt enhancement to Lead-Member and composite patterns, with planning files (task_plan.md, findings.md, progress.md) and team blueprints as concrete outputs. Developers reach for agent-teams-playbook when cross-file refactors, multi-role reviews, or parallel code generation exceed what a single agent session should own.
- Multi-agent role design
- Handoff patterns
- Review loops
- Team topology templates
- Production agent ops
Agent Teams Playbook by the numbers
- 293 all-time installs (skills.sh)
- Ranked #2,333 of 16,546 AI & Agent Building skills by installs in the Skillselion catalog
- Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/kimyx0207/agent-teams-playbook --skill agent-teams-playbookAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 293 |
|---|---|
| repo stars | ★ 160 |
| Last updated | July 18, 2026 |
| Repository | kimyx0207/agent-teams-playbook ↗ |
How do you orchestrate multi-agent coding teams with quality gates?
Design and run multi-agent teams with clear roles, handoffs, and review loops when building autonomous workflows or coding agents for production tasks.
Who is it for?
Developers coordinating 3+ parallel coding agents across Claude Code, Codex, OpenClaw, or Cursor on cross-file refactors, multi-dimensional reviews, or large parallel code generation.
Skip if: Developers handling single-file edits, simple Q&A, or linear one-agent tasks that do not need role splits, skill discovery, or staged quality review.
When should I use this skill?
User asks to create agent teams, orchestrate parallel agents, coordinate multi-agent collaboration, or run swarm-style coding workflows with explicit roles and handoffs.
What you get
Team blueprint tables, task_plan.md, findings.md, progress.md, execution summary report, and deployment handoff checklist
- team blueprint table
- task_plan.md findings.md progress.md
- staged execution and delivery report
By the numbers
- Defines a 6-stage orchestration workflow (stages 0–5)
- Includes 5 orchestration scenarios from prompt enhancement to composite Lead-Member patterns
- Version 4.7 with a mandatory 3-step skill fallback chain and up to 5 recommended parallel agents
Files
Agent Teams 编排手册
作为 Agent Teams 协调器,你的职责包括:明确每个角色的职责边界、把控执行过程、对最终产品质量负责。
核心理解(铁律):Agent Teams 是"并行处理 + 结果汇总"模式,不是扩大单个 agent 的上下文窗口。每个 teammate 是独立的执行单元,拥有独立上下文,可以并行处理大量信息,但最终需要将结果汇总压缩后返回主会话。
跨平台兼容层(新增,不替代原流程)
本 Skill 的完整 6 阶段工作流、Skill 回退链、Agent → Skill 委派模式、质量把关和故障处理规则仍然保留。四个平台的差异只影响"用什么工具执行",不影响"是否执行这些阶段"。
先识别当前平台,再把下列抽象动作映射到平台原生能力。不要在非 Claude Code 平台原样承诺 Task、TeamCreate、SendMessage 或 Skill(...) 一定存在;也不要因为平台工具名不同而跳过阶段0-5。
| 抽象动作 | Claude Code | Codex | OpenClaw | Cursor |
|---|---|---|---|---|
| 调用 Skill | Skill(skill="name", args="...") 或 slash skill | 读取并遵循本地 skill 指令;只有宿主暴露 skill 工具时才称为"调用" | 读取并遵循 openclaw/skills 或全局 skill;按 OpenClaw 当前工具执行 | 读取并遵循 .cursor/skills 或全局 skill;按 Cursor 当前 agent 能力执行 |
| 启动独立 Subagent | Task(...) | 宿主提供的 custom-agent / subagent dispatch;不可用则主线程分阶段执行 | workspace / agent 调度能力;不可用则主线程分阶段执行 | background agent / agent mode;不可用则主线程分阶段执行 |
| 组建 Agent Team | TeamCreate + Task(team_name) | 多个独立 subagent + 主线程汇总;无共享团队总线承诺 | team / workspace 能力存在时使用;否则多个任务或主线程 | background agents / team-like workflow 存在时使用;否则多个任务或主线程 |
| 成员通信/进度 | SendMessage 或 task result | 子任务结束汇报;有 agent I/O 工具才可中途交互 | 平台消息/日志;不可用时用阶段性文本汇报 | IDE/agent 日志;不可用时用阶段性文本汇报 |
| 规划文件 | planning-with-files skill | 若本地 skill/tool 存在则使用;否则使用内联计划或平台计划工具 | 若本地 planning skill 存在则使用;否则维护可见计划记录 | 若本地 planning skill 存在则使用;否则维护可见计划记录 |
平台适配底线: 1. 写计划时使用抽象动作名;执行时使用当前平台真实工具名。 2. 只有 Claude Code 可以承诺官方 Task / TeamCreate / SendMessage 语义。 3. Codex 中只有宿主实际暴露并调用了 subagent/custom-agent 工具,才代表真的触发后台 agent;没有真实工具调用就不能说 agent 群已启动。 4. OpenClaw/Cursor 的 team 能力可能来自项目插件、workspace 或 IDE 能力;先探测,再承诺。 5. 若平台不支持真正并行或团队通信,明确降级为"主线程分阶段执行",但仍执行阶段0-5的治理流程。
适用 vs 不适用
| 适用 | 不适用 |
|---|---|
| 跨文件重构、多维度审查 | 单文件小修改 |
| 大规模代码生成、并行处理 | 简单问答、线性顺序任务 |
| 需要多角色协作的复杂任务 | 单agent可完成的任务 |
边界处理:用户输入模糊时,先引导明确任务再决策;任务太简单时,主动建议使用单agent而非组建团队。
用户可见性铁律
1. 每个阶段启动前输出计划,完成后输出结果 2. 子agent在后台执行,但进度必须汇报给用户 3. 任务拆分计划必须经用户确认后再执行;若宿主平台或项目指令要求直接执行,则说明采用的默认假设 4. 失败时立即通知:❌ [角色名] 失败: [原因],提供重试/跳过/终止选项 5. 全部完成后输出汇总报告(见阶段5格式),并说明真实使用的平台工具和任何降级路径
场景决策树
执行顺序:先执行阶段0和阶段1(强制),再根据任务复杂度选择场景(影响阶段2-5)。
| 问题 | 路径 |
|---|---|
| Q0: 阶段1找到完全匹配的Skill? | 是 → 场景2 / 否 → Q1 |
| Q1: 任务复杂度? | 简单(1-2步) → 场景1 / 中等(3-5步) → 场景3 / 复杂(6+步) → Q2 |
| Q2: 需要明确团队分工? | 是 → 场景4 / 否 → 场景5 |
- 用户直接指定场景编号时,跳过决策树直接执行
- 未指定场景时,默认用场景3(计划+评审)
- 注意:阶段0(planning-with-files)和阶段1(Skill搜索,包含 find-skills)是所有场景的强制前置步骤
5大编排场景
| # | 场景 | 适用条件 | 核心策略 |
|---|---|---|---|
| 1 | 提示增强 | 简单任务,1-2步 | 优化单agent提示词,不拆分不组队 |
| 2 | Skill直接复用 | 任务可由单个Skill完全解决 | 执行规划和Skill搜索后,直接调用匹配的Skill,无需组建Agent Teams |
| 3 | 计划+评审 | 中等/复杂任务(默认) | 出计划 → 用户确认 → 并行执行 → Review验收 |
| 4 | Lead-Member | 需要明确团队分工 | Leader协调分配,Member并行执行,通过TaskList协同 |
| 5 | 复合编排 | 复杂任务,无固定模式 | 动态组合上述场景,按阶段切换策略 |
模型分工(所有场景通用):通过平台支持的模型选择能力按任务复杂度分配;Claude Code 可通过 Task 工具的 model 参数分配——opus处理复杂推理,haiku处理简单任务,sonnet处理常规任务。平台不支持模型选择时,不要写死模型承诺。
协作模式
| 模式 | 通信方式 | 适用场景 | Claude Code 启动方式 | Codex 启动方式 | OpenClaw / Cursor 启动方式 |
|---|---|---|---|---|---|
| Subagent | 子agent → 主协调器单向汇报 | 并行独立任务 | Task工具 | 宿主提供的 subagent/custom-agent dispatch;不可用则主线程分阶段执行 | 平台 agent/background/workspace 能力;不可用则主线程分阶段执行 |
| Agent Team | 成员间可双向通信(SendMessage) | 需要协作的复杂任务 | TeamCreate + Task(team_name) | 多个独立 subagent + 主线程协调;仅在宿主暴露 agent I/O 时中途交互 | 平台 team/workspace/background-agent 能力;没有则降级 |
选择原则:任务间无依赖用Subagent(简单高效),任务间需要协调用Agent Team(功能更强但成本更高)。如果当前平台没有真正的 team bus,只能称为"多个独立 subagent + 主线程汇总",不能伪装成成员间双向协作。
6阶段工作流(含强制规划和Skill搜索)
重要说明:阶段0和阶段1是所有场景的强制前置步骤,场景选择(1-5)只影响阶段2-5的执行方式。
阶段0:规划准备(Planning Setup)【硬性标准 - 所有场景必经】
优先使用当前平台的 Skill 工具调用 planning-with-files:
Skill(skill="planning-with-files")跨平台适配:
- Claude Code:优先使用
Skill(skill="planning-with-files") - Codex:若本地 skill/tool 可用则使用;否则使用平台计划工具或内联计划,并明确说明没有创建 planning files
- OpenClaw/Cursor:若本地 planning skill 可用则使用;否则维护平台可见计划记录
这将在项目目录创建三个核心文件(当 planning-with-files 可用时):
task_plan.md- 任务计划和阶段追踪findings.md- 研究发现和知识积累progress.md- 执行日志和进度记录
关键规则(规划文件创建后遵循):
- 每个阶段开始前读取task_plan.md,完成后更新状态
- 每2次搜索/浏览操作后立即保存发现到findings.md
- 所有错误必须记录到task_plan.md的"Errors Encountered"表格
- 3次失败后升级给用户
铁律:复杂任务不能没有计划就开始执行。若平台没有 planning-with-files,也必须使用等价计划记录或内联计划,不能跳过规划阶段。
阶段1:任务分析 + Skill发现(Discovery)【硬性标准 - 所有场景必经】
先质疑再执行:
- 需求不合理时主动挑战假设,建议更好的方案
- 区分"现在必须做"和"以后再说",排除非核心范围
- 任务太大时建议更聪明的起点
- 先描述所需能力,再匹配 agent / skill / tool,避免 name-first 调度
输出任务总览:
| 字段 | 内容 |
|---|---|
| 任务目标 | [一句话描述] |
| 预期结果 | [具体交付物] |
| 验收标准 | [可量化的通过条件] |
| 范围界定 | [must-have vs add-later] |
| 当前平台 | [Claude Code / Codex / OpenClaw / Cursor / Unknown] |
| 预计Agent数 | [N个,建议≤5] |
| 选定场景 | [场景编号+名称] |
| 协作模式 | [Subagent/Agent Team/Degraded] |
Skill完整回退链(强制执行,不可跳过):
对每个子任务执行以下3步fallback chain:
1. 本地Skill扫描:
- 读取当前运行时可见的 available skills / agents / tools / capability index
- 提取每个skill的名称和触发词/描述
- 将子任务关键词与skill触发词比对
- 匹配成功 → 标注
[Skill: skill-name],进入阶段2直接调用
2. 外部Skill搜索(本地无匹配时):
- 平台提供 Skill 工具时调用 find-skills:
Skill(skill="find-skills", args="子任务关键词")- 平台没有 Skill 工具时,使用可用的外部能力搜索方式;没有搜索能力时向用户说明降级
- 搜索到 → 向用户推荐:
npx skills add <owner/repo@skill-name> -g -y - 用户确认安装 → 标注新skill,进入阶段2调用
- 用户拒绝或平台无法安装 → 继续第3步
3. 通用Subagent回退(外部也无匹配时):
- 平台支持 subagent 时,该角色改用通用subagent
- 平台不支持 subagent 时,该角色改用主线程分阶段执行
- 在团队蓝图中标注
[Type: general-purpose]或[Degraded: main-thread staged execution]
铁律:这3步必须全部执行完才能进入阶段2。不允许跳过find-skills搜索;若平台没有 find-skills 或 Skill 工具,必须显式记录降级原因。
阶段2:团队组建
输出团队蓝图:
| 编号 | 角色 | 职责 | 模型 | subagent_type | Skill/Type | 平台工具/降级 |
|---|---|---|---|---|---|---|
| 1 | [角色名] | [具体职责] | [opus/sonnet/haiku/平台默认] | [agent类型] | [Skill: name] 或 [Type: general-purpose] | [Task/spawn/custom-agent/main-thread] |
说明:最后两列标注该角色使用的Skill名称(阶段1已匹配)或通用类型(fallback),以及当前平台真实使用的工具或降级路径。
阶段3:并行执行
- Skill任务:用当前平台的 Skill 调用机制调用本地已安装的skill;Claude Code 示例:
Skill(skill="skill-name", args="任务描述") - 通用任务:用当前平台 subagent 工具生成subagent;Claude Code 对应
Task,Codex/OpenClaw/Cursor 使用宿主实际暴露的 agent dispatch - 混合编排时skill和subagent可并行运行;平台不支持并行时按阶段顺序执行并说明降级
- 每个agent/skill完成后汇报:
✅ [角色名] 完成: [一句话结果] - 遇到问题时给用户选项,而不是自己默默选一个
Agent → Skill 委派(子agent调用skill的3种模式):
general-purpose类型的subagent在 Claude Code 中通常拥有所有工具权限,包括Skill工具;其他平台必须先确认当前宿主是否给子agent开放等价 skill/tool 权限。
| 模式 | 流程 | 适用场景 |
|---|---|---|
| 协调器直调 | 协调器 → Skill(skill="name") 或平台等价调用 → 结果 | 单步Skill任务,无需并行 |
| 委派式调用 | 协调器 → subagent prompt="请使用 /skill-name 完成 X" → subagent → Skill/tool 或内联执行 → 汇报 | 并行多个Skill,或Skill耗时较长 |
| 团队成员调用 | team/subagents → 分配任务 → member → Skill/tool 或内联执行 → 汇报 | 需要成员间协调的复杂任务 |
委派式调用关键点:Task/subagent prompt 中写明要调用的Skill名称和参数;只有平台支持 skill 工具时才承诺自动调用,否则按 Skill 文档内联执行并说明。
阶段4:质量把关 & 产品打磨
验收检查:对照阶段1的验收标准逐项检查。
产品打磨(不仅功能完整,更要用户体验优秀):
- 边界处理:异常输入、空值、极端情况是否覆盖
- 专业度:命名规范、代码风格、错误提示是否友好
- 完整性:文档、配置说明、使用示例是否齐全
- 平台诚实性:是否准确说明了真实调用的工具和降级行为
全部通过 → 进入阶段5。不通过 → 打回修改,最多2轮,仍不通过则通知用户人工介入。
阶段5:结果交付 & 部署移交
输出执行报告:
| 项目 | 内容 |
|---|---|
| 总任务数 | X个,成功Y个,失败Z个 |
| 实际平台工具 | 使用了哪些真实工具 / 是否降级 |
| 各Agent结果 | [角色]: [状态] - [关键产出] |
| 汇总结论 | [综合所有结果的最终结论] |
| 后续建议 | [当前未覆盖但值得做的改进方向] |
部署移交(按需提供):
- 运行方式:启动命令、环境要求、配置说明
- 验证步骤:用户可自行验证的操作清单
- 已知限制:当前版本的边界和约束
执行底线
【硬性标准】: 0. 强制使用 planning-with-files 或平台等价计划机制:任何复杂任务必须先创建/维护 task_plan.md、findings.md、progress.md,或显式说明使用了平台等价计划记录 1. 强制执行Skill完整回退链:本地扫描 → Skill(skill="find-skills", args="...") 或平台等价搜索 → 通用subagent/主线程降级,不允许跳过任何步骤
【其他原则】: 2. 先目标,后组织结构——任务不清晰时先澄清,再决定是否组建团队 3. 队伍规模由任务复杂度决定,并行Agent建议不超过5个 4. 关键里程碑必须有质量闸门和回滚点 5. 不默认任何外部工具可用,执行前先验证(含find-skills) 6. 浏览器多窗口默认互相独立,不共享上下文 7. 成本只是约束,不是固定承诺——不做不切实际的成本预估 8. 危险操作、大规模变更必须先获得用户确认或遵守宿主平台审批规则 9. 不承诺平台没有的能力;尤其不要在 Codex/OpenClaw/Cursor 中直接承诺 Claude Code 的 TeamCreate
故障处理
| 故障类型 | 处理策略 |
|---|---|
| Agent执行失败 | 通知用户,提供重试/跳过/终止/降级选项 |
| Skill不可用 | 按回退链降级:本地Skill → find-skills/平台等价搜索 → 通用subagent → 主线程分阶段执行 |
| 平台工具缺失 | 改用该平台可用工具,并明确说明降级路径 |
| 模型超时 | 调整任务复杂度或拆分为更小的子任务 |
| 质量不达标 | 打回修改最多2轮,仍不通过则人工介入 |
| 上下文溢出 | 拆分为更小的子任务,分批执行 |
MIT License
Copyright (c) 2025 KimYx0207
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
English | 中文
Agent Teams Orchestration Playbook
<div align="center">
A Claude Code Skill for generating executable multi-agent (Agent Teams) orchestration strategies
</div>
---
Overview
agent-teams-playbook is a Claude Code-first Skill for generating executable multi-agent orchestration strategies.
Core Concept: "Swarm" is the generic industry term; Claude Code's official concept is Agent Teams. Each teammate is an independent Claude Code instance with its own context window. Agent Teams = "parallel external brains + summarized compression", not "single brain expansion".
The core philosophy is "adaptive decision-making" rather than "hardcoded configuration", designed for real-world uncertainty:
- Skill/tool availability changes
- Multi-session or multi-window context forks
- Quality, speed, and cost objective conflicts
Trigger Methods
Natural Language Triggers:
- agent teams, agent swarm, multi-agent, agent collaboration, agent orchestration, parallel agents
- multi-agent collaboration, swarm orchestration, agent team
Skill Command:
/agent-teams-playbook [task description]
Installation
Option 1: CLI Installation (Recommended)
git clone https://github.com/KimYx0207/agent-teams-playbook.git
cd agent-teams-playbook
chmod +x scripts/install.sh
./scripts/install.shOption 2: Manual Installation
mkdir -p ~/.claude/skills/agent-teams-playbook
cp SKILL.md ~/.claude/skills/agent-teams-playbook/
cp README.md ~/.claude/skills/agent-teams-playbook/Verify Installation
# Use Skill command
/agent-teams-playbook my task description
# Or use natural language
Help me build an Agent team to complete this task...Core Design Principles
1. Goals first, then organization — clarify the task before assembling a team 2. Team size depends on task complexity, parallel Agents recommended <=5 3. Skill fallback chain: local Skill scan → find-skills external search → general-purpose subagent 4. Model assignment: use Task tool's model parameter by complexity (opus/sonnet/haiku) 5. Never assume external tools are available — verify before execution 6. Critical milestones must have quality gates and rollback points 7. Cost is a constraint, not a fixed commitment 8. Skill Discovery is purely dynamic — scan available Skills from system-reminder, never hardcode
Required Skill Dependencies
| Skill | Purpose | Stage |
|---|---|---|
| planning-with-files | Manus-style file planning: task_plan.md, findings.md, progress.md | Stage 0 (mandatory) |
| find-skills | External skill search and discovery | Stage 1 (Skill fallback chain) |
5 Orchestration Scenarios
| # | Scenario | When to Use | Strategy |
|---|---|---|---|
| 1 | Prompt Enhancement | Simple tasks, 1-2 steps | Optimize single agent prompt, no splitting |
| 2 | Direct Skill Reuse | Task solvable by a single Skill | Plan + search, then call matching Skill directly |
| 3 | Plan + Review | Medium/complex tasks (default) | Plan → user confirms → parallel execution → review |
| 4 | Lead-Member | Clear team division needed | Leader coordinates, Members execute in parallel |
| 5 | Composite Orchestration | Complex tasks, no fixed pattern | Dynamically combine above scenarios |
6-Stage Workflow
Stage 0: Planning Setup → Stage 1: Task Analysis + Skill Discovery → Stage 2: Team Assembly → Stage 3: Parallel Execution → Stage 4: Quality Gate → Stage 5: DeliveryNote: Stage 0 (planning-with-files) and Stage 1 (Skill search, including find-skills) are mandatory prerequisites for all scenarios.
Collaboration Modes
| Mode | Communication | Use Case | Launch |
|---|---|---|---|
| Subagent | One-way: child → coordinator | Parallel independent tasks | Task tool |
| Agent Team | Bidirectional (SendMessage) | Complex collaborative tasks | TeamCreate + Task(team_name) |
Agent → Skill Delegation Patterns
| Pattern | Flow | Best For |
|---|---|---|
| Direct Call | Coordinator → Skill → result | Single-step Skill tasks |
| Delegated Call | Coordinator → Task(prompt) → subagent → Skill → report | Parallel Skills, long-running |
| Team Member Call | TeamCreate → assign → member → Skill → SendMessage | Complex coordinated tasks |
Repository Structure
agent-teams-playbook/
├── SKILL.md # Runtime loaded (concise, ~170 lines)
└── README.md # Developer documentation (full details)Compatibility
- Primary platform: Claude Code
Context Mode (Optional)
Default: no context: fork. The 6-stage workflow runs in the main session. Add context: fork to SKILL.md frontmatter for isolated execution.
Non-Goals
This Skill will NOT:
- Force fixed team structures
- Force single Skill dependencies
- Promise fixed speed/cost multipliers
- Claim capabilities beyond Claude Code's actual limits
---
Version: V4.5 | Last Updated: 2026-02-14 | Maintainer: KimYx0207
中文 | English
Agent Teams 编排手册
<div align="center">
</div>
老金的开源知识库,实时更新群二维码:https://my.feishu.cn/wiki/OhQ8wqntFihcI1kWVDlcNdpznFf
📞 联系方式
<div align="center"> <img src="images/二维码基础款.png" alt="联系方式" width="600"/> <p><strong>获取更多AI资讯和技术支持</strong></p> <p>微信公众号:获取AI第一信息 | 个人微信号:备注'AI'加群交流</p> </div>
☕ 请我喝杯咖啡
<div align="center"> <p><strong>如果这个教程对你有帮助,欢迎打赏支持!</strong></p> <table align="center"> <tr> <td align="center"> <img src="images/微信.jpg" alt="微信收款码" width="300"/> <br/> <strong>微信支付</strong> </td> <td align="center"> <img src="images/支付宝.jpg" alt="支付宝收款码" width="300"/> <br/> <strong>支付宝</strong> </td> </tr> </table> </div>
---
概述
agent-teams-playbook 是一个跨运行时 Skill,用于生成可执行的多代理(Agent Teams)编排策略,兼容 Claude Code、Codex、OpenClaw、Cursor 四个平台。
核心理解:"swarm/蜂群"是通用行业说法,Claude Code的官方概念是 Agent Teams。其他运行时不一定有同名工具,但可以用各自的 subagent/background-agent/workspace 能力实现同一套"并行外脑 + 汇总压缩"编排合同。Agent Teams 不是"单脑扩容"——并行读取/处理的总量可以很大,但回到主会话仍需总结压缩。
核心思想是"自适应决策",而不是"写死配置"。面向真实运行环境中的不确定性:
- Skill/工具/agent 能力可用性变化
- 四个平台工具名不同、能力不完全等价
- 多会话或多窗口上下文分叉
- 质量、速度、成本目标冲突
触发方式
自然语言触发词:
- agent teams、agent swarm、多agent、agent协作、agent编排、并行agent
- 分工协作、拉团队、多代理协作、swarm编排、agent团队
- multi-agent、orchestration、agent team
Skill命令(Claude Code 或支持 slash skill launcher 的运行时):
/agent-teams-playbook [任务描述]
安装方式
方式一:命令行安装(推荐)
# 克隆仓库
git clone https://github.com/KimYx0207/agent-teams-playbook.git
# 运行安装脚本(Unix / Git Bash / WSL)
cd agent-teams-playbook
chmod +x scripts/install.sh
# 安装到 Claude Code(默认)
./scripts/install.sh
# 安装到指定平台
./scripts/install.sh --target codex
./scripts/install.sh --target openclaw
./scripts/install.sh --target cursor
# 一次安装到四个平台
./scripts/install.sh --target all
# 从 GitHub main 下载安装,而不是复制当前本地 checkout
./scripts/install.sh --target all --from-github方式二:手动安装
# Claude Code
mkdir -p ~/.claude/skills/agent-teams-playbook
cp SKILL.md ~/.claude/skills/agent-teams-playbook/
cp README.md ~/.claude/skills/agent-teams-playbook/
# Codex
mkdir -p ~/.codex/skills/agent-teams-playbook
cp SKILL.md ~/.codex/skills/agent-teams-playbook/
cp README.md ~/.codex/skills/agent-teams-playbook/
# OpenClaw(默认全局 skill 根目录;项目也可使用 openclaw/skills/)
mkdir -p ~/.agents/skills/agent-teams-playbook
cp SKILL.md ~/.agents/skills/agent-teams-playbook/
cp README.md ~/.agents/skills/agent-teams-playbook/
# Cursor
mkdir -p ~/.cursor/skills/agent-teams-playbook
cp SKILL.md ~/.cursor/skills/agent-teams-playbook/
cp README.md ~/.cursor/skills/agent-teams-playbook/安装脚本支持通过环境变量覆盖目标根目录:
| 平台 | 环境变量 | 默认目录 |
|---|---|---|
| Claude Code | CLAUDE_SKILLS_DIR | ~/.claude/skills |
| Codex | CODEX_SKILLS_DIR | ~/.codex/skills |
| OpenClaw | OPENCLAW_SKILLS_DIR | ~/.agents/skills |
| Cursor | CURSOR_SKILLS_DIR | ~/.cursor/skills |
验证安装
安装完成后,你可以通过以下方式使用:
# Claude Code 使用 Skill 命令
/agent-teams-playbook 我的任务描述
# 或使用自然语言
帮我组建一个Agent团队来完成这个任务...
# Codex / OpenClaw / Cursor
# 使用自然语言触发;运行时会按各自平台工具映射执行
帮我拉一个 agent team 来审查这个重构方案核心设计原则
1. 先目标,后组织结构——任务不清晰时先澄清,不急着组队 2. 队伍规模由任务复杂度决定,并行Agent建议不超过5个 3. 能力回退链:本地 Skill/Agent 扫描 → 外部能力搜索(如可用)→ 通用 subagent → 主线程降级 4. 平台适配:先用抽象动作描述编排,再映射到当前平台的原生工具 5. 模型分工:只在平台支持模型选择时指定模型;不支持时不要写死 6. 不默认任何外部工具可用,执行前先验证 7. 关键里程碑必须有质量闸门和回滚点 8. 成本只是约束,不是固定承诺 9. Skill Discovery 纯动态——从当前运行时可见的 skills / agents / capability index 扫描,不硬编码任何项目特定 Skill
推荐 Skills 依赖
本 skill 优先复用以下通用 skill,但不再把它们写成所有平台的硬依赖。原因是 Codex、OpenClaw、Cursor 的 skill 调用机制和可见目录可能不同;当依赖不可用时,应使用该平台的计划工具或主线程降级执行。
| Skill | 用途 | 调用阶段 |
|---|---|---|
| planning-with-files | Manus风格文件规划系统,创建task_plan.md、findings.md、progress.md | 阶段0(所有场景必经) |
| find-skills | 外部skill搜索和发现,扩展本地skill库 | 阶段1(Skill回退链) |
降级原则:依赖存在就调用;不存在就显式说明降级方式,继续用当前平台可用的 plan / search / agent 工具完成编排。
5大编排场景
| # | 场景 | 适用条件 | 核心策略 |
|---|---|---|---|
| 1 | 提示增强 | 简单任务,1-2步 | 优化单agent提示词,不拆分不组队 |
| 2 | Skill直接复用 | 任务可由单个Skill完全解决 | 执行规划和Skill搜索后,直接调用匹配的Skill,无需组建Agent Teams |
| 3 | 计划+评审 | 中等/复杂任务(默认) | 出计划 → 按宿主审批规则执行 → Review验收 |
| 4 | Lead-Member | 需要明确团队分工 | Leader协调分配,Member并行执行 |
| 5 | 复合编排 | 复杂任务,无固定模式 | 动态组合上述场景,按阶段切换策略 |
6阶段工作流
阶段0:规划准备 → 阶段1:任务分析+Skill发现 → 阶段2:团队组建 → 阶段3:并行执行 → 阶段4:质量把关 → 阶段5:结果交付注意:阶段0(规划准备)和阶段1(能力发现)是所有场景的强制前置步骤。优先调用planning-with-files/find-skills,但如果当前平台没有对应 skill/tool,必须明确降级而不是假装已经调用。
每个阶段:输出计划 → 执行 → 输出结果。任务拆分计划按宿主审批规则和用户指令执行;需要确认时先确认。
协作模式
| 模式 | 通信方式 | 适用场景 | Claude Code | Codex | OpenClaw / Cursor |
|---|---|---|---|---|---|
| Subagent | 子agent → 主协调器单向汇报 | 并行独立任务 | Task | 宿主提供的 subagent/custom-agent dispatch;否则降级 | 平台 agent/background 能力 |
| Agent Team | 成员间可双向通信 | 需要协作的复杂任务 | TeamCreate + Task(team_name) | 多个独立 subagent + 主线程协调;仅在宿主暴露 agent I/O 时中途交互 | 平台 team/workspace 能力;没有则降级 |
Agent → Skill 委派
子 Agent 调用 Skill 有3种模式。Claude Code 可直接使用 Skill 工具;Codex、OpenClaw、Cursor 需要先确认当前运行时是否提供等价 skill 调用能力。没有等价工具时,按 skill 文档内联执行或降级为主线程处理。
Pattern 1:协调器直接调用(Direct Skill Call)
协调器自己调用Skill工具,不经过子Agent。适合单步Skill任务、不需要并行的场景。
用户 → 协调器 → Skill tool → 结果返回给用户Pattern 2:委派式调用(Delegated Skill Call)
协调器通过当前平台 subagent 工具生成子 Agent,在任务说明中注入 Skill 调用指令,子 Agent 执行 Skill 并汇报结果。适合需要并行多个 Skill、或 Skill 执行耗时较长的场景。
协调器 → subagent(prompt="请使用 /skill-name 完成 X") → subagent → Skill/tool 或内联执行 → 结果汇报关键点:任务说明中写明要调用的 Skill 名称和参数;只有平台支持 skill 工具时才承诺自动调用。
Pattern 3:团队成员调用(Team Member Skill Call)
通过当前平台团队能力组建团队,成员在协作过程中按需调用 Skill。适合长期运行、需要成员间协调的复杂任务。Claude Code 使用 TeamCreate;Codex 使用宿主提供的 subagent/custom-agent 能力加主线程协调;OpenClaw/Cursor 使用各自 team/workspace/background-agent 能力,不可用时降级。
协调器 → team/subagents → 分配任务 → member → Skill/tool 或内联执行 → 汇报选择建议
| 场景 | 推荐Pattern | 原因 |
|---|---|---|
| 单个Skill任务 | Pattern 1 | 最简单,无额外开销 |
| 并行多个Skill | Pattern 2 | 平台提供并发 subagent 时可并行 |
| 需要成员间协作 | Pattern 3 | 平台提供 team messaging 时可双向通信 |
| Skill执行后需要后续处理 | Pattern 2/3 | subagent可以处理Skill输出 |
仓库结构
agent-teams-playbook/
├── SKILL.md # 运行时加载(完整执行协议 + 跨平台适配层)
└── README.md # 开发者文档(完整说明)关键区别:
SKILL.md运行时加载,必须精简,避免不必要 token 消耗README.md给人看的文档,可以写完整说明
兼容性
| 平台 | 支持级别 | 说明 |
|---|---|---|
| Claude Code | 原生 | 可使用 Skill、Task、TeamCreate、SendMessage 等 Agent Teams 语义 |
| Codex | 适配 | 使用宿主提供的 subagent/custom-agent dispatch 与 agent I/O;不可用时降级为主线程分阶段执行,没有真正 TeamCreate 总线 |
| OpenClaw | 适配 | 使用 OpenClaw workspace/team/skill 能力;能力缺失时降级为分阶段执行 |
| Cursor | 适配 | 使用 Cursor agent/background-agent 和 .cursor/skills;能力缺失时降级为分阶段执行 |
重要边界:四个平台能力不完全等价。本 skill 的稳定部分是"编排合同":先澄清目标、再能力发现、再团队蓝图、再执行/评审/验证。具体工具名必须由运行时适配层决定。
Context模式(可选配置)
Claude Code 默认不设置 context: fork,6阶段工作流在主会话中执行,用户可以看到每个阶段的完整输出,并在阶段1确认计划后再执行。
如果你希望隔离上下文(避免编排过程占用主会话上下文窗口),可以手动在SKILL.md的frontmatter中添加:
---
name: agent-teams-playbook
version: "4.7"
context: fork # 添加这行启用隔离模式
---| 模式 | 6阶段可见 | 用户可确认计划 | 上下文隔离 | 适合场景 |
|---|---|---|---|---|
| 默认(无fork) | ✅ 完全可见 | ✅ 可以 | ❌ 共享主会话 | 需要看到完整流程、需要确认计划 |
| fork模式 | ❌ 仅看到最终结果 | ❌ 自动执行 | ✅ 隔离执行 | 信任Skill决策、节省主会话上下文 |
非目标(明确不做)
本 Skill 不会:
- 强制固定团队结构
- 强制单一 Skill 依赖
- 承诺固定速度/成本倍数
- 声称能做 Claude Code 实际做不到的事
维护建议
更新本 Skill 时:
1. SKILL.md 保持精简、只保留执行必需信息 2. 行为发生变化时同步更新本 README 3. 保持两个文件的版本号一致
---
版本:V4.7 最后更新:2026-04-30 维护者:老金
#!/usr/bin/env bash
# agent-teams-playbook Installation Script
# Version: V4.7
# Description: Installs the agent-teams-playbook Skill for Claude Code, Codex, OpenClaw, or Cursor
# Note: "swarm/蜂群" is generic; Claude Code's official concept is "Agent Teams"
set -e
VERSION="V4.7"
SKILL_NAME="agent-teams-playbook"
GITHUB_REPO="KimYx0207/agent-teams-playbook"
GITHUB_BRANCH="main"
INSTALL_TARGET="claude"
INSTALL_SOURCE="local"
CLAUDE_SKILLS_DIR="${CLAUDE_SKILLS_DIR:-${HOME}/.claude/skills}"
CODEX_SKILLS_DIR="${CODEX_SKILLS_DIR:-${HOME}/.codex/skills}"
OPENCLAW_SKILLS_DIR="${OPENCLAW_SKILLS_DIR:-${HOME}/.agents/skills}"
CURSOR_SKILLS_DIR="${CURSOR_SKILLS_DIR:-${HOME}/.cursor/skills}"
# Color codes
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Helper functions
print_success() {
echo -e "${GREEN}✓ $1${NC}"
}
print_error() {
echo -e "${RED}✗ $1${NC}"
}
print_warning() {
echo -e "${YELLOW}⚠ $1${NC}"
}
print_info() {
echo -e "${BLUE}ℹ $1${NC}"
}
print_header() {
echo -e "${BLUE}================================${NC}"
echo -e "${BLUE}$1${NC}"
echo -e "${BLUE}================================${NC}"
}
show_help() {
cat << EOF
agent-teams-playbook Installation Script ${VERSION}
USAGE:
./install.sh [OPTIONS]
OPTIONS:
-h, --help Show this help message
-v, --version Show version information
-t, --target TARGET Install target: claude, codex, openclaw, cursor, all
--from-github Download SKILL.md and README.md from GitHub main.
Default: copy from the local checkout.
DESCRIPTION:
Installs the agent-teams-playbook Skill by:
1. Detecting your operating system
2. Creating the installation directory
3. Copying SKILL.md and README.md from the local checkout
or downloading them from GitHub with --from-github
4. Verifying the installation
5. Optionally enabling Claude Code fork mode
EXAMPLES:
./install.sh # Install for Claude Code
./install.sh --target codex # Install for Codex
./install.sh --target openclaw # Install for OpenClaw
./install.sh --target cursor # Install for Cursor
./install.sh --target all # Install for all supported targets
./install.sh --target all --from-github
CODEX_SKILLS_DIR=/path/to/skills ./install.sh --target codex
EOF
}
show_version() {
echo "agent-teams-playbook Installation Script ${VERSION}"
}
# Parse command line arguments
while [[ $# -gt 0 ]]; do
case "$1" in
-h|--help)
show_help
exit 0
;;
-v|--version)
show_version
exit 0
;;
-t|--target)
if [[ -z "${2:-}" ]]; then
print_error "--target requires a value"
exit 1
fi
INSTALL_TARGET="$2"
shift
;;
--target=*)
INSTALL_TARGET="${1#*=}"
;;
--from-github)
INSTALL_SOURCE="github"
;;
*)
print_error "Unknown option: $1"
echo "Use --help for usage information"
exit 1
;;
esac
shift
done
target_dir() {
case "$1" in
claude) echo "${CLAUDE_SKILLS_DIR}/${SKILL_NAME}" ;;
codex) echo "${CODEX_SKILLS_DIR}/${SKILL_NAME}" ;;
openclaw) echo "${OPENCLAW_SKILLS_DIR}/${SKILL_NAME}" ;;
cursor) echo "${CURSOR_SKILLS_DIR}/${SKILL_NAME}" ;;
*)
print_error "Unsupported target: $1" >&2
print_error "Supported targets: claude, codex, openclaw, cursor, all" >&2
return 1
;;
esac
}
# Feature 1: OS Detection
detect_os() {
print_header "Step 1: Detecting Operating System"
local os_type=""
local os_name=""
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
os_type="Linux"
os_name=$(uname -s)
elif [[ "$OSTYPE" == "darwin"* ]]; then
os_type="macOS"
os_name="macOS $(sw_vers -productVersion 2>/dev/null || echo 'Unknown')"
elif [[ "$OSTYPE" == "msys" ]] || [[ "$OSTYPE" == "win32" ]] || [[ "$OSTYPE" == "cygwin" ]]; then
os_type="Windows (Git Bash/MSYS)"
os_name="Windows"
elif grep -qi microsoft /proc/version 2>/dev/null; then
os_type="Windows (WSL)"
os_name="WSL $(uname -r)"
else
os_type="Unknown"
os_name="$OSTYPE"
fi
print_info "Detected OS: ${os_type}"
print_info "System: ${os_name}"
echo
}
# Feature 2: Directory Creation
create_directory() {
local install_dir="$1"
print_header "Step 2: Creating Installation Directory"
print_info "Target directory: ${install_dir}"
if [ -d "${install_dir}" ]; then
print_warning "Directory already exists!"
echo
read -p "Do you want to overwrite the existing installation? (y/N): " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
print_error "Installation aborted by user"
exit 1
fi
print_info "Removing existing directory..."
rm -rf "${install_dir}"
fi
mkdir -p "${install_dir}"
print_success "Directory created successfully"
echo
}
# Feature 3: File Download
copy_local_files() {
local install_dir="$1"
print_header "Step 3: Copying Files from Local Checkout"
local script_dir
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
local repo_dir
repo_dir="$(cd "${script_dir}/.." && pwd)"
local files=("SKILL.md" "README.md")
for file in "${files[@]}"; do
local source="${repo_dir}/${file}"
local output="${install_dir}/${file}"
print_info "Copying ${file}..."
if [ ! -f "${source}" ]; then
print_error "Local source file not found: ${source}"
exit 1
fi
cp "${source}" "${output}"
print_success "${file} copied successfully"
done
echo
}
download_files() {
local install_dir="$1"
print_header "Step 3: Downloading Files from GitHub"
local base_url="https://raw.githubusercontent.com/${GITHUB_REPO}/${GITHUB_BRANCH}"
local files=("SKILL.md" "README.md")
local download_cmd=""
# Determine download command (curl with fallback to wget)
if command -v curl &> /dev/null; then
download_cmd="curl"
print_info "Using curl for downloads"
elif command -v wget &> /dev/null; then
download_cmd="wget"
print_info "Using wget for downloads"
else
print_error "Neither curl nor wget found. Please install one of them."
exit 1
fi
echo
for file in "${files[@]}"; do
local url="${base_url}/${file}"
local output="${install_dir}/${file}"
print_info "Downloading ${file}..."
if [ "$download_cmd" = "curl" ]; then
if curl -fsSL -o "${output}" "${url}"; then
print_success "${file} downloaded successfully"
else
print_error "Failed to download ${file}"
print_error "URL: ${url}"
exit 1
fi
else
if wget -q -O "${output}" "${url}"; then
print_success "${file} downloaded successfully"
else
print_error "Failed to download ${file}"
print_error "URL: ${url}"
exit 1
fi
fi
done
echo
}
# Feature 4: Installation Verification
verify_installation() {
local install_dir="$1"
print_header "Step 4: Verifying Installation"
local files=("SKILL.md" "README.md")
local all_valid=true
for file in "${files[@]}"; do
local filepath="${install_dir}/${file}"
if [ ! -f "${filepath}" ]; then
print_error "${file} does not exist"
all_valid=false
elif [ ! -s "${filepath}" ]; then
print_error "${file} is empty"
all_valid=false
else
local filesize=$(wc -c < "${filepath}" | tr -d ' ')
local filesize_kb=$((filesize / 1024))
print_success "${file} verified (${filesize} bytes / ${filesize_kb} KB)"
fi
done
echo
if [ "$all_valid" = true ]; then
print_success "All files verified successfully!"
return 0
else
print_error "Installation verification failed"
return 1
fi
}
# Feature 5: Fork Mode Prompt
configure_fork_mode() {
local install_dir="$1"
local target="$2"
if [ "${target}" != "claude" ]; then
print_header "Step 5: Fork Mode Configuration"
print_info "Fork mode is a Claude Code-specific frontmatter option; skipping for ${target}."
echo
return 0
fi
print_header "Step 5: Fork Mode Configuration"
print_info "Fork mode runs the skill in an isolated context."
print_info "This prevents context pollution but increases token usage."
echo
read -p "Do you want to enable fork mode? (y/N): " -n 1 -r
echo
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
local skill_file="${install_dir}/SKILL.md"
# Check if context: fork already exists
if grep -q "^context:" "${skill_file}"; then
print_warning "Fork mode configuration already exists in SKILL.md"
print_info "Updating existing configuration..."
# Use sed to replace existing context line
if [[ "$OSTYPE" == "darwin"* ]]; then
# macOS sed requires empty string after -i
sed -i '' 's/^context:.*$/context: fork/' "${skill_file}"
else
sed -i 's/^context:.*$/context: fork/' "${skill_file}"
fi
else
# Add context: fork on line 2 (right after opening ---)
if [[ "$OSTYPE" == "darwin"* ]]; then
sed -i '' '1a\
context: fork
' "${skill_file}"
else
sed -i '1a context: fork' "${skill_file}"
fi
fi
print_success "Fork mode enabled"
else
print_info "Fork mode disabled (default)"
fi
echo
}
# Main installation flow
main() {
echo
print_header "agent-teams-playbook Installation ${VERSION}"
echo
detect_os
local targets=()
case "${INSTALL_TARGET}" in
all)
targets=("claude" "codex" "openclaw" "cursor")
;;
claude|codex|openclaw|cursor)
targets=("${INSTALL_TARGET}")
;;
*)
print_error "Unsupported target: ${INSTALL_TARGET}"
print_error "Supported targets: claude, codex, openclaw, cursor, all"
exit 1
;;
esac
local installed_locations=()
for target in "${targets[@]}"; do
local install_dir
install_dir=$(target_dir "${target}") || exit 1
print_header "Installing for ${target}"
create_directory "${install_dir}"
if [ "${INSTALL_SOURCE}" = "github" ]; then
download_files "${install_dir}"
else
copy_local_files "${install_dir}"
fi
if verify_installation "${install_dir}"; then
configure_fork_mode "${install_dir}" "${target}"
installed_locations+=("${target}: ${install_dir}")
else
print_error "Installation failed during verification for ${target}"
exit 1
fi
done
print_header "Installation Complete!"
print_success "agent-teams-playbook skill installed successfully"
echo
print_info "Installation locations:"
for location in "${installed_locations[@]}"; do
print_info " - ${location}"
done
echo
}
# Run main installation
main
Related skills
How it compares
Pick agent-teams-playbook when you need governed multi-agent runs with planning files, skill discovery, and quality gates—not for lightweight single-agent edits or one-off prompt tweaks.
FAQ
What platforms does agent-teams-playbook support?
agent-teams-playbook supports Claude Code natively with Task, TeamCreate, SendMessage, and Skill tools, and adapts the same 6-stage workflow for Codex, OpenClaw, and Cursor with documented degradation when team buses or skill tools are unavailable.
What are the mandatory stages in agent-teams-playbook?
agent-teams-playbook requires six stages: planning setup with planning-with-files, task analysis plus a 3-step skill fallback chain, team assembly, parallel execution, quality review with up to 2 revision rounds, and a final delivery report with deployment handoff.
When should developers skip agent-teams-playbook?
agent-teams-playbook targets cross-file refactors, multi-role reviews, and large parallel code generation; developers should skip it for single-file edits, simple Q&A, or linear tasks a single agent can finish without team blueprints or skill discovery.