Best practices for designing Claude Code agent files (.claude/agents/*.md). This skill should be used when writing or reviewing agent markdown files to ensure proper design with focused domains, correct tool access, reusable definitions, and separation of capabilities from lifecycle. Combines Anthropic's official guidance with battle-tested patterns from agent team usage.
SkillScore95Maintained
Automatic
◆AI Engineer pack
Last verified 8/18/2026
What it changes
Passed 21 of 22 test cases with the skill, and 14 of 22 without it.
Without skill64%
With skill95%
Checks it passed that the model alone missed
The response lists name, description, and tools as the essential frontmatter keys.
The response identifies the skills list frontmatter field for preloading skill packages.
The frontmatter defines the tools field as a single-line string of comma-separated tool names.
and 5 more in the full report
7 fixed14 passed either way1 still failing0 broke
Pass-rate lift
+32 pp
Tokens
+60%
Agent turns
0%
Response time
-35%
Model gemini-3.6-flashMeasured 8/18/2026v121 of 22 cases passed with skill
Tokens, turns and time describe resource use, not a dollar price.
See it in action
One of 7 test cases the skill fixed. Same model, same prompt, with and without the skill.
1 of 7
Prompt
What are the minimal required YAML frontmatter fields for defining a Claude Code agent file in `.claude/agents/`?
What was checked, without and with the skill
Checked
Without skill
With skill
The response lists name, description, and tools as the essential frontmatter keys.
Missed
Passed
case-11 · gemini-3.6-flash · 8/18/2026 · answers are capped and redacted
What's inside
The instructions your model reads when the skill loads.
SKILL.md214 linessingle file
Agent Design Best Practices
Overview
This skill defines best practices for designing Claude Code agent files (.claude/agents/*.md). Agent files define reusable roles that can be spawned as subagents or teammates. The core principle is that agent files define capabilities, not lifecycle -- the team lead's spawn prompt controls when and how the agent runs.
Principles
1. Define Capabilities, Not Lifecycle
Agent files describe what an agent can do. The spawn prompt from the team lead controls when it runs and what to focus on.
<!-- Wrong: Hardcodes workflow phase and interaction pattern -->
# Security Planner Agent
You are a security specialist in a plan-create Agent Team.
Given a Research Brief from the team lead, identify security
considerations for the planned changes.
## Output Format
Send your sub-plan to the team lead via `SendMessage` with this structure:
...
<!-- Correct: Defines domain expertise, team lead controls usage -->
# Security Specialist Agent
You are a security specialist who identifies vulnerabilities,
evaluates threats, and recommends mitigations for code changes.
## Analysis Process
1. Read affected files
2. STRIDE analysis
3. Check input validation
...