Agent Development
Comprehensive guide for building autonomous agents in Claude Code plugins with structured frontmatter, system prompts, and triggering conditions.
- Agents are autonomous subprocesses defined in markdown files with YAML frontmatter; use them for multi-step independent tasks, commands for user-initiated actions
- Required frontmatter fields:
name(3–50 lowercase-hyphenated characters),description(with 2–4 concrete triggering examples),model(inherit/sonnet/opus/haiku),color(blue/cyan/green/yellow/magenta/red), optionaltoolsarray for least-privilege access - System prompt design uses second-person voice with clear responsibilities, step-by-step process, quality standards, output format, and edge case handling; keep under 10,000 characters
- Description field is critical: must specify triggering conditions, include
<example>blocks with context, user request, assistant response, and<commentary>explaining why the agent triggers - Validation rules enforce identifier format, description length (10–5,000 chars), and system prompt structure; includes AI-assisted generation templates and testing utilities for triggering verification
Agent Development for Claude Code Plugins
Overview
Agents are autonomous subprocesses that handle complex, multi-step tasks independently. Understanding agent structure, triggering conditions, and system prompt design enables creating powerful autonomous capabilities.
Key concepts:
- Agents are FOR autonomous work, commands are FOR user-initiated actions
- Markdown file format with YAML frontmatter
- Triggering via description field with examples
- System prompt defines agent behavior
- Model and color customization
Agent File Structure
Complete Format
---
More from anthropics/claude-code
frontend-design
Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
36.5Kskill development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill content", or needs guidance on skill structure, progressive disclosure, or skill development best practices for Claude Code plugins.
10.9Kmcp integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context Protocol", "connect external service", mentions "${CLAUDE_PLUGIN_ROOT} with MCP", or discusses MCP server types (SSE, stdio, HTTP, WebSocket). Provides comprehensive guidance for integrating Model Context Protocol servers into Claude Code plugins for external tool and service integration.
8.7Kcommand development
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
8.0Khook development
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.
7.8Kplugin structure
This skill should be used when the user asks to "create a plugin", "scaffold a plugin", "understand plugin structure", "organize plugin components", "set up plugin.json", "use ${CLAUDE_PLUGIN_ROOT}", "add commands/agents/skills/hooks", "configure auto-discovery", or needs guidance on plugin directory layout, manifest configuration, component organization, file naming conventions, or Claude Code plugin architecture best practices.
7.1K