Claude Code extensibility: agents, skills, output styles...
CRUD operations for agents, skills, and output styles following Anthropic best practices.
IMPORTANT: When creating or editing prompts, use prompt-enhancer skill to improve quality.
Skill("prompt-enhancer") โ Enhance skill/agent prompt content
| Type | Invocation | Purpose | Location |
|---|---|---|---|
| Agents | Task tool | Specialized sub-processes | .claude/agents/ |
| Skills | Model-invoked (autonomous) | Domain knowledge | .claude/skills/{name}/ |
| Output Styles | /output-style command |
Modify main agent behavior | .claude/output-styles/ |
Reference: references/agent-development.md - Full YAML structure, model/tool selection, system prompt patterns, optimization techniques.
---
name: agent-name
description: Use this agent when [use case]. Use PROACTIVELY for [triggers].\n\nExamples:\n<example>\nContext: [situation]\nuser: [request]\nassistant: [response]\n<commentary>[reasoning]</commentary>\n</example>
tools: Grep, Glob, Read, Bash
model: haiku
permissionMode: default
skills: skill-name
---
# Agent Name
Brief mission statement.
## Core Strategy
### 1. Phase Name
Approach and techniques
<format>
Expected output structure
</format>
| Field | Required | Description |
|---|---|---|
name |
Yes | Lowercase, hyphens (e.g., code-reviewer) |
description |
Yes | Single line with \n for newlines, include examples |
tools |
No | Comma-separated; inherits all if omitted |
model |
No | haiku, sonnet, opus, inherit (default: sonnet) |
permissionMode |
No | default, acceptEdits, bypassPermissions, plan, ignore |
skills |
No | Comma-separated skill names to auto-load |
| Model | Use When | Target Time |
|---|---|---|
haiku |
Fast tasks, exploration, search | < 3s |
sonnet |
Balanced, most use cases | < 10s |
opus |
Complex reasoning, architecture | < 30s |
inherit |
Match main conversation model | varies |
| Agent | Model | Tools | Purpose |
|---|---|---|---|
general-purpose |
Sonnet | All | Complex research, multi-step operations |
plan |
Sonnet | Read, Glob, Grep, Bash | Research in plan mode |
Explore |
Haiku | Read-only | Fast codebase search (quick/medium/very thorough) |
| Location | Scope | Priority |
|---|---|---|
.claude/agents/ |
Project | Highest |
~/.claude/agents/ |
User (all projects) | Lower |
Plugin agents/ |
Plugin-specific | Varies |
--agents CLI flag |
Session only | Medium |
claude --agents '{
"code-reviewer": {
"description": "Expert code reviewer. Use proactively after code changes.",
"prompt": "You are a senior code reviewer...",
"tools": ["Read", "Grep", "Glob", "Bash"],
"model": "sonnet"
}
}'
Continue previous conversations:
agentIdagent-{agentId}.jsonlagentId to continue with full contextReference: references/skill-development.md - Full structure, trigger patterns, hook system.
---
name: skill-name
description: "[What it does]. [Technologies]. Capabilities: [list]. Actions: [verbs]. Keywords: [triggers]. Use when: [scenarios]."
allowed-tools: Read, Grep, Glob
---
# Skill Name
## Purpose
What this skill helps with
## When to Use
Specific scenarios and conditions
## Key Information
Guidance, patterns, examples
| Field | Required | Description |
|---|---|---|
name |
Yes | Lowercase, hyphens, max 64 chars |
description |
Yes | WHAT + WHEN format, max 1024 chars, quoted |
allowed-tools |
No | Restrict tool access (security) |
Structure:
"[Core purpose]. [Technologies/Stack]. Capabilities: [list]. Actions: [verbs]. Keywords: [triggers]. Use when: [scenarios]."
Good example:
description: "Extract text and tables from PDF files, fill forms, merge documents. Formats: .pdf. Tools: pypdf, pdfplumber. Capabilities: text extraction, form filling, document merging. Actions: extract, fill, merge PDFs. Keywords: PDF, form, document, pypdf, pdfplumber. Use when: working with PDF files, extracting data from documents, filling PDF forms."
Bad examples:
description: Helps with documents # Too vague
description: PDF skill # Missing WHEN triggers
Restrict Claude's tools with allowed-tools:
---
name: safe-reader
description: "Read-only file access. Use when viewing code without modifications."
allowed-tools: Read, Grep, Glob
---
| Location | Scope |
|---|---|
.claude/skills/{name}/SKILL.md |
Project (shared via git) |
~/.claude/skills/{name}/SKILL.md |
User (all projects) |
Plugin skills/ |
Plugin-bundled |
my-skill/
โโโ SKILL.md (required)
โโโ references/ (optional - detailed docs)
โโโ scripts/ (optional - utilities)
โโโ templates/ (optional - templates)
Modify Claude Code's main agent behavior.
---
name: My Custom Style
description: Brief description of behavior
keep-coding-instructions: true
---
# Custom Style Instructions
You are an interactive CLI tool that helps users...
## Specific Behaviors
[Define assistant behavior...]
| Field | Purpose | Default |
|---|---|---|
name |
Display name | Filename |
description |
UI description | None |
keep-coding-instructions |
Retain coding instructions | false |
TODO(human) markers~/.claude/output-styles/.claude/output-styles//output-style # Access menu
/output-style explanatory # Switch directly
Agent Testing:
Task(
subagent_type="agent-name",
description="Test task",
prompt="Detailed test prompt"
)
Skill Testing:
claude --debug.claude/agents/{name}.md.claude/skills/{name}/SKILL.mdSkill("prompt-enhancer") to improve promptSkill("prompt-enhancer") to improve promptsโ 500-line rule: Keep SKILL.md and agent prompts under 500 lines โ Progressive disclosure: Use reference files for detailed content โ Proactive language: Include "use PROACTIVELY" in descriptions โ WHAT + WHEN descriptions: Both capability and triggers โ Test first: Build 3+ evaluations before extensive documentation โ Least privilege: Limit tools to necessary set
โ Vague descriptions without triggers โ Over 500 lines without references โ Second-person voice ("you should...") โ All tools when subset suffices โ No examples in agent descriptions
Agent Model Selection:
File Locations:
.claude/agents/*.md.claude/skills/{name}/SKILL.md.claude/output-styles/*.mdManagement Commands:
/agents - Interactive agent management/output-style - Switch output stylesStatus: Production Ready | Lines: ~200 | Progressive Disclosure: โ