Recently Written · git

ai-config

One canonical AI agent config (rules, skills, MCP servers) rendered into Claude Code, Codex, Copilot CLI and Antigravity by acsync

git clone https://github.com/equwal/ai-config

Log | Files | Refs


skills/agent-creator/SKILL.md (14587 bytes)

1 ---
2 name: agent-creator
3 description: 'Create production-grade agent .md files aligned with the Anthropic 2026
4   spec (16-field schema).
5 
6   Also validates existing agents against the marketplace compliance rules. Use when
7   building custom
8 
9   subagents, reviewing agent quality, or creating parallel agent architectures for
10   orchestrator skills.
11 
12   Trigger with "/agent-creator", "create an agent", "build a subagent", or "validate
13   my agent".
14 
15   Make sure to use this skill whenever creating agents/*.md files for plugins or standalone
16   use.
17 
18   '
19 allowed-tools: Read,Write,Edit,Glob,Grep,Bash(python:*),AskUserQuestion
20 version: 5.20.0
21 author: Jeremy Longshore <jeremy@intentsolutions.io>
22 license: MIT
23 tags:
24 - agent-creation
25 - validation
26 - meta-tooling
27 - subagents
28 model: inherit
29 compatibility: Designed for Claude Code, also compatible with Codex and OpenClaw
30 ---
31 # Agent Creator
32 
33 Creates spec-compliant agent .md files following the Anthropic 2026 16-field schema. Supports
34 both creation of new agents and validation of existing ones.
35 
36 ## Overview
37 
38 Agent Creator fills the gap between ad-hoc agent files and production-grade agents that pass
39 marketplace validation. It enforces the Anthropic agent schema (14 valid fields), prevents
40 common mistakes (using `allowed-tools` instead of `disallowedTools`, adding invalid fields like
41 `capabilities` or `expertise_level`), and produces agents with substantive body content that
42 actually guides Claude's behavior.
43 
44 Key difference from skill-creator: **agents support both `tools` (allowlist) AND `disallowedTools`
45 (denylist)**. Skills use `allowed-tools` (allowlist) and, since schema 3.7.0, an optional
46 kebab-case `disallowed-tools` denylist — a parallel field, not a unification. Agents also support
47 `effort`, `maxTurns`, `skills`, `memory`, `isolation`, `permissionMode`, `background`, `color`, and
48 `initialPrompt` — fields that don't exist for skills. The agent body becomes the **system prompt**
49 that drives the subagent — it does NOT receive the full Claude Code system prompt.
50 
51 **Field-naming warning:** Agents use camelCase `disallowedTools:` (canonical sub-agents spec);
52 skills use kebab-case `disallowed-tools:` (schema 3.7.0+). The validator rejects either mismatch —
53 never copy-paste between agent and skill frontmatter without renaming.
54 
55 ## Prerequisites
56 
57 - Claude Code CLI with agent support
58 - Target directory writable (`agents/` within a plugin or `~/.claude/agents/` for standalone)
59 - Familiarity with what the agent should specialize in
60 
61 ## Instructions
62 
63 ### Mode Detection
64 
65 Determine user intent from their prompt:
66 
67 - **Create mode**: "create an agent", "build a subagent", "new agent" -> Step 1
68 - **Validate mode**: "validate agent", "check agent", "grade agent" -> Validation Workflow
69 
70 ### Step 1: Understand Requirements
71 
72 Ask the user with AskUserQuestion:
73 
74 **Agent Identity:**
75 
76 - Name (kebab-case, 1-64 chars, e.g., `risk-assessor`, `clause-analyzer`)
77 - Specialty description (20-200 chars — shown in agent selection UI)
78 
79 **Execution Context:**
80 
81 - Plugin agent (`plugins/*/agents/`) or standalone (`~/.claude/agents/`)?
82 - Will it be spawned by an orchestrator skill via `Task` tool?
83 - Does it need to preload specific skills? (`skills: [skill-name]`)
84 
85 **Behavioral Controls:**
86 
87 - Model override? (`sonnet` for speed, `opus` for quality, `inherit` for default)
88 - Reasoning effort? (`low` for simple, `medium` default, `high` for complex analysis)
89 - Max iterations? (`maxTurns` — how many tool-use loops before stopping)
90 - Tools to deny? (`disallowedTools` — denylist approach, opposite of skills)
91 
92 **Plugin Restrictions (if plugin agent):**
93 
94 - `hooks` — NOT supported in plugin agents (use plugin-level hooks)
95 - `mcpServers` — NOT supported in plugin agents
96 - `permissionMode` — standalone only, NOT plugin agents
97 
98 ### Step 2: Plan the Agent
99 
100 Before writing, determine:
101 
102 **Agent Role Clarity:**
103 The agent body must make three things unambiguous:
104 
105 1. **What it IS responsible for** — its specific domain/methodology
106 2. **What it is NOT responsible for** — boundaries with other agents
107 3. **How it communicates results** — output format and structure
108 
109 **Body Structure Pattern:**
110 All production agents should follow this body structure:
111 
112 | Section | Purpose | Required? |
113 |---------|---------|-----------|
114 | `# Title` | Agent name as heading | Yes |
115 | `## Role` | 2-3 sentence domain description with boundaries | Yes |
116 | `## Inputs` | Parameters the agent receives when spawned | Yes (if spawned by orchestrator) |
117 | `## Process` | Step-by-step methodology (numbered steps with ### headings) | Yes |
118 | `## Output Format` | Structured output spec (JSON, markdown, or table) | Yes |
119 | `## Guidelines` | Do/don't behavioral rules | Yes |
120 | `## When Activated` | Trigger conditions (when spawned or auto-detected) | Recommended |
121 | `## Communication Style` | Tone and formatting preferences | Recommended |
122 | `## Success Criteria` | What good vs poor output looks like | Recommended |
123 | `## Examples` | Concrete interaction examples | For complex agents |
124 
125 **Output Structure Decision:**
126 
127 - If the agent feeds into an orchestrator: use **JSON output** (machine-parseable)
128 - If the agent is user-facing: use **markdown output** (human-readable)
129 - If the agent produces both: JSON primary with markdown summary
130 
131 ### Step 3: Write the Agent File
132 
133 Generate the agent .md using the template from
134 `${CLAUDE_SKILL_DIR}/../skill-creator/templates/agent-template.md`.
135 
136 **Frontmatter Rules (Anthropic 16-field schema):**
137 
138 See [Anthropic Agent Spec](references/anthropic-agent-spec.md) for the full official reference.
139 
140 Required fields:
141 
142 ```yaml
143 name: {agent-name}         # Lowercase letters and hyphens, unique identifier
144 description: "{specialty}"  # When Claude should delegate to this subagent
145 ```
146 
147 Optional fields (include only what's needed):
148 
149 ```yaml
150 tools: "Read, Glob, Grep"  # Allowlist — inherits all tools if omitted
151 disallowedTools: "Write"   # Denylist — removed from inherited/specified list
152 model: sonnet              # sonnet|haiku|opus|inherit|full model ID
153 effort: medium             # low|medium|high|max (max = Opus 4.6 only)
154 maxTurns: 15               # Max agentic turns before stopping
155 skills: [skill-name]       # Skills to inject at startup (full content loaded)
156 memory: project            # user|project|local — persistent cross-session
157 background: false          # Always run as background task
158 isolation: worktree        # Run in temporary git worktree
159 color: blue                # Display: red|blue|green|yellow|purple|orange|pink|cyan
160 initialPrompt: "..."       # Auto-submitted first turn (--agent mode only)
161 permissionMode: default    # Standalone only, NOT plugin agents
162 hooks: {}                  # Standalone only, NOT plugin agents
163 mcpServers: {}             # Standalone only, NOT plugin agents
164 ```
165 
166 **Tool access:**
167 
168 - `tools` = allowlist (like skills' `allowed-tools`)
169 - `disallowedTools` = denylist (remove specific tools)
170 - If both set: disallowed applied first, then tools resolved
171 - If neither set: inherits all tools from parent conversation
172 - Naming: always emit camelCase `disallowedTools` on agents. Skills spell their denylist
173   kebab-case (`disallowed-tools`, schema 3.7.0+) — the validator rejects camelCase on skills
174   and kebab-case on agents, so never copy-paste between the two without renaming
175 
176 **Invalid fields (ERROR — never use these):**
177 
178 - `capabilities` — looks valid but flagged by validator
179 - `expertise_level` — invented, not in Anthropic spec
180 - `activation_priority` — invented, not in Anthropic spec
181 - `activation_triggers`, `type`, `category` — not in spec
182 - `allowed-tools` — that's the skill-only syntax; agents use `tools` or `disallowedTools`
183 - `disallowed-tools` (kebab-case) — skill-only spelling (schema 3.7.0+); agents use camelCase `disallowedTools`
184 
185 **Body Content Guidelines:**
186 
187 1. **Role section must set boundaries.** Don't just say what the agent does — say what it
188    does NOT do. Example: "You analyze contract clauses for risk. You do NOT provide legal
189    advice or make recommendations — that is the recommendations agent's responsibility."
190 
191 2. **Process steps must be concrete.** Each step should tell Claude exactly what to do,
192    not vaguely gesture at an activity. Bad: "Analyze the document." Good: "Read the full
193    contract. For each clause, extract: (a) the exact text, (b) the clause category from
194    the taxonomy below, (c) a plain English summary in one sentence."
195 
196 3. **Output format must be machine-parseable if feeding an orchestrator.** Use JSON with
197    a concrete schema example. Include field descriptions so Claude knows what each field means.
198 
199 4. **Guidelines should include both DO and DON'T rules.** Example:
200    - DO: "Be specific — quote exact clause text, don't paraphrase"
201    - DON'T: "Don't make legal recommendations — only identify and score risks"
202 
203 5. **Keep under 300 lines** (agent body limit — prevents context bloat in subagent window).
204    If the agent needs extensive reference material, create a companion skill with
205    `references/` directory and preload it via the `skills` field.
206 
207 ### Step 4: Validate the Agent
208 
209 Run validation against the Anthropic 16-field schema:
210 
211 **Manual checklist:**
212 
213 | Check | Rule |
214 |-------|------|
215 | `name` present | 1-64 chars, kebab-case |
216 | `description` present | 20-200 chars |
217 | No invalid fields | None of: capabilities, expertise_level, activation_priority, type, category |
218 | No skill-only fields | No `allowed-tools`, no kebab-case `disallowed-tools` (agents use `tools` / camelCase `disallowedTools`) |
219 | Plugin restrictions | No hooks/mcpServers/permissionMode if plugin agent |
220 | Body has Role section | Clear domain + boundaries |
221 | Body has Process section | Numbered steps |
222 | Body has Output Format | Concrete schema example |
223 | Body has Guidelines | Do/don't rules |
224 | Body under 300 lines | Offload to references if longer (prevents context bloat) |
225 
226 **Automated validation:**
227 
228 ```bash
229 python3 ${CLAUDE_SKILL_DIR}/../skill-creator/scripts/validate-skill.py --agents-only {plugin-dir}/
230 ```
231 
232 ### Step 5: Test the Agent
233 
234 Test the agent by spawning it via the `Task` tool or the `Agent` tool:
235 
236 1. Write a test prompt that exercises the agent's core capability
237 2. Spawn the agent with that prompt
238 3. Check: Does the output match the declared Output Format?
239 4. Check: Does the agent stay within its declared Role boundaries?
240 5. Check: Does it follow the Process steps?
241 6. Iterate on the body content if the agent strays
242 
243 ### Step 6: Report
244 
245 Provide a summary:
246 
247 - Agent name and file path
248 - Frontmatter field count (of 14 possible)
249 - Body line count
250 - Sections present
251 - Validation result (pass/fail with specific issues)
252 - Test result summary
253 
254 ## Validation Workflow
255 
256 When the user wants to validate an existing agent:
257 
258 1. Locate the agent .md file
259 2. Parse YAML frontmatter
260 3. Check against the 16-field Anthropic schema:
261    - `name` present and valid (1-64 chars, kebab-case)?
262    - `description` present and valid (20-200 chars)?
263    - Any invalid fields? (capabilities, expertise_level, activation_priority, etc.)
264    - Any skill-only fields? (`allowed-tools`, kebab-case `disallowed-tools`)
265    - Plugin restrictions respected?
266 4. Check body content:
267    - Has `## Role` section?
268    - Has `## Process` section with numbered steps?
269    - Has `## Output Format` with concrete example?
270    - Has `## Guidelines`?
271    - Under 300 lines? (agent body limit)
272 5. Report findings with severity (ERROR/WARNING/INFO)
273 6. Suggest specific fixes for each issue
274 
275 ## Output
276 
277 - **Create mode**: A complete agent .md file with valid frontmatter and substantive body,
278   plus a creation report with validation status.
279 - **Validate mode**: A compliance report listing errors, warnings, and info items with
280   specific fix recommendations for each.
281 
282 ## Examples
283 
284 ### Subagent for Orchestrator Skill
285 
286 **Input:** "Create a risk assessment agent that scores contract clauses"
287 
288 **Output:** `agents/risk-assessor.md` with frontmatter:
289 
290 ```yaml
291 name: risk-assessor
292 description: "Score contract clauses for legal and financial risk on a 1-10 scale"
293 model: sonnet
294 effort: high
295 maxTurns: 10
296 ```
297 
298 Body sections: Role (risk scoring specialist, does NOT make recommendations), Inputs
299 (contract_text, contract_type, output_path), Process (4 steps: read, categorize, score,
300 aggregate), Output Format (JSON with clause scores and risk matrix), Guidelines (be specific,
301 cite clause text, use 4-factor scoring methodology).
302 
303 ### Standalone User-Facing Agent
304 
305 **Input:** "Create a code review agent"
306 
307 **Output:** `~/.claude/agents/code-reviewer.md` with frontmatter:
308 
309 ```yaml
310 name: code-reviewer
311 description: "Review code for bugs, performance issues, and security vulnerabilities"
312 effort: high
313 ```
314 
315 Body sections: Role (code quality specialist), Process (read code, check patterns, identify
316 issues, suggest fixes), Output Format (markdown with severity-rated findings), Guidelines
317 (cite line numbers, explain why not just what), Communication Style (direct, educational,
318 actionable).
319 
320 ## Error Handling
321 
322 | Error | Cause | Resolution |
323 |-------|-------|------------|
324 | `allowed-tools` in agent | Used skill-only field | Replace with `tools` (allowlist) or `disallowedTools` (denylist), or remove |
325 | `disallowed-tools` (kebab-case) in agent | Copy-pasted from skill frontmatter | Rename to camelCase `disallowedTools` — the validator rejects the kebab-case spelling on agents |
326 | `capabilities` field | Common mistake — looks valid but isn't in Anthropic spec | Remove field entirely |
327 | `expertise_level` field | Invented field from community templates | Remove — express expertise in body content |
328 | Description > 200 chars | Exceeds Anthropic limit | Shorten to 20-200 char range |
329 | Description < 20 chars | Below minimum | Expand to describe agent's specific specialty |
330 | `permissionMode` in plugin agent | Standalone-only field used in plugin context | Remove — only valid in `~/.claude/agents/` |
331 | `hooks` in plugin agent | Plugin agents can't have hooks | Move to plugin-level `hooks/hooks.json` |
332 | Body has no Process section | Agent lacks step-by-step methodology | Add numbered steps under `## Process` |
333 | Body over 300 lines | Too long for agent context | Extract reference material to companion skill |
334 
335 ## Resources
336 
337 - [Anthropic Agent Spec](references/anthropic-agent-spec.md) — Official 16-field schema from code.claude.com/docs/en/sub-agents
338 - Agent template — Skeleton with placeholders
339 - Frontmatter spec — Field reference (internal)
340 - Source of truth — Canonical spec
341 - Validation rules — Agent validation section