Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add apple-ouyang/book-to-skill --skill swarmgit clone --depth 1 https://github.com/apple-ouyang/book-to-skillWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/apple-ouyang/book-to-skill/swarm)<a href="https://agentmods.dev/skills/apple-ouyang/book-to-skill/swarm"><img src="https://agentmods.dev/badge/skills/apple-ouyang/book-to-skill/swarm/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/apple-ouyang/book-to-skill/swarm"><img src="https://agentmods.dev/badge/skills/apple-ouyang/book-to-skill/swarm.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00090 | $0.01495 |
| Opus 5 | $0.00045 | $0.00747 |
| Sonnet 5 | $0.00018 | $0.00299 |
| Haiku 4.5 | $0.00009 | $0.00150 |
Grade A, and why
swarm scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 10d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 194 lines — stays where its author put it; the contents beside it link to each section on GitHub.
蜂群 Swarm
分析用户任务,自动规划 Agent 团队结构(角色、数量、提示词),确认后执行团队协作。
核心流程
分析任务 → 选择团队模式 → 设计角色与提示词 → 用户确认 → 创建团队 → 分配任务 → 监控执行
第一步:分析任务
收到用户任务描述后,从以下维度分析:
| 维度 | 评估内容 |
|---|---|
| 任务类型 | 功能开发 / 代码审计 / Bug 调试 / 技术选型 / 重构迁移 |
| 可并行度 | 哪些子任务可以同时进行 |
| 文件冲突 | 不同角色是否会修改同一文件 |
| 依赖关系 | 哪些任务必须按顺序执行 |
| 复杂度 | 决定团队规模(2-8 人) |
第二步:选择团队模式
根据分析结果,从预定义模式中选择最匹配的模式。详见 references/team-patterns.md。
五种基础模式:
- 功能开发 — 新功能、跨层变更
- 代码审计 — PR Review、安全审计
- 调试竞争 — Bug 排查、假设验证
- 研究辩论 — 技术选型、方案评估
- 重构迁移 — 大规模重构、架构迁移
可混合使用或自定义。如果任务不完全匹配任何模式,基于模式原则自行设计。
第三步:设计角色与提示词
为每个 teammate 设计:
- 角色名称:简短描述(如
frontend-dev、security-reviewer) - Agent 类型:根据职责选择(详见
references/agent-types.md) - 模型:根据任务复杂度选择(opus/sonnet/haiku)
- 权限模式:default / plan / bypassPermissions
- 提示词:包含角色、职责、文件范围、输出要求、协作规则
- 文件范围:明确可操作的目录,避免冲突
提示词结构:
角色:{role}
职责:{responsibilities}
工作范围:
- 只修改:{allowed_dirs}
- 不要触碰:{excluded_dirs}
输出要求:
- {output_format}
协作规则:
- 发现跨模块影响时,通过消息通知 {related_teammate}
- 完成后标记任务为 completed
完成标准:
- {completion_criteria}
第四步:展示计划并确认
以结构化格式展示团队计划,等待用户确认:
## 团队计划
**任务**:{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}"
What ships with it
2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 10d ago First seen · 194 lines · 90 tokens per session scan A ea1dfe82b58d
swarm is a skill published in the GitHub repository apple-ouyang/book-to-skill (130 stars, last pushed 6mo ago), licensed MIT. It adds 90 tokens to every session and 1,495 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other skills, from other repositories
systematic-debugging
Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.
local-ai-agents
Build local-first AI agents that run entirely on a developer workstation with Microsoft Foundry Local and Qwen function-calling models. Covers Small Language Models (SLMs), the OpenAI-compatible local endpoint, sandboxed local tools, local RAG with Chroma, local MCP servers, hybrid cloud/local routing, and the…
next-cache-components-adoption
Turn on Cache Components in a Next.js app and resolve the blocking routes it surfaces. Use when the user wants to enable, adopt, or migrate to Cache Components, flip the cacheComponents flag, work through a flood of blocking-prerender / instant validation errors, run the cache-components-instant-false codemod, or…
insight-error-page
Write or audit an insight-kind error page for the Next.js dev overlay. Use when creating a new errors/ .mdx page, auditing an existing one, or checking that a page matches the framework fix cards. Covers page structure, title alignment, FixCard cards with Copy prompt button, code snippets, terminology verification…
next-cache-components-optimizer
Drive a Next.js route to instant navigation by setting up an agentic loop, under Cache Components / PPR, on initial load (hard navigation) and client-side navigation (soft navigation). Encode the goal as a failing @next/playwright instant() e2e and work it to green, one verified route at a time; the shipped test then…
next-partial-prefetching-adoption
Turn on Partial Prefetching in a Next.js app and work through the insights it surfaces. Use when the user wants to enable or adopt Partial Prefetching, flip the partialPrefetching flag, opt routes in with export const prefetch = 'partial', audit Link prefetch={true} behavior, preserve existing prefetched UI with…