AgentSkillsCN

agent-development

当用户询问“创建代理”、“编写 AGENT.md”、“子代理”、“专业代理”、“自主代理”、“代理工具”,或需要关于构建具备特定工具访问权限的代理的指导时,应使用此技能。

SKILL.md
--- frontmatter
name: agent-development
description: This skill should be used when the user asks to "create an agent",
  "write AGENT.md", "subagent", "specialized agent", "autonomous agent",
  "agent tools", or needs guidance on building agents with specific tool access.
version: 0.3.1

Agent Development

Guide for creating specialized subagents with AGENT.md files.

Agent Structure

code
agents/
└── agent-name.md       # Flat file (not subdirectory)

AGENT.md Format

yaml
---
name: my-agent
description: |
  When Claude should delegate to this agent. Include trigger phrases
  and example blocks for reliable invocation.

  <example>
  Context: Describe the situation
  user: "Example request"
  assistant: "I'll use the my-agent agent to handle this."
  <commentary>
  Why this triggers the agent.
  </commentary>
  </example>
tools:
  - Read
  - Grep
  - Glob
model: sonnet
color: cyan
---

System prompt for the agent goes here in markdown.

Frontmatter Fields

FieldRequiredDescription
nameYesUnique identifier (kebab-case)
descriptionYesWhen to delegate + trigger phrases
toolsNoTools agent can use (inherits if omitted)
disallowedToolsNoTools to explicitly deny
modelNosonnet, opus, haiku, or inherit
colorNoVisual identifier (cyan, magenta, green, etc.)
permissionModeNodefault, plan, dontAsk, bypassPermissions
skillsNoSkills to preload into context
hooksNoAgent-specific hooks

Example Blocks (Critical)

Use <example> blocks in descriptions for reliable triggering:

yaml
description: |
  Database migration reviewer. Use when checking migration safety.

  <example>
  Context: User about to run a migration
  user: "Can you check this migration?"
  assistant: "I'll use the migration-reviewer agent."
  <commentary>
  Migration safety check requested.
  </commentary>
  </example>

AI-Assisted Creation

Use the agent-creator agent for interactive agent design:

code
Help me create an agent for [purpose]

The agent-creator guides you through:

  1. Understanding core purpose
  2. Selecting appropriate tools
  3. Designing the persona
  4. Generating complete AGENT.md

Agent Patterns

Read-Only Explorer

yaml
---
name: code-explorer
description: Explore codebase without modifications
tools: Read, Grep, Glob, Bash
disallowedTools: Write, Edit, NotebookEdit
model: haiku
---

Full-Access Specialist

yaml
---
name: code-reviewer
description: Review and fix code issues. Use proactively after code changes.
tools: Read, Grep, Glob, Bash, Edit, Write
model: inherit
---

Validation Agent

yaml
---
name: config-validator
description: Validate configuration files for correctness
tools: Read, Grep, Glob
model: haiku
color: green
---

Proactive Triggering

Include "use proactively" for automatic delegation:

yaml
description: Expert test runner. Use proactively after code changes.

Model Selection

ModelUse Case
haikuFast tasks (exploration, validation)
sonnetBalanced (most tasks)
opusComplex reasoning
inheritUse parent's model

Quality Review

After creating an agent, use the skill-reviewer agent to check:

  • Description quality and triggers
  • Tool appropriateness
  • System prompt clarity

Checklist

  • Description has trigger phrases
  • Description has <example> block(s)
  • Tools list matches needs
  • Model choice is appropriate
  • Name is kebab-case
  • System prompt is focused