Claude Code 代理团队:多代理编排 - Openclaw 技能
作者:互联网
2026-03-29
什么是 Claude Code 代理团队?
Claude Code 代理团队是 Openclaw 技能的一种复杂实现,旨在管理原生多代理编排。它允许开发人员将单体任务分解为并行工作流,由专门的代理通过共享任务列表和直接消息传递进行协调。通过利用这一技能,用户可以超越简单的顺序提示,转而利用代理团队同时进行高层架构讨论、全栈实现和深度调查。
该工作流通过为不同的代理分配特定的范围来优化开发人员的生产力,确保高精度、高速度地处理复杂项目。作为更广泛的 Openclaw 技能生态系统的一部分,此工具提供了必要的脚本和模板,用于启用、监控和清理多代理会话,同时管理与并行 AI 工作流相关的固有 Token 成本和协调开销。
下载入口:https://github.com/openclaw/skills/tree/main/skills/matthew-a-gordon/claude-code-teams
安装与下载
1. ClawHub CLI
从源直接安装技能的最快方式。
npx clawhub@latest install claude-code-teams
2. 手动安装
将技能文件夹复制到以下位置之一
全局模式~/.openclaw/skills/
工作区
/skills/
优先级:工作区 > 本地 > 内置
3. 提示词安装
将此提示词复制到 OpenClaw 即可自动安装。
请帮我使用 Clawhub 安装 claude-code-teams。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。
Claude Code 代理团队 应用场景
- 执行并行独立工作,如同时从安全性、性能和单元测试多个维度进行代码审查。
- 通过部署代理并行测试竞争性假设来调试复杂系统,从而更快地找到根本原因。
- 开发全栈功能,由不同的代理分别处理前端组件、后端逻辑和集成测试。
- 通过代理之间的对抗性辩论促进架构决策,以产生经过充分审查的架构决策记录 (ADR)。
- 使用 Openclaw 技能在多个目录中执行大规模数据并行任务,如批量重构或库存分类。
- 配置环境以启用 Claude Code CLI 中的实验性代理团队功能。
- 根据所需结果(如并行审查或瓶颈分析)选择特定的团队模板。
- 在委托模式下初始化领导代理,作为策略师和协调员,不直接修改文件。
- 生成具有明确文件边界和目录级所有权的团队成员代理,以防止合并冲突。
- 所有代理通过共享任务列表进行同步,实现实时更新和依赖管理。
- 通过专门的脚本或集成的分栏终端视图监控进度,确保 Openclaw 技能正确执行。
Claude Code 代理团队 配置指南
要启用这些 Openclaw 技能,首先设置所需的环境变量:
export CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1
或者,您可以将配置添加到您的 ~/.claude/settings.json 文件中:
{
"env": {
"CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1"
}
}
使用附带的验证脚本验证您的设置,以确保所有依赖项(如 tmux)均可用:
./scripts/validate-setup.sh
最后,使用提供的模板在 Claude PTY 会话中生成您的团队。
Claude Code 代理团队 数据架构与分类体系
该技能利用结构化方法来管理多代理数据和工作流:
| 组件 | 详情 |
|---|---|
| 模板 | 基于 Markdown 的生成提示,包括团队结构和预期结果。 |
| 任务列表 | 代理使用的共享类 JSON 结构,用于跟踪每个成员的 5-6 个独立任务。 |
| 文件边界 | 在生成提示中定义的显式目录级所有权,以防止写入冲突。 |
| 自动化脚本 | 用于监控的 Bash 脚本 (team-monitor.sh) 和优雅关闭的脚本 (team-cleanup.sh)。 |
| 配置 | 用于显示模式和模型混合的环境级标志及 JSON 设置。 |
name: claude-code-teams
description: Production skill for orchestrating Claude Code's native agent teams feature. Use when: (1) Multi-lens reviews, (2) Competing hypotheses debugging, (3) Full-stack features, (4) Architecture debates, (5) Cross-domain investigations.
metadata:
openclaw:
emoji: "??"
requires:
bins: ["claude"]
env: ["CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS"]
version: "1.0.0"
author: "Matthew Gordon"
tags: ["agents", "teams", "claude-code", "orchestration", "coordination"]
Claude Code Agent Teams
Orchestrate multiple Claude Code agents working together on complex tasks. Agents coordinate through a shared task list, message each other directly, and work in parallel on independent scopes.
When to Use
? Use for parallel independent work:
- Multi-lens code reviews (security, performance, tests in parallel)
- Debugging with competing hypotheses (test theories simultaneously)
- Full-stack features (frontend/backend/tests by separate specialists)
- Architecture decisions (adversarial debate produces stronger ADRs)
- Cross-domain investigations (bottleneck analysis across systems)
- Data-parallel work (inventory classification, bulk refactoring)
? Don't use for:
- Sequential work with tight dependencies
- Same-file edits (conflict risk)
- Simple tasks (coordination overhead > benefit)
- Learning/exploration (single agent with full context is better)
Rule of thumb: Teams multiply token cost 3-4x. Use only when parallelization benefit exceeds coordination overhead.
Quick Start
1. Enable Feature
Environment variable:
export CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1
Or settings file (~/.claude/settings.json):
{
"env": {
"CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1"
}
}
2. Validate Setup
./scripts/validate-setup.sh
Checks for: env var set, claude CLI available, tmux installed (optional).
3. Pick Template
| Template | Use Case |
|---|---|
parallel-review.md |
Multi-lens code review (security + performance + tests) |
competing-hypotheses.md |
Debug by testing competing theories |
fullstack-feature.md |
Frontend/backend/tests coordination |
architecture-decision.md |
ADR with adversarial debate |
bottleneck-analysis.md |
Cross-domain performance investigation |
inventory-classification.md |
Data-parallel classification/refactoring |
Each template includes: when to use, team structure, copy-paste spawn prompt, expected outcomes.
4. Spawn Team
claude --pty
# Paste spawn prompt from template
Monitor with ./scripts/team-monitor.sh (separate terminal) or Ctrl+T (in Claude Code).
Core Principles
- Clear file boundaries - Each teammate owns different files/directories (prevents conflicts)
- Use delegate mode - Lead coordinates, teammates implement (include in spawn prompt)
- Size tasks appropriately - 5-6 self-contained tasks per teammate
- Wait for completion - Don't let lead merge results while teammates are mid-task
- Start with research - Spawn researchers before builders to establish shared understanding
Cost Management
Agent teams multiply token usage 3-4x vs single session. Each teammate has its own context window.
Optimize with:
- Model mixing - Opus for lead (strategic), Sonnet for teammates (tactical) = ~40% savings
- Minimize broadcasts - Direct messages only (broadcasts copy to all teammates)
- Right-size teams - 3 teammates usually optimal; 6+ only for highly parallel work
See references/cost-management.md for detailed strategies.
Troubleshooting
Teammates not spawning?
- Verify
CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1is set - Restart Claude Code after setting env var
File conflicts?
- Define explicit file boundaries in spawn prompt (directory-level ownership)
Lead implementing instead of coordinating?
- Add "Use delegate mode: coordinate but don't implement" to spawn prompt
- Or press Shift+Tab to cycle into delegate mode
See references/troubleshooting.md for full list.
Automation
Monitor progress:
./scripts/team-monitor.sh
Cleanup (graceful shutdown):
./scripts/team-cleanup.sh
Display Modes
In-process (default) - All teammates in main terminal
Shift+Up/Down- Select teammateCtrl+T- Toggle task listEscape- Interrupt teammate
Split-pane (requires tmux or iTerm2) - Each teammate gets own pane
- Set
teammateMode: "tmux"in~/.claude/settings.json
References
templates/- 6 copy-paste ready spawn prompts with usage guidancescripts/- Automation helpers (validate, monitor, cleanup)references/best-practices.md- When to use teams, task sizing, file boundariesreferences/cost-management.md- Token optimization strategiesreferences/troubleshooting.md- Common issues and solutionsexamples/- Real-world walkthroughs (PR review, bug hunt, feature build)
Comparison
| Approach | Best For |
|---|---|
| Single session | Sequential work, exploration |
| Agent teams (this skill) | Parallel independent tasks with coordination |
| OpenClaw subagents | Background work, long-running tasks |
Contributing
Found a useful pattern? Submit PR with:
- Template or example
- When to use + team structure
- Spawn prompt + expected outcomes
Credits
Built with insights from Claude Code documentation, ClaudeFast patterns, and OpenClaw community.
Repository: https://github.com/matthew-a-gordon/claude-code-teams
License: MIT
相关推荐
专题
+ 收藏
+ 收藏
+ 收藏
+ 收藏
+ 收藏
最新数据
相关文章
信号管道:自动化营销情报工具 - Openclaw Skills
技能收益追踪器:监控 Openclaw 技能并实现变现
AI 合规准备就绪度:评估与治理工具 - Openclaw Skills
FOSMVVM ServerRequest 测试生成器:自动化 API 测试 - Openclaw Skills
酒店搜索器:AI 赋能的住宿与位置情报 - Openclaw Skills
Dub 链接 API:程序化链接管理 - Openclaw Skills
IntercomSwap:P2P BTC 与 USDT 跨链兑换 - Openclaw Skills
spotplay:macOS 原生 Spotify 播放控制 - Openclaw Skills
DeepSeek OCR:AI驱动的图像文本识别 - Openclaw Skills
Web Navigator:自动化网页研究与浏览 - Openclaw Skills
AI精选
