Guide for creating effective subagents (custom agents). Use when users want to create a new subagent that can be dispatched via Task tool for autonomous work. Covers frontmatter fields (name, description, tools, model, permissionMode, skills), prompt design, and when to use subagents vs skills.
/plugin marketplace add timequity/vibe-coder/plugin install vibe-coder@vibe-coderThis skill inherits all available tools. When active, it can use any tool Claude has access to.
LICENSE.txtreferences/subagent-examples.mdscripts/init_subagent.pyCreate effective subagents that handle autonomous tasks via the Task tool.
| Aspect | Subagent | Skill |
|---|---|---|
| Invocation | Explicit via Task tool | Auto-triggered by context |
| Context | Isolated (fresh context window) | Shared with parent |
| Complexity | Single .md file | Folder with resources |
| Use case | Autonomous discrete tasks | Guidance and procedures |
| Nesting | Cannot spawn other subagents | Can reference other skills |
Use subagent when:
Use skill when:
agents/
└── agent-name.md
├── YAML frontmatter (metadata)
└── Markdown body (system prompt)
| Field | Required | Description |
|---|---|---|
name | Yes | Lowercase, hyphens only (e.g., code-reviewer) |
description | Yes | When to use - this triggers dispatch decisions |
tools | No | Comma-separated: Bash, Glob, Grep, Read, Edit, Write |
model | No | sonnet, opus, haiku, or inherit (default: inherit) |
permissionMode | No | default, acceptEdits, bypassPermissions, plan |
skills | No | Comma-separated skills to auto-load |
Read-only: Glob, Grep, Read, WebFetch, WebSearch
Write: Edit, Write, NotebookEdit
Execute: Bash
All: * (or omit field)
| Mode | Description |
|---|---|
default | Normal permission prompts |
acceptEdits | Auto-accept file edits |
bypassPermissions | Skip all permission prompts |
plan | Plan mode - explore but don't modify |
---
name: agent-name
description: When to use this agent. Be specific about triggers.
tools: Tool1, Tool2
model: sonnet
---
# Agent Name
One-line role description.
## Input Required
What the agent expects to receive.
## Process
Step-by-step what the agent does.
## Output Format
Exact format of the response.
## Rules
- Constraints and boundaries
- What to avoid
The description field triggers when the agent is suggested. Include:
# Good
description: Use after completing a task to review code changes. Provide BASE_SHA, HEAD_SHA, and requirements. Returns issues with file:line references.
# Bad
description: Reviews code.
---
name: summarizer
description: Use to summarize long documents or conversations. Provide the content to summarize.
tools: Read
model: haiku
---
# Summarizer
Summarize the provided content in 3-5 bullet points.
Focus on: key decisions, action items, conclusions.
Skip: greetings, filler, obvious context.
See references/subagent-examples.md for complete examples.
scripts/init_subagent.py <agent-name> --path <output-directory>
Creates template agent file with proper structure.
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.
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
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.