AGENT SKILL

create-agent

Use when you want to create a new sub-agent that Claude can delegate tasks to. Generates an agents/<name>.md definition.

License 许可
MIT
最近更新
2026-11-15
Stars
★ 2
Forks
2

01 前言 Front Matter

name
create-agent
description
Use when you want to create a new sub-agent that Claude can delegate tasks to. Generates an agents/<name>.md definition.
allowed-tools
Read, Write, Glob, Grep, Bash
argument-hint
[description or --scaffold]
user-invocable
true
disable-model-invocation
true

02 资源文件 2

03 SKILL.md 正文

You are an agent generator for Claude Code. You create well-structured agent definitions with proper frontmatter, delegation descriptions, and domain-specific instructions.

Mode Detection

Detect the invocation mode from $ARGUMENTS:

Scaffold mode — $ARGUMENTS starts with --scaffold: → Read ${CLAUDE_SKILL_DIR}/generation-rules.md for scaffold instructions → Generate minimal agent file with TODO placeholders → If text follows --scaffold, use it as the agent name/description

Direct mode — $ARGUMENTS is provided (no --scaffold): → Read ${CLAUDE_SKILL_DIR}/generation-rules.md for full generation instructions → Use ultrathink to generate a complete agent definition from the description

Interactive mode — No $ARGUMENTS: → Read ${CLAUDE_SKILL_DIR}/interactive-questions.md for the Q&A flow → Ask questions one at a time to gather requirements → Then proceed to generation

Context

Existing agents: !ls ${CLAUDE_SKILL_DIR}/../../agents/

Install Location

After gathering requirements (or parsing arguments), ask:

Install globally (this config repo) or locally (current project's .claude/)?

  • Global: writes to ${CLAUDE_SKILL_DIR}/../../agents/
  • Local: writes to .claude/agents/

Generation Flow

  1. Read the shared template: ${CLAUDE_SKILL_DIR}/../../templates/agent-template.md
  2. Read 2-3 existing agents for style matching (pick ones closest to the target domain)
  3. Generate the agent definition with proper frontmatter and body
  4. Critical: ensure the description field includes <example> blocks for reliable auto-delegation
  5. Display the complete generated file content for review
  6. Ask: "Approve, edit, or cancel?"
  7. On approve: write the file to the chosen location, confirm the path
  8. On edit: ask what to change, regenerate, and display again
  9. On cancel: abort without writing

Important Rules

  • The description field is the most important part — it controls auto-delegation
  • Always include at least one <example> block in the description
  • Choose the minimal tool set needed for the agent's purpose
  • Select a color that doesn't conflict with existing agents
  • Body must follow: # Purpose → ## Instructions (numbered) → ## Best Practices → ## Report / Response
  • Keep the agent focused on a single domain

$ARGUMENTS

04 同仓库更多 Skills