prioritize-subagent
智能决策何时使用 subagent 处理复杂任务。代码探索、架构理解、复杂搜索时优先使用 Task 工具启动专门 subagent。使用当请求 '理解代码库'、'分析架构'、'探索代码'、'搜索所有' 或 '重构' 时。
When & Why to Use This Skill
This Claude skill optimizes workflow efficiency by intelligently delegating complex tasks to specialized subagents. It solves the problem of task management overhead by distinguishing between simple operations and those requiring deep codebase understanding, architectural analysis, or multi-step reasoning, ensuring the most effective execution path for every request.
Use Cases
- Case 1: Deep codebase exploration and architectural mapping to explain complex system interactions.
- Case 2: Executing large-scale, multi-step code refactoring that requires consistent logic across multiple files.
- Case 3: Conducting comprehensive code reviews and security audits using specialized analysis subagents.
- Case 4: Automating complex debugging sessions and error diagnosis in large-scale software projects.
| name | prioritize-subagent |
|---|---|
| description | 智能决策何时使用 subagent 处理复杂任务。代码探索、架构理解、复杂搜索时优先使用 Task 工具启动专门 subagent。使用当请求 '理解代码库'、'分析架构'、'探索代码'、'搜索所有' 或 '重构' 时。 |
优先使用 Subagent
核心原则
复杂任务使用 Subagent,简单任务直接处理。
Subagent 专门用于需要代码库理解、复杂分析或多步骤操作的任务。对于简单的单步操作(读取文件、简单编辑),直接使用工具更高效。
快速决策
在开始任务前,问自己以下 4 个问题:
1. 这个任务是否需要理解代码库的多个部分?
- 是 → 使用
Exploresubagent - 否 → 考虑直接使用工具
2. 这个任务是否需要 5 次以上的工具调用?
- 是 → 使用
general-purposesubagent - 否 → 考虑直接使用工具
3. 这个任务是否需要复杂的分析和综合?
- 是 → 使用相应的专业 subagent
- 否 → 考虑直接使用工具
4. 搜索目标是否明确且具体?
- 是 → 可以直接使用 Glob/Grep
- 否 → 使用
Exploresubagent
Subagent 类型参考表
| Subagent 类型 | 用途 | 使用场景 |
|---|---|---|
| Explore | 代码探索、架构理解 | "理解代码库"、"分析架构" |
| general-purpose | 通用多步骤任务 | 复杂重构、多文件操作 |
| code-reviewer | 代码审查和质量检查 | 安全检查、性能优化 |
| debugging-toolkit:debugger | 调试和错误诊断 | 修复 bug、错误分析 |
何时使用 Subagent
✅ 使用 Subagent
- 代码探索和理解:"解释认证系统"、"项目整体架构"
- 复杂搜索:"所有性能问题"、"所有使用 Redis 的地方"
- 多步骤任务:"重构认证系统"、"添加完整测试覆盖"
- 代码审查:"审查 PR"、"检查安全漏洞"
❌ 直接使用工具
- 单步操作:"读取 config.yaml"、"运行测试"
- 精确查找:"找到所有 .md 文件"
- 简单搜索:"搜索 'User' 类的定义"
最佳实践
- 优先使用 subagent: 当不确定时,优先考虑使用 subagent
- 提供清晰的上下文: 在 prompt 中提供详细的任务描述和期望的输出
- 选择合适的 subagent 类型: 根据任务性质选择最匹配的 subagent
- 设置适当的 thoroughness: 对于 Explore 任务,根据需求设置探索深度
- 避免过度使用: 对于简单的单步操作,直接使用工具更高效
详细文档
- decision-guide.md - 详细的决策流程、Subagent 类型对比和判断标准
- examples.md - 8+ 个真实使用场景、推荐 vs 不推荐对比
记住
- Subagent 是为了处理复杂任务而设计的
- 不是所有任务都需要 subagent
- 简单任务直接处理,复杂任务交给 subagent
- 当不确定时,优先考虑使用 subagent