This skill should be used when the user asks to "create a team", "create agent team", "蜂群", "swarm", "团队协作", "parallel agents", "spawn teammates", "多 agent 协作", "组建团队", or executes "/swarm".

MITAuto-check passedAgent Workflows

Install Swarm

skills CLI
$ npx skills add apple-ouyang/book-to-skill --skill swarm -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install apple-ouyang/book-to-skill swarm --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/apple-ouyang/book-to-skill.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/swarm .claude/skills/swarm && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
swarm
GitHub stars
161
Token cost
~826 tokens
SKILL.md length
173 words
Files
3 (incl. references)
Skills in repo
6
Repo updated
First seen
Licence
MIT

At a glance

This skill should be used when the user asks to "create a team", "create agent team", "蜂群", "swarm", "团队协作", "parallel agents", "spawn teammates", "多 agent 协作", "组建团队", or executes "/swarm".

  • Works in 5 steps: 功能开发 — 新功能、跨层变更 → 代码审计 — PR Review、安全审计 → 调试竞争 — Bug 排查、假设验证 → …
  • Asks to create a team
  • SKILL.md covers 核心流程, 第一步:分析任务, 第二步:选择团队模式 and 第三步:设计角色与提示词, plus 6 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Swarm is an agent skill from apple-ouyang/book-to-skill. This skill should be used when the user asks to "create a team", "create agent team", "蜂群", "swarm", "团队协作", "parallel agents", "spawn teammates", "多 agent 协作", "组建团队", or executes "/swarm". Analyzes user tasks, designs optimal team structure (roles, count, prompts), presents plan for confirmation, then orchestrates team execution.

Its SKILL.md is about 830 tokens, which your agent loads only when the skill is triggered. The skill folder holds 3 other files, including reference files (for example `references/agent-types.md` and `references/team-patterns.md`).

It sits in Agent Workflows, covering Building AI agents and Subagents. The repository describes itself as: 把书拆成 AI Agent 可执行的 Skill,让书中的智慧变成你的决策副驾驶 | Turn books into executable AI Agent Skills. The licence is MIT.

When your agent uses it

  • Asks to create a team
  • Create agent team
  • Parallel agents
  • Spawn teammates

Example prompts

  • “create a team”
  • “create agent team”
  • “parallel agents”
  • “/swarm”

Workflow steps

5 steps, taken from the first numbered list in SKILL.md.

  1. 功能开发 — 新功能、跨层变更
  2. 代码审计 — PR Review、安全审计
  3. 调试竞争 — Bug 排查、假设验证
  4. 研究辩论 — 技术选型、方案评估
  5. 重构迁移 — 大规模重构、架构迁移

What it can do on your machine

Read from SKILL.md and the folder at commit a24960a. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are markdown).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Swarm loads about 826 tokens when it runs, and up to ~2.6k if it reads all its reference files. Until then it costs about 85 tokens; SKILL.md has 173 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~85
When it runs · the whole SKILL.md, loaded when a task matches
~826
With references · SKILL.md plus every file in references/, read only if the agent opens them
~2.6k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from apple-ouyang/book-to-skill at commit a24960a, republished under its MIT licence (© apple-ouyang). 173 words, ~826 tokens.

