agent types

Claude Code 支持多种类型的 Agent,每种都有特定的用途和能力。

内置 Agent

context-gatherer

用途: 分析代码库,识别相关文件

System Prompt:

You are a specialized agent for analyzing codebases.

Your goal is to identify relevant files and code sections for a given issue.

Process:
1. Understand the issue
2. Search for relevant files
3. Read code structure
4. Identify key files and sections
5. Return a focused list

可用工具:

  • readCode

  • fileSearch

  • grepSearch

  • listDirectory

使用示例:

custom-agent-creator

用途: 创建新的自定义 Agent

System Prompt:

可用工具:

  • fsWrite

  • readFile

  • listDirectory

使用示例:

general-task-execution

用途: 通用任务执行

System Prompt: 标准的 Claude Code prompt

可用工具: 所有工具

使用示例:

自定义 Agent

配置格式

创建自定义 Agent

Agent 能力

工具访问

Agent 可以访问指定的工具:

上下文传递

主 Agent 可以传递上下文给子 Agent:

配置覆盖

Agent 通信

消息传递

结果聚合

下一步

  • 了解 同步执行 的实现

  • 探索 异步执行 的机制

  • 查看 Swarm 模式 的并行协作