update-agent

修改现有的agent

⭐0stars🔀0forks📁View on GitHub🕐Updated Dec 31, 2025⬇️2downloads

When & Why to Use This Skill

The update-agent skill is a specialized developer utility designed to streamline the maintenance and optimization of AI agents. It provides a structured workflow for modifying existing agent configurations—including model selection, tool permissions, and system instructions—while ensuring YAML frontmatter integrity and architectural consistency within the .claude/agents/ directory.

Use Cases

  • Model Optimization: Quickly upgrade an agent's underlying LLM (e.g., switching from Haiku to Sonnet) to enhance reasoning capabilities for complex tasks.
  • Prompt Engineering Iteration: Refine an agent's core instructions and personas based on performance feedback to improve output accuracy and alignment.
  • Feature Expansion: Update an agent's 'allowed-tools' list to grant new capabilities, such as adding web search or database access to a previously restricted agent.
  • Agent Library Management: Maintain a clean and organized workspace by updating agent descriptions and metadata as project requirements evolve.
nameupdate-agent
description修改现有的agent
allowed-toolsRead, Edit, Glob

更新Agent

目的

修改现有agent的内容。

执行逻辑

1. 列出所有agents

  1. 查找 .claude/agents/ 目录
  2. 列出所有agent(编号列表)
  3. 询问:"要更新哪个agent?"

2. 询问修改内容

询问:"你想修改什么?" 选项:

  • 描述
  • 模型
  • 工具列表
  • 说明/指令
  • 其他

3. 执行修改

根据用户选择,使用Edit工具进行精确修改:

  • 保持YAML frontmatter完整
  • 仅修改指定部分
  • 不改变其他内容

4. 基本验证

检查:

  • YAML frontmatter完整(--- 开始和结束)
  • 必需字段存在
  • 模型值有效(sonnet/opus/haiku/inherit)

成功输出

✅ Agent已更新: {agent-name}
📁 位置: ./.claude/agents/{agent-name}.md

错误处理

  • 未找到 .claude/ → 提示先创建agent
  • YAML格式错误 → 报告具体问题
  • 无效的模型值 → 提示有效选项
  • 无写入权限 → 报告错误

示例

用户: "更新git-helper agent"

执行流程:

  1. 列出agents:
    1. git-helper
    2. code-reviewer
  2. 用户选择: 1
  3. 询问修改内容 → "模型"
  4. 询问新模型 → "opus"
  5. 使用Edit工具更新model字段
  6. 输出成功消息