agentleFS
ThrookieThrookie/claude-code-skills/skills/orchestrator/SKILL.md

orchestrator

Skill1 starsChanged 8 months agoMITView on GitHub

多代理协作编排器,基于 Anthropic 工程团队架构,支持 Lead-Worker 模式、API Key 轮换、并行执行。触发词:创建团队、多代理协作、长任务、复杂任务、并行搜索。

  • Reads credentials

80 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use worker, reviewer and 8 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • stotihvSkill

    worker

    Execute beads autonomously within a track. Handles bead-to-bead context persistence via Agent Mail, uses preferred tools from AGENTS.md, and reports progress to orchestrator.

    Also in 3 projects that use this

  • MicrosoftSkill

    reviewer

    ASP.NET Core ハンドブックの記事をレビューする。Use when: 記事をレビューする、ドキュメントを校正する、コードレビューする、PRをレビューする。技術ドキュメントのレビュー、品質チェック、校正。

    Also in 4 projects that use this

  • am-willSkill

    planner

    Create comprehensive, phased implementation plans with sprints and atomic tasks. Use when user says: "make a plan", "create a plan", "plan this out", "plan the implementation", "help me plan", "design a plan", "draft a plan", "write a plan", "outline the steps", "break this down into tasks", "what's the plan for", or any similar planning request. Also triggers on explicit "/planner" or "/plan" commands.

    Also in 4 projects that use this

  • yakatotechSkill

    advisor

    Provide improvement suggestions and advice on work content. Use for document review, efficiency suggestions, and best practices

    Also in 3 projects that use this

  • AWSSkill

    planning

    Discovers user intent and generates a structured, step-by-step plan for model customization workflows. This skill must always be activated alongside any other skill when the user's request relates to model customization — including fine-tuning, training, building, customizing, reviewing data, or getting advice on approach, regardless of domain. Do not skip this skill even if the immediate ask is narrow (e.g., reviewing data format or a single workflow step), because planning discovers the full scope of work needed. Also activate when the user wants to resume, continue, or modify an existing plan.

    Also in 3 projects that use this

  • OpenAISkill

    observability

    Vercel Observability expert guidance — Drains (logs, traces, speed insights, web analytics), Web Analytics, Speed Insights, runtime logs, custom events, OpenTelemetry integration, and monitoring dashboards. Use when instrumenting, debugging, or optimizing application performance and user experience on Vercel.

    Also in 3 projects that use this

The file

Files
SKILL.md

Orchestrator Pro - 多代理协作增强版

版本:v2.0 - 2026-03-17 基于 Anthropic 工程团队的多代理研究系统架构


📋 概述

Orchestrator Pro 是 Anthropic 工程师团队使用的工作模式的实现:

  • 1 个 Lead Agent (Opus 4) - 负责决策和协调
  • 3-5 个 Worker Agents (Sonnet 4) - 并行执行子任务
  • 多 API Key 轮换 - 避免单个 Key 频率限制

🚀 快速开始

基础用法

# 启动 Orchestrator Pro 模式
node ~/src/user-scripts/skills/agents/orchestrator/scripts/route-intent.mjs "研究 Rust 异步编程"

# 并行模式(实验性)
node ~/src/user-scripts/skills/agents/orchestrator/scripts/route-intent.mjs "研究 Rust 异步编程" --parallel

# 只生成计划,不执行
node ~/src/user-scripts/skills/agents/orchestrator/scripts/route-intent.mjs "开发登录系统" --plan-only

Claude Code 自动触发

当用户输入包含以下触发词时,自动调用 Orchestrator:

用户输入自动调用
"创建团队研究 X"orchestrator
"多代理协作开发"orchestrator
"长任务"orchestrator
"复杂任务"orchestrator
"并行搜索"orchestrator (parallel 模式)

🏗️ 架构设计

Orchestrator-Workers 模式

                ┌─ Worker 1 (Sonnet) ─ 研究者 ─┐
                ├─ Worker 2 (Sonnet) ─ 开发者 ─┤
用户 → Opus (Lead) ─┼─ Worker 3 (Sonnet) ─ 审查者 ─┼→ 综合结果
                ├─ Worker 4 (Sonnet) ─ 文档员 ─┤
                └─ Worker 5 (Sonnet) ─ 测试者 ─┘

多 API Key 轮换

API Key 池:
├─ key-1 (active)    → Lead Agent + Worker 1
├─ key-2 (backup)    → Worker 2 + Worker 3
└─ key-3 (backup)    → Worker 4 + Worker 5

轮询策略:round-robin
切换条件:
  - 当前 Key 达到速率限制
  - 并发请求数超过阈值

📁 目录结构

orchestrator/
├── SKILL.md              # 主入口文档(本文件)
├── scripts/
│   ├── spawn-agent.mjs   # 生成子代理
│   ├── collect-results.mjs # 收集结果
│   ├── route-intent.mjs  # 意图路由
│   └── api-rotator.mjs   # API Key 轮换器(新增)
├── prompts/
│   ├── researcher.md     # Research Agent 提示词
│   ├── builder.md        # Builder Agent 提示词
│   ├── reviewer.md       # Reviewer Agent 提示词
│   └── archiver.md       # Archiver Agent 提示词
└── config/
    ├── api-keys.json     # API Key 配置(~/.claude/api-keys.json)
    └── agent-roles.json  # 代理角色配置

🔧 核心功能

