mcpField
S
sub-agents

sub-agents

github.com/parcadeiAgent 工作流3.9k536 次安装39 周前更新
代码仓库

关于 sub-agents

sub-agents 是用于创建和管理独立上下文专用 AI Agent 的参考技能,涵盖配置、内置 Agent、模型选择与串联,并介绍菜单、文件和命令行操作。

主要功能

  1. 01创建独立上下文的 Agent
  2. 02配置工具与模型
  3. 03使用内置 Agent 类型
  4. 04通过菜单、文件或命令行管理
  5. 05恢复并串联 Agent

适用场景

  1. 01设置专职代码审查 Agent
  2. 02为任务选择模型
  3. 03限制 Agent 可用工具
  4. 04串联分析与实现 Agent

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/parcadei/continuous-claude-v3 --skill sub-agents

安装后在 Claude Code 中输入/sub-agents确认已加载。

详细介绍

子 Agent 参考

为特定任务创建上下文隔离的专用 AI Agent。

适用场景

  • “如何创建子 Agent?”
  • “配置 Agent 工具”
  • “有哪些内置 Agent?”
  • “Agent 模型选择”
  • “Agent 链式调用模式”

快速开始

交互式(推荐)
/agents

打开菜单以创建、编辑和管理 Agent。

手动创建
mkdir -p .claude/agents
cat > .claude/agents/reviewer.md << 'EOF'
---
name: reviewer
description: Code review specialist. Use proactively after code changes.
tools: Read, Grep, Glob, Bash
model: sonnet
---

You are a senior code reviewer focusing on quality and security.

## Review Checklist
- Code clarity and naming
- Error handling
- Security vulnerabilities
- Test coverage
EOF
基于 CLI
claude --agents '{
  "reviewer": {
    "description": "Code reviewer",
    "prompt": "Review for quality and security",
    "tools": ["Read", "Bash"],
    "model": "sonnet"
  }
}'

Agent 文件格式

---
name: agent-name
description: When/why to use this agent
tools: Read, Edit, Bash      # Optional, inherits all if omitted
model: sonnet                 # sonnet, haiku, claude-opus-4-5-20251101, inherit
---

System prompt content here...

配置字段

字段必填选项
name是小写字母、连字符
description是使用场景
tools否工具列表(省略时继承所有工具)
model否sonnet、haiku、claude-opus-4-5-20251101、inherit

内置 Agent

Agent模型工具用途
通用Sonnet所有复杂的多步骤任务
规划Sonnet只读规划模式下的研究
探索Haiku只读快速搜索代码库

模型选择

模型速度最适合
Haiku最快搜索、快速查询
Sonnet快大多数任务(默认)
Opus较慢复杂推理

工具组合

# Code Reviewer (read-only)
tools: Read, Grep, Glob, Bash

# Debugger
tools: Read, Edit, Bash, Grep, Glob

# Implementer
tools: Read, Write, Edit, Bash, Glob

Agent 示例

代码审查员
---
name: code-reviewer
description: Reviews code for quality and security. Use after code changes.
tools: Read, Grep, Glob, Bash
model: sonnet
---

Review code for:
- Security vulnerabilities
- Code quality issues
- Missing error handling
- Test coverage gaps

Output findings by priority: Critical > Warning > Suggestion
调试器
---
name: debugger
description: Debug errors and test failures.
tools: Read, Edit, Bash, Grep, Glob
model: inherit
---

Debugging process:
1. Capture error details
2. Identify failure location
3. Form hypotheses
4. Test and verify
5. Implement fix

文件位置

类型位置优先级
项目.claude/agents/最高
用户~/.claude/agents/较低

高级模式

可恢复的 Agent
[Agent returns agentId: "abc123"]

# Later: resume with context
claude -r "abc123" "Continue analysis"
Agent 链式调用
Use code-analyzer to find issues,
then use optimizer to fix them

最佳实践

  1. 职责单一 - 每个 Agent 只负责一个明确的用途
  2. 限制工具 - 只授予所需工具
  3. 描述清晰 - 以行动为导向,并包含“proactively”
  4. 版本控制 - 将 .claude/agents/ 纳入 git 版本控制

评论

支持 Markdown