Download SKILL.mdSave it as .claude/skills/swarm/SKILL.md (or your agent's skills folder). This skill also uses 2 other files; get the full folder from GitHub.
name
swarm
description
This skill should be used when the user asks to "create a team", "create agent team", "蜂群", "swarm", "团队协作", "parallel agents", "spawn teammates", "多 agent 协作", "组建团队", or executes "/swarm". Analyzes user tasks, designs optimal team structure (roles, count, prompts), presents plan for confirmation, then orchestrates team execution.

蜂群 Swarm

分析用户任务,自动规划 Agent 团队结构(角色、数量、提示词),确认后执行团队协作。

核心流程

分析任务 → 选择团队模式 → 设计角色与提示词 → 用户确认 → 创建团队 → 分配任务 → 监控执行

第一步:分析任务

收到用户任务描述后,从以下维度分析:

维度评估内容
任务类型功能开发 / 代码审计 / Bug 调试 / 技术选型 / 重构迁移
可并行度哪些子任务可以同时进行
文件冲突不同角色是否会修改同一文件
依赖关系哪些任务必须按顺序执行
复杂度决定团队规模(2-8 人)

第二步:选择团队模式

根据分析结果,从预定义模式中选择最匹配的模式。详见 references/team-patterns.md。

五种基础模式:

  1. 功能开发 — 新功能、跨层变更
  2. 代码审计 — PR Review、安全审计
  3. 调试竞争 — Bug 排查、假设验证
  4. 研究辩论 — 技术选型、方案评估
  5. 重构迁移 — 大规模重构、架构迁移

可混合使用或自定义。如果任务不完全匹配任何模式,基于模式原则自行设计。

第三步:设计角色与提示词

为每个 teammate 设计:

  1. 角色名称:简短描述(如 frontend-dev、security-reviewer)
  2. Agent 类型:根据职责选择(详见 references/agent-types.md)
  3. 模型:根据任务复杂度选择(opus/sonnet/haiku)
  4. 权限模式:default / plan / bypassPermissions
  5. 提示词:包含角色、职责、文件范围、输出要求、协作规则
  6. 文件范围:明确可操作的目录,避免冲突

提示词结构:

角色:{role}
职责:{responsibilities}

工作范围:
- 只修改:{allowed_dirs}
- 不要触碰:{excluded_dirs}

输出要求:
- {output_format}

协作规则:
- 发现跨模块影响时,通过消息通知 {related_teammate}
- 完成后标记任务为 completed

完成标准:
- {completion_criteria}

第四步:展示计划并确认

以结构化格式展示团队计划,等待用户确认:

markdown
## 团队计划

**任务**:{task_description}
**模式**:{pattern_name}
**团队规模**:{count} 人

### 角色分配

| # | 角色 | Agent 类型 | 模型 | 职责概要 |
|---|------|-----------|------|---------|
| 1 | {name} | {type} | {model} | {summary} |
| ...

### 任务列表与依赖

| ID | 任务 | 负责人 | 依赖 |
|----|------|--------|------|
| 1 | {task} | {owner} | - |
| 2 | {task} | {owner} | blockedBy: 1 |
| ...

### 文件分工(避免冲突)

| 角色 | 可操作目录 |
|------|-----------|
| {name} | {dirs} |
| ...

确认此计划?(Y/修改建议)

使用 AskUserQuestion 工具让用户确认或提出修改。

第五步:创建团队并执行

用户确认后,按以下顺序执行:

5.1 创建团队
TeamCreate → team_name: "{task-slug}"
5.2 创建任务列表

按计划创建所有任务(TaskCreate),设置依赖关系(TaskUpdate + addBlockedBy)。

5.3 启动 Teammates

对每个角色,使用 Task 工具启动 teammate:

Task → subagent_type: "{agent_type}"
       name: "{role_name}"
       team_name: "{team_name}"
       model: "{model}"
       mode: "{permission_mode}"
       prompt: "{designed_prompt}"
5.4 分配任务

通过 TaskUpdate 将任务分配给对应 teammate(设置 owner)。

第六步:监控与协调

团队运行期间:

  1. 接收消息:teammate 消息自动送达,及时回应
  2. 解决冲突:如果多个 teammate 需要修改同一文件,协调顺序
  3. 重新分配:如果某 teammate 卡住,重新分配任务或提供帮助
  4. 质量把关:审查 teammate 的输出,不合格则要求修改
  5. 合成结果:所有任务完成后,汇总最终成果

第七步:清理

所有任务完成后:

  1. 向所有 teammate 发送 shutdown_request
  2. 等待所有 teammate 关闭
  3. 调用 TeamDelete 清理资源
  4. 向用户汇报最终结果

关键规则

避免文件冲突

最重要的规则:不同 teammate 不能同时修改同一文件。

  • 按目录/模块划分文件范围
  • 共享文件(如配置文件)由领导统一修改
  • 需要跨模块变更时,通过消息协调
控制团队规模
  • 宁少勿多,每增加一个 teammate 都增加 token 消耗
  • 简单任务(单模块):2-3 人
  • 中等任务(跨模块):3-4 人
  • 复杂任务(跨层):4-6 人
使用 Delegate 模式

领导应专注协调,不直接写代码。如果发现自己在实现任务,停下来分配给 teammate。

提示词要具体

模糊的提示词导致 teammate 偏离方向。包含:

  • 具体的文件路径和目录
  • 明确的输出格式
  • 清晰的完成标准

参考资源

Reference Files
  • references/team-patterns.md — 五种团队模式模板、决策树、规模建议
  • references/agent-types.md — Agent 类型能力对照、模型选择、提示词模板

© apple-ouyang, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 2 other files (references) in skills/swarm of apple-ouyang/book-to-skill.

  • SKILL.md
  • references/agent-types.md
  • references/team-patterns.md

Open the folder on GitHubat commit a24960a

Compare with similar skills

Swarm next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Swarm compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Swarm this skillapple-ouyang/book-to-skill161—~826Automated safety check: PassMIT
Create Agentvectorize-io/hindsight48k—~1.1kAutomated safety check: PassMIT
Adk Debuggoogle/adk-python22k—~837Automated safety check: PassApache-2.0
Deep Agentslangchain-ai/docs426—~1.1kAutomated safety check: PassMIT
Create AgentApocrathia/home-assistant-config179—~1.1kAutomated safety check: PassNone
Agent Creatorsickn33/agentic-awesome-skills47k1 repos~2.7kAutomated safety check: PassMIT

Similar skills

  • Create Agent

    vectorize-io/hindsight

    Create a new Hindsight-powered subagent with long-term memory.

    48k GitHub stars~1.1k tokensUpdated today
    Agent WorkflowsAuto-check passed
  • Adk Debug

    google/adk-python

    Official

    Diagnoses misbehaving ADK agents by inspecting sessions, events, tool calls, and the exact request that reached the model.

    22k GitHub stars~837 tokensUpdated today
    Agent WorkflowsAuto-check passed
  • Deep Agents

    langchain-ai/docs

    Official

    Build batteries-included agents with planning, context management, subagent delegation, and sandboxed execution.

    426 GitHub stars~1.1k tokensUpdated today
    Agent WorkflowsAuto-check passed
  • Create Agent

    Apocrathia/home-assistant-config

    Create a new agent persona under .agents/agents/. An agent skill from Apocrathia/home-assistant-config.

    179 GitHub stars~1.1k tokensUpdated 18 days ago
    Agent WorkflowsAuto-check passed
  • Agent Creator

    sickn33/agentic-awesome-skills

    Create custom AI subagents with proper plugin structure, persona generation, and companion routing skills.

    47k GitHub starsUsed in 1 repo~2.7k tokens
    Agent WorkflowsAuto-check passed
  • Agent Builder

    testdouble/han

    Builds a new Claude Code agent (subagent) from scratch through a relentless, evidence-based interview that walks the agent's design tree decision-by-decision — entity fit, domain focus and…

    281 GitHub stars~3.8k tokensUpdated 9 days ago
    Agent WorkflowsAuto-check passed

More from apple-ouyang/book-to-skill

  • Making Decisions

    apple-ouyang/book-to-skill

    A skill your agent uses when facing a significant decision, evaluating options, or feeling stuck between choices.

    161 GitHub stars~806 tokensUpdated 7 mo ago
    Auto-check passed
  • Seeking Disconfirming Evidence

    apple-ouyang/book-to-skill

    A skill your agent uses when a decision feels obvious or everyone agrees, when evaluating omeone's proposal or pitch, when in a team debate that's going nowhere, or when you suspect confirmation…

    161 GitHub stars~654 tokensUpdated 7 mo ago
    Auto-check passed
  • Decision Tripwires

    apple-ouyang/book-to-skill

    A skill your agent uses when committing resources to a project, investment, or relationship.

    161 GitHub stars~656 tokensUpdated 7 mo ago
    Auto-check passed
  • Reality Testing Decisions

    apple-ouyang/book-to-skill

    A skill your agent uses when tempted to predict, analyze, or debate whether something will work instead of testing it.

    161 GitHub stars~639 tokensUpdated 7 mo ago
    Auto-check passed
  • Book To Skill

    apple-ouyang/book-to-skill

    把一本书拆解成 Claude Code 可执行的 Skill。当用户说"拆书"、"把这本书变成 Skill"、"book to skill"、"extract skill from book" 时触发。

    161 GitHub stars~789 tokensUpdated 7 mo ago
    Auto-check passed

Categories

Questions about Swarm

What does Swarm do?

This skill should be used when the user asks to "create a team", "create agent team", "蜂群", "swarm", "团队协作", "parallel agents", "spawn teammates", "多 agent 协作", "组建团队", or executes "/swarm". Swarm is an agent skill from apple-ouyang/book-to-skill. This skill should be used when the user asks to "create a team", "create agent team", "蜂群", "swarm", "团队协作", "parallel agents", "spawn teammates", "多 agent 协作", "组建团队", or executes "/swarm".

When should I use Swarm?

Swarm fits situations like: asks to create a team; create agent team; parallel agents; spawn teammates.

How do I install Swarm in Claude Code?

Run `npx skills add apple-ouyang/book-to-skill --skill swarm -a claude-code`. Or copy the skill folder (skills/swarm in apple-ouyang/book-to-skill) into .claude/skills/swarm in your project. Claude Code loads it when a task matches its description.

How do I install Swarm in Codex?

Run `npx skills add apple-ouyang/book-to-skill --skill swarm -a codex`. Or copy the skill folder (skills/swarm in apple-ouyang/book-to-skill) into .agents/skills/swarm in your project. Codex loads it when a task matches its description.

Can I use Swarm in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add apple-ouyang/book-to-skill --skill swarm -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/swarm, .gemini/skills/swarm, .github/skills/swarm and .opencode/skills/swarm in your project.

What does Swarm need to run?

SKILL.md names no scripts, command-line tools or credentials: Swarm is instructions for the agent only.

Does Swarm access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Swarm safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Swarm use?

Swarm is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Swarm use?

About 826 tokens (SKILL.md is roughly 3.3k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 1.8k tokens, read only when the agent opens those files.

What are the alternatives to Swarm?

Skills that share tags, products or a category with Swarm: Create Agent (vectorize-io/hindsight, 48k stars), Adk Debug (google/adk-python, 22k stars), Deep Agents (langchain-ai/docs, 426 stars) and Create Agent (Apocrathia/home-assistant-config, 179 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Swarm?

apple-ouyang (a GitHub user) maintains it in apple-ouyang/book-to-skill, which has 161 GitHub stars. The repository holds 6 skills in this directory. The repository was last updated on February 25, 2026.

Source: apple-ouyang/book-to-skill on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.