概述
parallel-agents 是一项多智能体编排技能,通过 Claude Code 内置的 Agent Tool 来协调多个专用智能体。与外部脚本方式不同,这种做法的全部编排都保留在 Claude 的控制之下。
何时使用编排
适合使用的情况:
- 需要多个专业领域的复杂任务
- 从安全、性能和质量等角度进行代码分析
- 综合审查(架构 + 安全 + 测试)
- 需要后端 + 前端 + 数据库协作的功能实现
不适合使用的情况:
- 简单、单一领域的任务
- 快速修复或小型变更
- 一个智能体即可完成的任务
原生智能体调用方式
单个智能体:
Use the security-auditor agent to review authentication
顺序链:
First, use the explorer-agent to discover project structure.
Then, use the backend-specialist to review API endpoints.
Finally, use the test-engineer to identify test gaps.
带上下文传递:
Use the frontend-specialist to analyze React components.
Based on those findings, have the test-engineer generate component tests.
恢复先前工作:
Resume agent [agentId] and continue with additional requirements.
编排模式
模式 1:综合分析
智能体流程:explorer-agent → [各领域智能体] → 综合
- explorer-agent:绘制代码库结构
- security-auditor:安全状况
- backend-specialist:API 质量
- frontend-specialist:UI/UX 模式
- test-engineer:测试覆盖率
- 综合所有发现
模式 2:功能审查
智能体流程:受影响领域智能体 → test-engineer
- 确定受影响的领域(后端?前端?还是两者?)
- 调用相关领域智能体
- test-engineer 验证变更
- 综合建议
模式 3:安全审计
智能体流程:security-auditor → penetration-tester → 综合
- security-auditor:配置与代码审查
- penetration-tester:主动漏洞测试
- 综合并按优先级给出修复建议
可用智能体
| 智能体 | 专长 | 触发语 |
|---|---|---|
| orchestrator | 协调 | "comprehensive"、"multi-perspective" |
| security-auditor | 安全 | "security"、"auth"、"vulnerabilities" |
| penetration-tester | 安全测试 | "pentest"、"red team"、"exploit" |
| backend-specialist | 后端 | "API"、"server"、"Node.js"、"Express" |
| frontend-specialist | 前端 | "React"、"UI"、"components"、"Next.js" |
| test-engineer | 测试 | "tests"、"coverage"、"TDD" |
| devops-engineer | DevOps | "deploy"、"CI/CD"、"infrastructure" |
| database-architect | 数据库 | "schema"、"Prisma"、"migrations" |
| mobile-developer | 移动端 | "React Native"、"Flutter"、"mobile" |
| api-designer | API 设计 | "REST"、"GraphQL"、"OpenAPI" |
| debugger | 调试 | "bug"、"error"、"not working" |
| explorer-agent | 发现 | "explore"、"map"、"structure" |
| documentation-writer | 文档 | "write docs"、"create README"、"generate API docs" |
| performance-optimizer | 性能 | "slow"、"optimize"、"profiling" |
| project-planner | 规划 | "plan"、"roadmap"、"milestones" |
| seo-specialist | SEO | "SEO"、"meta tags"、"search ranking" |
| game-developer | 游戏开发 | "game"、"Unity"、"Godot"、"Phaser" |
Claude Code 内置智能体
这些内置智能体可与自定义智能体配合使用:
| 智能体 | 模型 | 用途 |
|---|---|---|
| Explore | Haiku | 快速只读代码库搜索 |
| Plan | Sonnet | 计划模式下的研究 |
| General-purpose | Sonnet | 复杂多步骤修改 |
快速搜索使用 Explore,领域专业能力使用自定义智能体。
综合协议
在所有智能体完成后,进行综合:
## Orchestration Synthesis
### Task Summary
[What was accomplished]
### Agent Contributions
| Agent | Finding |
|-------|---------|
| security-auditor | Found X |
| backend-specialist | Identified Y |
### Consolidated Recommendations
1. **Critical**: [Issue from Agent A]
2. **Important**: [Issue from Agent B]
3. **Nice-to-have**: [Enhancement from Agent C]
### Action Items
- [ ] Fix critical security issue
- [ ] Refactor API endpoint
- [ ] Add missing tests
最佳实践
- 可用智能体:可编排 17 个专用智能体
- 逻辑顺序:发现 → 分析 → 实现 → 测试
- 共享上下文:将相关发现传递给后续智能体
- 单一综合:一份统一报告,而非各自独立的输出
- 验证变更:代码修改始终包含 test-engineer
主要优势
- 单一会话:所有智能体共享上下文
- AI 控制:Claude 自主编排
- 原生集成:可与内置 Explore、Plan 智能体协同
- 支持恢复:可继续先前智能体的工作
- 上下文传递:发现可在智能体之间流动
限制
仅在任务明确符合上述范围时使用本技能。
不要将输出视为环境特定验证、测试或专家审查的替代。
如果缺少必要输入、权限、安全边界或成功标准,应停下来并要求澄清。