1. API Key 轮换器

用法:

import { getAvailableKey } from '~/src/user-scripts/skills/agents/orchestrator/scripts/api-rotator.mjs';

const key = getAvailableKey('anthropic', 'worker-2');
// 返回可用的 API Key,自动跳过达到限流的 Key

轮换策略:

策略说明
round-robin按顺序轮询,每次使用下一个 Key
least-used使用今日用量最少的 Key
priority按优先级顺序,主 Key 故障时切备用

2. 并行执行引擎

用法:

# 串行执行(默认)
node route-intent.mjs "任务"

# 并行执行(需要多个 API Key)
node route-intent.mjs "任务" --parallel

并行限制:

  • 单个 API Key:最多 2 个并发请求
  • 2 个 API Keys:最多 4 个并发请求
  • 3+ API Keys:最多 6 个并发请求

3. 子代理类型

代理类型用途推荐模型触发词
researcher研究搜索Sonnet 4"搜索"、"研究"、"对比"
builder开发建设Sonnet 4"开发"、"实现"、"构建"
reviewer代码审查Opus 4"review"、"审查"、"优化"
archiver文档归档Sonnet 4"总结"、"归档"、"记录"
tester测试验证Sonnet 4"测试"、"验证"
general通用任务Sonnet 4其他

📊 使用示例

示例 1:多代理研究(并行模式)

# 用户输入
"创建团队研究 Rust 异步编程的最佳实践"

# Orchestrator 执行
1. Lead Agent (Opus) 分析任务,分解为 3 个子任务:
   - 子任务 1: 搜索 Rust 异步基础教程
   - 子任务 2: 对比 tokio 和 async-std 生态
   - 子任务 3: 整理 GitHub 实战案例

2. 启动 3 个 Worker Agents 并行执行:
   - Worker 1 (Sonnet, key-1) → 搜索基础教程
   - Worker 2 (Sonnet, key-2) → 对比生态
   - Worker 3 (Sonnet, key-3) → 整理案例

3. 等待所有 Worker 完成

4. Lead Agent 综合所有结果,输出综合报告

预期输出:

## 研究报告:Rust 异步编程最佳实践

### 核心发现
(Lead Agent 综合 3 个 Worker 的结果)

### 基础教程(Worker 1)
- The Rust Programming Language - Chapter 16
- Tokio documentation
- ...

### 生态对比(Worker 2)
| 特性 | Tokio | async-std |
|------|-------|-----------|
| 性能 | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐ |
| 生态 | ⭐⭐⭐⭐⭐ | ⭐⭐⭐ |
| ...

### 实战案例(Worker 3)
1. [项目 A](github.com/xxx) - 高并发服务器
2. [项目 B](github.com/yyy) - Web 框架
...

### 来源统计
- 技术文档:5 个
- GitHub 项目:8 个
- 论坛讨论:3 个

示例 2:协作开发(串行模式)

# 用户输入
"开发一个用户登录系统"

# Orchestrator 执行(单 API Key 模式)
1. Lead Agent 分解任务:
   - 子任务 1: 前端登录页面 UI
   - 子任务 2: 后端认证 API
   - 子任务 3: 单元测试
   - 子任务 4: 代码审查

2. 串行执行(避免触发限流):
   - Worker 1 → 前端页面
   - Worker 2 → 后端 API
   - Worker 3 → 测试代码
   - Worker 4 → 代码审查

3. 每个子任务完成后,更新进度文件

4. 所有任务完成后,输出综合报告

⚙️ 配置说明

API Key 配置

编辑 ~/.claude/api-keys.json:

{
  "providers": {
    "anthropic": {
      "keys": [
        {
          "id": "key-1",
          "api_key": "sk-ant-api03-你的实际 Key",
          "_status": "active"
        },
        {
          "id": "key-2",
          "api_key": "sk-ant-api03-placeholder",
          "_status": "placeholder"
        }
      ]
    }
  }
}

环境变量方式

也可以使用环境变量:

# ~/.bashrc 或 ~/.config/fish/config.fish
export ANTHROPIC_API_KEY_1="sk-ant-api03-xxx"
export ANTHROPIC_API_KEY_2="sk-ant-api03-yyy"
export ANTHROPIC_API_KEY_3="sk-ant-api03-zzz"

📈 性能优化

单 Key 模式优化

当只有一个 API Key 时:

// route-intent.mjs 中添加请求间隔
const SINGLE_KEY_DELAY = 2000; // 2 秒间隔

if (activeKeys === 1) {
  await sleep(SINGLE_KEY_DELAY);
}

多 Key 模式优化

当有多个 API Key 时:

// 并行执行,最大化吞吐量
const concurrentLimit = Math.min(agentCount, activeKeys * 2);
await Promise.all(agents.map(a => execute(a)));

⚠️ 注意事项

1. API Key 安全

# 设置文件权限
chmod 600 ~/.claude/api-keys.json

# 不要提交到 git
echo "api-keys.json" >> ~/.claude/.gitignore

2. 速率限制

模型Requests/minTokens/min
Opus 416080,000
Sonnet 4240120,000
Haiku 4320160,000

3. 错误处理

当 API Key 达到限流时:

1. 自动切换到下一个可用 Key
2. 记录当前 Key 的冷却时间(默认 60 秒)
3. 如果所有 Key 都限流,等待后重试

🔗 参考资源


最后更新:2026-03-17 | 版本:v2.0

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.