Built-in agents: general, Explore, Plan
Autonomous specialists Claude can delegate to. How agents are defined, how they differ from skills, and when to reach for one.
Agents are autonomous specialists that Claude can delegate to. While skills define what to do (procedural steps), agents define who does it — expert personas that handle tasks independently and return results.
How agents work
When Claude encounters a task that matches an agent’s description, it spawns that agent as a subprocess. The agent gets its own context window, operates autonomously using the tools it’s been granted, and returns a result when it’s done. The parent conversation continues once the agent reports back.
Agents are defined as markdown files in a plugin’s agents/ directory. Claude discovers them at runtime — any .md file in that directory becomes an available agent.
Agents vs skills
They look similar (both are markdown files), but they serve fundamentally different purposes:
| Dimension | Skill | Agent |
|---|---|---|
| Purpose | Procedural workflow — steps Claude follows | Expert persona — autonomous delegate |
| Writing style | Imperative: “Do X, then Y” | Second person: “You are a security analyst…” |
| Triggering | User invokes with /name or keyword match | Claude spawns via the Agent tool when needed |
| Autonomy | Claude executes the steps directly | Agent operates independently, returns results |
| Scope | Can orchestrate multiple agents | Focused on one domain or task |
| Resources | Can bundle references/, scripts/, assets/ | Self-contained in system prompt |
Rule of thumb: If you’re defining what to do, write a skill. If you’re defining who does it, write an agent.
A skill might say “run a code review by spawning these reviewer agents, then synthesize their findings.” Each reviewer agent knows how to review code from its specific perspective (security, performance, clarity) but doesn’t know about the broader workflow.
Writing your first agent
An agent is a markdown file in your plugin’s agents/ directory. Here’s the anatomy:
Frontmatter
---name: code-reviewerdescription: > Use this agent to review code for quality and security issues. <example> Context: User just finished implementing a feature user: "review this code" assistant: "I'll use the code-reviewer agent to analyze the implementation." <commentary>Code was written, trigger review.</commentary> </example>model: inheritcolor: bluetools: ["Read", "Grep", "Glob"]---| Field | What it does |
|---|---|
name | Identifier (lowercase, hyphens, 3-50 chars) |
description | Triggering conditions with <example> blocks showing when to invoke |
model | Which model to use (inherit, sonnet, opus, haiku) |
color | Visual identifier in logs (blue=analysis, green=generation, red=security) |
tools | Restrict which tools the agent can use (principle of least privilege) |
The
<example>blocks in the description are critical. They teach Claude when to invoke the agent. Include 2-4 examples showing different triggering scenarios — both explicit requests (“review this code”) and contextual triggers (code was just written).
System prompt
After the frontmatter, write the agent’s instructions in second person:
You are a code review specialist focused on quality and security.
**Your Core Responsibilities:**1. Analyze code changes for bugs, security issues, and anti-patterns2. Check adherence to project conventions (reference CLAUDE.md)3. Provide actionable feedback with file:line references
**Review Process:**1. Read the diff to understand the scope of changes2. Check each file for issues, categorized by severity3. Verify no security vulnerabilities (OWASP top 10)4. Confirm tests cover the new behavior
**Output Format:**- Summary (1-2 sentences)- Critical issues (must fix before merge)- Important issues (should fix)- Minor issues (nice to have)- Positive observations (what was done well)A good system prompt follows a consistent structure: who you are, what you’re responsible for, how you do the work, and what you return. Be specific — “check for SQL injection by examining queries for parameterization” is better than “check for issues.”
System prompt patterns
Different agent types follow different structures:
| Pattern | When to use | Structure |
|---|---|---|
| Analysis | Code review, security audit, documentation review | Gather context → scan → deep analysis → synthesize → prioritize → report |
| Generation | Code writing, test creation, doc authoring | Understand requirements → gather patterns → design → generate → validate |
| Validation | Preflight checks, acceptance criteria, compliance | Load criteria → scan target → check rules → collect violations → verdict |
| Orchestration | Multi-step workflows, coordination | Plan → prepare → execute phases → monitor → verify → report |
Agent scope and handoffs
Well-designed agents declare what they own and what they defer to others. This prevents agents from stepping on each other and enables intelligent routing.
## Scope
**Owns:**- Security vulnerability analysis- OWASP top 10 compliance checks- Credential and secret detection
**Defers to:**- Performance optimization → @efficiency-auditor- Code style and readability → @clarity-checker- Test coverage assessment → @coverage-analyst
## Handoff Triggers- "If the issue is a performance concern" → @efficiency-auditor- "If the finding requires architectural changes" → orchestrator- "If the fix requires user input on trade-offs" → @human-liaisonThis scope declaration serves two purposes: it keeps the agent focused on its domain, and it gives orchestrators enough information to route work correctly.
Examples from the marketplaces
Carvana marketplace — essentials plugin (14 agents)
| Agent | Pattern | Purpose |
|---|---|---|
@code-reviewer | Analysis | Quality, security, maintainability review |
@debugger | Analysis | Root cause analysis using 5 Whys and Fishbone diagrams |
@backend-architect | Generation | API design, microservices, database schemas |
@codebase-locator | Analysis | Finds WHERE files and components live (never critiques) |
@codebase-analyzer | Analysis | Explains HOW code works (data flow, patterns) |
@codebase-pattern-finder | Analysis | Finds similar implementations and usage examples |
| 8 design analyzers | Analysis | Evaluate designs from different perspectives (simplicity, testability, robustness, etc.) |
Wholesale marketplace — adesa-workflow plugin (7 agents)
| Agent | Pattern | Purpose |
|---|---|---|
aw-discovery | Analysis | Per-repo code research (patterns, contracts, schemas) |
aw-executor | Generation | Implements spec in a repo, verifies, commits atomically |
aw-preflight-checker | Validation | Checks branch state, DI wiring, contracts, config |
aw-verifier | Validation | Post-implementation acceptance criteria verification |
aw-reviewer | Analysis | Multi-perspective code review (8-9 specialized reviewers) |
aw-spec-reviewer | Validation | Compares implementation against spec (blocking gate) |
aw-net10-migrator | Generation | .NET 10 migration with self-updating breaking changes KB |
Notice the pattern: analysis agents are read-only (they observe and report), generation agents can write code, and validation agents produce pass/fail verdicts. Match the tool access to the pattern — analysis agents don’t need
WriteorEdit.
Common mistakes
| Mistake | Why it’s a problem | Fix |
|---|---|---|
No <example> blocks in description | Claude doesn’t know when to invoke the agent | Add 2-4 examples showing triggering scenarios |
| Vague system prompt (“check for issues”) | Agent doesn’t know what to look for | Be specific (“check for SQL injection by examining query parameterization”) |
| No output format defined | Agent returns unstructured text, hard to synthesize | Define exact sections and format |
| Too many responsibilities | Agent tries to do everything, does nothing well | Split into focused specialists |
| Agent marks its own work complete | No independent verification | Have the orchestrating skill verify results |
| Granting all tools | Agent can make changes it shouldn’t | Restrict to minimum needed tools |
Refining agents
The refine-prompt plugin in the Carvana marketplace can audit your agent definitions and suggest improvements:
/refine-prompt --agents ↓Scan agents/*.md ↓Score each agent (0-100): ✓ Clear triggering conditions ✓ Structured system prompt ⚠ Missing edge case handling ⚠ No output format defined ↓Suggest improvements → apply with approvalYou can also iterate manually — agents are just markdown files, so ask Claude to refine them the same way you’d refine any prompt.
Want to skip writing agents by hand? The
agent-generatorplugin can analyze your project’s tech stack and generate a coordinated multi-agent system automatically. Run/init-agentsto get started, then use/evolve-agentsto refine them as your codebase changes.
Next steps
Once you’re comfortable writing individual agents, the next step is composing them into workflows. See LLM Orchestration for patterns on coordinating multiple agents — sequential execution, parallel swarms, multi-perspective analysis, and more.