agent-development
Canonical guide to authoring Claude Code agent frontmatter and system prompts. PROACTIVELY activate for: (1) creating a new agent, (2) adding an agent to a plugin, (3) writing agent frontmatter, (4) designing a system prompt, (5) configuring <example> trigger blocks, (6) restricting tools, (7) setting model inherit, (8) migrating deprecated agent true flag, (9) fixing "agent never triggers", (10) ensuring skills have agent trigger coverage. Provides: agent templates, lean-orchestrator pattern, and validation checklist.
What this skill does
# Agent Development for Claude Code Plugins
## Overview
Agents are autonomous subprocesses that handle complex, multi-step tasks independently. Each agent is a markdown file in the `agents/` directory with YAML frontmatter defining its configuration and a markdown body serving as its system prompt.
## Canonical agent frontmatter template (MANDATORY shape)
This is the template every new agent MUST follow. Deviating from this shape is the #1 cause of agents that never trigger.
```yaml
---
name: my-agent # REQUIRED: kebab-case, 3-50 chars, alphanumeric start/end
model: inherit # REQUIRED: always `inherit` unless you have a hard reason
color: blue # RECOMMENDED: one of blue/cyan/green/yellow/magenta/red
tools: Read, Write, Edit, Glob, Grep, Bash # RECOMMENDED: minimal set; omit for full access
description: |
One-sentence summary of what the agent does. PROACTIVELY activate for: (1) concrete trigger, (2) concrete trigger, ..., (N) concrete trigger. Provides: comma-separated capability nouns.
<example>
Context: Realistic situation where the agent should fire
user: "A realistic user quote -- the kind of thing someone would actually type"
assistant: "Short 1-2 sentence response. Mention loading a specific skill if relevant."
<commentary>Triggers for specific-keyword-1, specific-keyword-2, specific-keyword-3</commentary>
</example>
<example>
Context: Another realistic situation covering a different capability
user: "..."
assistant: "..."
<commentary>Triggers for ...</commentary>
</example>
<example>
Context: A debugging / troubleshooting scenario
user: "..."
assistant: "..."
<commentary>Triggers for ...</commentary>
</example>
<example>
Context: A "when to pick this vs. that" scenario
user: "..."
assistant: "..."
<commentary>Triggers for ...</commentary>
</example>
---
You are [role] specializing in [domain]. [Lean orchestrator body -- see "Lean Orchestrator Pattern" below.]
```
### Hard rules for the frontmatter
1. **`name:` is required.** Do NOT use the deprecated `agent: true` flag — that pattern is legacy and results in an unnamed agent that cannot be referenced or routed to reliably. If you find `agent: true` in an existing file, replace it with `name: <kebab-name-from-filename>`.
2. **`model: inherit` is required.** Never hard-code a model unless the agent has a documented capability requirement.
3. **`description:` MUST include the enumerated `PROACTIVELY activate for: (1)... (2)... (N)...` pattern AND a `Provides: ...` capability list.** A description that only says "Use this agent for help with X" will not route reliably.
4. **`<example>` blocks are conditional, not unconditional.** Whether the description needs `<example>` blocks depends on the agent's body word count — see **"Example-block requirement by agent body size"** below. Lean orchestrators deliberately omit them; fat agents need them. Do not blanket-require examples on every agent.
5. **Use `description: |` (YAML block scalar)** whenever the description spans multiple lines or contains `<example>` blocks. A folded scalar (`>`) or implicit flow scalar will mangle the examples.
6. **Do NOT put cross-cutting boilerplate (Windows path rules, documentation policy, etc.) inside the YAML `description:` block.** That text is used for routing-match, and boilerplate that appears in many agents poisons the signal. Put it in the markdown body under a clearly named `## Windows file path requirements` section (or similar) instead.
### Example-block requirement by agent body size (UNIFIED RULE)
The number of `<example>` blocks a description needs is a function of the agent's markdown body word count. This rule reconciles two earlier conflicting recommendations ("always add 4-6 examples" vs. "lean orchestrators don't need examples") into a single tier table that authoring guidance, the canonical checklist, and `scripts/validate_plugins.py` all share.
| Agent body word count | Tier | Example-block requirement |
|---|---|---|
| < 1,500 words | Sub-target | Optional |
| 1,500-2,500 words | **Lean orchestrator (target band)** | **Optional, often omitted by design** |
| 2,500-3,000 words | Above-target | **Recommended (3-5)** |
| > 3,000 words | Oversized | **Required (3-5) AND extraction mandatory** |
The validator only flags "missing examples" when the body crosses 2,500 words (`AGENT_EXAMPLES_THRESHOLD_WORDS`). Lean orchestrators under that threshold pass cleanly without examples — that absence is by design.
**Authoring distilled:** decide lean-orchestrator vs. fat-agent first; if lean, the `PROACTIVELY activate for:` enumeration carries routing and examples are not required. When refactoring fat -> lean, stripping examples is a legitimate part of the refactor. When auditing, compute body word count BEFORE recommending example-block fixes — see "Pre-recommendation intent check" below.
### Deprecated / broken patterns to migrate
| Broken pattern | What it does | Fix |
|---|---|---|
| `agent: true` (no `name:`) | Agent cannot be named/routed reliably | Replace with `name: <kebab-name>` |
| `description:` without `<example>` blocks (agent body > 2,500 words) | Fat agent that routes ambiguously without examples | Add 3-5 `<example>` blocks OR split into orchestrator + skills (preferred) |
| `description:` with "Use this agent for X" prose only | Vague routing, poor trigger | Rewrite with `PROACTIVELY activate for: (1)...` enumeration |
| Windows boilerplate inside YAML `description:` | Pollutes routing signal | Move to `## Windows file path requirements` in body |
| `model:` missing or hard-coded (e.g. `model: sonnet`) | Fails to inherit session model | Set `model: inherit` |
| Single `<example>` block with full code in `assistant:` | Dilutes matching, bloats description | Keep assistant replies to 1-2 sentences; put code in skills |
## Frontmatter Fields Reference
Detailed rules for each frontmatter field (`name`, `description`, `model`, `color`, `tools`) live in `references/frontmatter-fields-reference.md`. Highlights:
- **name** — kebab-case, 3-50 chars, alphanumeric start/end; role-based convention (`code-reviewer`, `domain-expert`).
- **description** — most critical field; must include `PROACTIVELY activate for: (1)... (N)...` enumeration and `Provides: ...` capability list. `<example>` blocks gated by the body-word-count tier table above.
- **model** — `inherit` is the default; only deviate with a documented capability reason.
- **color** — `blue`/`cyan` (analysis), `green` (generation), `yellow` (validation), `red` (critical/security), `magenta` (creative/architecture).
- **tools** — principle of least privilege; common: `Read, Write, Edit, Grep, Glob, Bash, WebSearch, WebFetch, Skill, Agent`. MCP tools as `mcp__server__tool`.
Load `references/frontmatter-fields-reference.md` when authoring or auditing a real agent.
## System Prompt Design
The markdown body becomes the agent's system prompt. Write in **second person** ("You are...", "You will..."). Required sections: Core Responsibilities, Process, Quality Standards, Output Format, Edge Cases. DO be specific and define output clearly; DON'T write in first person, be vague, or embed domain knowledge that belongs in skills. Full template + DO/DON'T list: `references/design-principles-and-mistakes.md`.
## Lean Orchestrator Pattern (CRITICAL)
An agent body must be a **lean orchestrator**, NOT a domain knowledge dump. The agent delegates to skills for detailed knowledge.
### Agent Body Size Limits
| Metric | Target | Hard Maximum |
|--------|--------|-------------|
| Word count | 1,500-2,500 words | 3,000 words |
| Character count | ~10,000-15,000 chars | 20,000 chars |
### What Belongs in the Agent Body
| Section | Required | Purpose |
|---------|----------|---------|
| Role identity | Yes | "You are [role] specializing in [domain]" |
| Skill activation rules | Related in AI Agents
skill-development
IncludedComprehensive meta-skill for creating, managing, validating, auditing, and distributing Claude Code skills and slash commands (unified in v2.1.3+). Provides skill templates, creation workflows, validation patterns, audit checklists, naming conventions, YAML frontmatter guidance, progressive disclosure examples, and best practices lookup. Use when creating new skills, validating existing skills, auditing skill quality, understanding skill architecture, needing skill templates, learning about YAML frontmatter requirements, progressive disclosure patterns, tool restrictions (allowed-tools), skill composition, skill naming conventions, troubleshooting skill activation issues, creating custom slash commands, configuring command frontmatter, using command arguments ($ARGUMENTS, $1, $2), bash execution in commands, file references in commands, command namespacing, plugin commands, MCP slash commands, Skill tool configuration, or deciding between skills vs slash commands. Delegates to docs-management skill for official documentation.
reprompter
IncludedTransform messy prompts into well-structured, effective prompts — single or multi-agent. Use when: "reprompt", "reprompt this", "clean up this prompt", "structure my prompt", rough text needing XML tags and best practices, "reprompter teams", "repromptception", "run with quality", "smart run", "smart agents", multi-agent tasks, audits, parallel work, anything going to agent teams. Don't use when: simple Q&A, pure chat, immediate execution-only tasks. See "Don't Use When" section for details. Outputs: Structured XML/Markdown prompt, quality score (before/after), optional team brief + per-agent sub-prompts, agent team output files. Success criteria: Single mode quality score ≥ 7/10; Repromptception per-agent prompt quality score 8+/10; all required sections present, actionable and specific.
adaptive-compaction
IncludedAdaptive add-on policy and recovery layer that decides WHEN to compact, prune, snapshot, or fork -- replacing fixed-percent auto-compaction across Claude Code, Codex, and MCP-capable hosts. Trigger on auto-compact timing or damage: "when should I compact", "is it safe to compact now or start a fresh session", "auto-compact fires too early/mid-task", "switching to an unrelated task but the window still has space", "context rot", "answers get worse the longer the session runs", "the agent forgot the plan or my decisions after it summarized", "add a layer on top that manages context without changing the agent", raising autoCompactWindow to give the policy room, or installing/tuning a cross-tool compaction policy or PreCompact hook -- even when "compaction" is never said but the problem is context-window pressure or post-summarization memory loss. Do NOT use to summarize a conversation, build RAG, write a summarization prompt (decides WHEN not HOW), or answer max-context-length trivia.
agent-skill-creator
IncludedCreate cross-platform agent skills from workflow descriptions. Activates when users ask to create an agent, automate a repetitive workflow, create a custom skill, or need advanced agent creation. Triggers on phrases like create agent for, automate workflow, create skill for, every day I have to, daily I need to, turn process into agent, need to automate, create a cross-platform skill, validate this skill, export this skill, migrate this skill. Supports single skills, multi-agent suites, transcript processing, template-based creation, interactive configuration, cross-platform export, and spec validation.
llm-wiki
IncludedUse when building or maintaining a persistent personal knowledge base (second brain) in Obsidian where an LLM incrementally ingests sources, updates entity/concept pages, maintains cross-references, and keeps a synthesis current. Triggers include "second brain", "Obsidian wiki", "personal knowledge management", "ingest this paper/article/book", "build a research wiki", "compound knowledge", "Memex", or whenever the user wants knowledge to accumulate across sessions instead of being re-derived by RAG on every query.
skill-master
IncludedAgent Skills authoring, evaluation, and optimization. Create, edit, validate, benchmark, and improve skills following the agentskills.io specification. Use when designing SKILL.md files, structuring skill folders (references, scripts, assets), ingesting external documentation into skills, running trigger evals, benchmarking skill quality, optimizing descriptions, or performing blind A/B comparisons. Keywords: agentskills.io, SKILL.md, skill authoring, eval, benchmark, trigger optimization.