subagents-creator

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Subagents Creator

Claude子代理创建与使用指南

This skill provides guidance for defining, using, and improving Claude subagents—the specialized agents that handle specific domains like
explore
,
librarian
,
oracle
, and
frontend-ui-ux-engineer
.
本技能提供关于定义、使用和优化Claude子代理的指导——这些是处理特定领域任务的专业代理,例如
explore
librarian
oracle
frontend-ui-ux-engineer

Quick Start

快速入门

Delegating Work

工作委派

When delegating to subagents, use the mandatory 7-section structure:
1. TASK: Atomic, specific goal (one action per delegation)
2. EXPECTED OUTCOME: Concrete deliverables with success criteria
3. REQUIRED SKILLS: Which skill to invoke
4. REQUIRED TOOLS: Explicit tool whitelist (prevents tool sprawl)
5. MUST DO: Exhaustive requirements - leave NOTHING implicit
6. MUST NOT DO: Forbidden actions - anticipate and block rogue behavior
7. CONTEXT: File paths, existing patterns, constraints
当向子代理委派任务时,请使用7部分强制结构
1. TASK: 原子化、明确的目标(每次委派对应一个动作)
2. EXPECTED OUTCOME: 带有成功标准的具体交付成果
3. REQUIRED SKILLS: 要调用的技能
4. REQUIRED TOOLS: 明确的工具白名单(防止工具滥用)
5. MUST DO: 详尽的要求——不要留下任何隐含内容
6. MUST NOT DO: 禁止的操作——提前预判并阻止异常行为
7. CONTEXT: 文件路径、现有模式、约束条件

Choosing a Subagent

选择子代理

See subagent-types.md for detailed guidance on which subagent to use:
  • explore
    : Contextual grep for codebases
  • librarian
    : Reference search (docs, OSS, web)
  • oracle
    : Deep reasoning for architecture/complex decisions
  • frontend-ui-ux-engineer
    : Visual UI/UX changes
请查看subagent-types.md获取关于如何选择子代理的详细指导:
  • explore
    : 针对代码库的上下文式grep检索
  • librarian
    : 参考资料检索(文档、开源项目、网页)
  • oracle
    : 针对架构/复杂决策的深度推理
  • frontend-ui-ux-engineer
    : 可视化UI/UX修改

Defining New Subagents

创建新的子代理

Only create subagents when: The task domain has distinct tooling, expertise, or patterns that benefit from specialization.
See delegation-patterns.md for:
  • Subagent definition templates
  • When to create a new subagent vs using existing ones
  • Naming and description guidelines
仅在以下场景创建子代理:任务领域具备独特的工具、专业知识或模式,能够从专业化中获益。
请查看delegation-patterns.md获取:
  • 子代理定义模板
  • 何时创建新子代理 vs 使用现有子代理
  • 命名与描述规范

Common Pitfalls

常见陷阱

See common-pitfalls.md for:
  • Vague delegation prompts and why they fail
  • Over-delegating trivial tasks
  • Subagent misalignment with task type
  • Anti-patterns in agent orchestration
请查看common-pitfalls.md获取:
  • 模糊的委派提示词及其失败原因
  • 过度委派琐碎任务
  • 子代理与任务类型不匹配
  • 代理编排中的反模式

Best Practices

最佳实践

  1. One action per delegation: Combine tasks in parallel calls, not one call
  2. Be exhaustive: "MUST DO" and "MUST NOT DO" sections prevent drift
  3. Background everything: Use
    background_task
    for
    explore
    and
    librarian
  4. Explicit tool lists: Prevent subagents from using unauthorized tools
  5. Verify results: Check that delegated work meets expectations before proceeding
  1. 每次委派单一任务:通过并行调用组合任务,而非单次调用完成多个任务
  2. 详尽明确:“必须执行”和“禁止执行”部分可防止任务偏离
  3. 后台执行任务:对
    explore
    librarian
    使用
    background_task
  4. 明确工具列表:防止子代理使用未授权工具
  5. 验证结果:在推进前检查委派任务的结果是否符合预期

Delegation Example

委派示例

python
undefined
python
undefined

GOOD: Specific, exhaustive

良好示例:具体详尽

background_task( agent="explore", prompt=""" 1. TASK: Find all authentication implementations 2. EXPECTED OUTCOME: List of files with auth logic, patterns used 3. REQUIRED SKILLS: explore 4. REQUIRED TOOLS: Grep, Read 5. MUST DO: Search for 'jwt', 'session', 'auth' patterns; identify middleware; list all endpoints 6. MUST NOT DO: Don't modify any files; don't run build/test commands 7. CONTEXT: Working in ./src directory, looking for Express.js patterns """ )
background_task( agent="explore", prompt=""" 1. TASK: 查找所有身份验证实现 2. EXPECTED OUTCOME: 包含身份验证逻辑的文件列表及所使用的模式 3. REQUIRED SKILLS: explore 4. REQUIRED TOOLS: Grep, Read 5. MUST DO: 搜索'jwt'、'session'、'auth'模式;识别中间件;列出所有端点 6. MUST NOT DO: 不要修改任何文件;不要运行构建/测试命令 7. CONTEXT: 在./src目录下工作,寻找Express.js模式 """ )

BAD: Vague, implicit expectations

不良示例:模糊、隐含预期

background_task( agent="explore", prompt="Find auth stuff in the codebase" )
undefined
background_task( agent="explore", prompt="在代码库中查找身份验证相关内容" )
undefined

Reference Files

参考文件

  • subagent-types.md - When to use each subagent type
  • delegation-patterns.md - Prompt templates and patterns
  • common-pitfalls.md - Anti-patterns and how to avoid them
  • subagent-types.md - 各类子代理的适用场景
  • delegation-patterns.md - 提示词模板与模式
  • common-pitfalls.md - 反模式及规避方法