AgentSkillsCN

agent-builder

创建并配置 Claude Code 代理文件(.claude/agents/*.md),包括 YAML 前置信息、工具权限、模型选择,以及系统提示词的结构。当您需要构建新代理、配置代理前置信息、设计发现触发器、设定工具权限、编写系统提示词,或选择代理模型时,可使用此技能。

SKILL.md
--- frontmatter
name: agent-builder
type: standard
depth: base
description: Creates and configures Claude Code agent files (.claude/agents/*.md) with YAML frontmatter, tool permissions, model selection, and system prompt structure. Use when building new agents, configuring agent frontmatter, designing discovery triggers, setting tool permissions, writing system prompts, or selecting agent models.

[H1][AGENT-BUILDER]

Dictum: Structured frontmatter and scoped tools enable discoverable agents.

<br>

Specialized execution contexts for main Claude agent invocation. Frontmatter controls discovery; markdown body encodes behavior.

Location: .claude/agents/ (project) or ~/.claude/agents/ (user). Project agents override user agents on name collision.

Tasks:

  1. Read index.md — Reference file listing for navigation
  2. Read frontmatter.md — Schema, triggers, syntax validation
  3. Read prompt.md — Structure patterns, constraint markers
  4. Read workflow.md — 5-phase creation process
  5. (prose) Load style-standards skill — Voice, formatting, constraints
  6. Execute per workflow — UNDERSTAND, ACQUIRE, RESEARCH, AUTHOR, VALIDATE
  7. Validate — Quality gate; see §VALIDATION

Templates: →agent.template.md — Standard agent scaffold.

[REFERENCE]: index.md — Complete reference file listing


[1][FRONTMATTER]

Dictum: Metadata enables discovery before load.

<br>
yaml
---
name: agent-name
description: >-
  Capability statement. Use when scenario-1, scenario-2, or scenario-3.
tools: Read, Glob, Grep
model: sonnet
skills: style-standards
---
[INDEX][FIELD][TYPE][REQ][CONSTRAINT]
[1]namestringYesKebab-case, max 64 chars, match filename
[2]descriptionstringYesThird person, active voice, trigger clause
[3]toolslistNoComma-separated; omit = inherit all tools
[4]modelenumNohaiku, sonnet, opus, inherit
[5]skillslistNoSkill names agent can invoke

[2][DISCOVERY]

Dictum: Description quality determines invocation accuracy.

<br>

Reasoning matches description directly—no embeddings, no keyword matching.

[INDEX][PATTERN][EXAMPLE][MECHANISM]
[1]"Use when" clauseUse when building MCP serversDirect activation signal
[2]Proactive triggerUse proactively after code changesEncourages auto-invocation
[3]Imperative emphasisMUST BE USED before committingStrong delegation signal
[4]Enumerated list(1) creating, (2) modifyingParallel pattern matching
[5]Technology embedPython (FastMCP) or TypeScriptFramework-specific match
[6]File extensionworking with PDF files (.pdf)Path-based triggering
[7]Catch-allor any other agent tasksBroadens applicability

[CRITICAL]:

  • [NEVER] Hedging words: might, could, should, probably.
  • [ALWAYS] Include "Use when" clause—3+ trigger scenarios.
  • [ALWAYS] Third person, active voice, present tense.

[3][TOOLS]

Dictum: Tool declarations scope permissions.

<br>
[INDEX][PATTERN][TOOLS][USE_CASE]
[1]Read-onlyRead, Glob, GrepAnalysis, review
[2]Write-capableRead, Edit, Write, Glob, BashImplementation
[3]OrchestrationTask, Read, Glob, TodoWriteAgent dispatch
[4]Full access(omit field)Inherits all tools

[IMPORTANT]:

  • [NEVER] Reference @path without Read in tools list.
  • [ALWAYS] Omit tools field for general-purpose agents.
  • [ALWAYS] Scope tools for specialized agents—reviewers require read-only.

[4][MODELS]

Dictum: Model selection balances capability against latency and cost.

<br>
[INDEX][MODEL][ALIAS][STRENGTH][LATENCY][COST]
[1]opusopusComplex reasoningHighHigh
[2]sonnetsonnetBalanced performanceMediumMedium
[3]haikuhaikuFast, simple tasksLowLow
[4]inheritinheritMatch main conversationSessionSession
[INDEX][TASK_TYPE][MODEL]
[1]Multi-file scopeopus
[2]Architectural decisionsopus
[3]Standard developmentsonnet
[4]Fast lookups, filteringhaiku

[IMPORTANT] Omit model field to inherit session default.


[5][SYSTEM_PROMPT]

Dictum: Structured prompts constrain execution.

<br>

Markdown body follows frontmatter. Body encodes agent behavior; structure determines effectiveness.


[6][NAMING]

Dictum: Naming conventions enable discovery.

<br>
[INDEX][PATTERN][EXAMPLE][USE_CASE]
[1]Role-basedcode-reviewerSpecialized function
[2]Action-basedgenerating-commitsGerund form preferred
[3]Domain-specificreact-specialistTechnology expertise

[CRITICAL]:

  • [NEVER] Generic names: helper, processor, agent.
  • [NEVER] Underscores or mixed case.
  • [ALWAYS] Kebab-case—lowercase, hyphens only.
  • [ALWAYS] Filename matches name field exactly.

[7][VALIDATION]

Dictum: Validation gates prevent incomplete artifacts.

<br>

[VERIFY] Completion:

  • Workflow: All 5 phases executed (UNDERSTAND → VALIDATE).
  • Frontmatter: Valid YAML, description with "Use when" clause.
  • Tools: Matches type gate (readonly|write|orchestrator|full).
  • Prompt: Role line + H2 sections + constraint markers.
  • Quality: Kebab-case naming, filename matches name field.

[REFERENCE] Operational checklist: →validation.md