claude-agents
Guide for creating custom agents for Claude Code. Use when creating specialized agents, configuring agent tools.
What this skill does
# Claude Code Agents
Guide for creating custom agents that provide specialized behaviors and tool access for specific tasks.
## When spawning as part of a team
Invoke `/core:agent-loop` for the 4-phase / 6-tier execution model.
Invoke `/claude-code:claude-teams` if the agent joins a multi-agent team.
Invoke `/core:anti-fabrication` always — every claim about a tool, file, or test result requires tool execution.
Glob patterns like `/core:*` do not expand in Agent prompts. List skill names explicitly.
## When to Use This Skill
Activate this skill when:
- Creating custom agent types for specific workflows
- Defining agent behaviors and tool permissions
- Configuring agent capabilities
- Understanding agent vs skill differences
- Implementing domain-specific agents
## What Are Agents?
Agents are specialized Claude instances with:
- **Specific tool access**: Limited or specialized tool sets
- **Defined behaviors**: Pre-configured instructions and constraints
- **Task focus**: Optimized for particular workflows
- **Autonomous operation**: Can execute multi-step tasks independently
## Agents vs Skills
| Feature | Agents | Skills |
|---------|--------|--------|
| **Activation** | Explicitly launched via Task tool | Auto-activated based on context |
| **Tool Access** | Configurable, can be restricted | Inherit from parent context |
| **State** | Independent, isolated | Share parent context |
| **Use Case** | Complex multi-step tasks | Knowledge and guidelines |
| **Persistence** | Single execution | Always available when loaded |
## Agent File Structure
### Location
Agents are defined in markdown files located in:
- Plugin: `<plugin-root>/agents/`
- User-level: `.claude/agents/`
### File Naming
- Use kebab-case: `code-reviewer.md`
- File name becomes the agent type
- Be descriptive about the agent's purpose
## Basic Agent Format
```markdown
---
name: code-reviewer
description: Reviews code for quality and best practices
tools: Read, Grep, Glob
model: sonnet
---
You are a code reviewer. Analyze code for quality, security, and best practices.
## Workflow
1. **Find files**: Glob to locate target files
2. **Read code**: Examine contents
3. **Check patterns**: Grep for anti-patterns
4. **Report**: Provide prioritized feedback
## Guidelines
- **Specific**: Reference file:line locations
- **Actionable**: Suggest concrete fixes
- **Prioritized**: Critical issues first
```
## Agent Writing Style
Effective agents use direct, imperative language:
### Opening Statement
- **Do**: "You are a [role]. Your role is to [primary function]."
- **Don't**: "I am a specialized [role] focused on..."
### Workflow Steps
- **Do**: Numbered steps with specific commands
- **Don't**: Bullet lists describing capabilities
### Guidelines Section
- **Do**: Single-word bold labels with brief explanations
- **Don't**: Verbose explanations of best practices
## Agent Configuration
### YAML Frontmatter
Required and optional fields:
```markdown
---
name: agent-name # Required: kebab-case identifier
description: Brief description # Required: What this agent does
tools: # Optional: Tool allowlist
- Read
- Write
- Bash
model: sonnet # Optional: Model to use (sonnet, opus, haiku)
max_iterations: 10 # Optional: Maximum task iterations
timeout: 300 # Optional: Timeout in seconds
---
```
### Tool Allowlist
Restrict agent to specific tools:
- Can read files
- Can search code
- Can find files
- Cannot use Write, Edit, Bash, etc.
Example:
```markdown
---
tools: Read, Grep, Glob
---
```
**No tool restrictions** (access to all tools):
```markdown
---
# Omit tools field entirely
---
```
### Model Selection
Choose appropriate model for the task:
```markdown
---
model: haiku # Fast, cost-effective for simple tasks
# model: sonnet # Balanced (default)
# model: opus # Most capable for complex tasks
---
```
## Common Agent Patterns
### Read-Only Analysis Agent
For security scans, code reviews, or audits. Restricted to Read, Grep, Glob.
See: `templates/read-only-analyzer.md`
### Write-Capable Agent
For generating tests, documentation, or code. Includes Write tool.
See: `templates/write-capable-agent.md`
### Full-Access Agent
For refactoring, migrations, or complex modifications. Omit tools field entirely for no restrictions.
See: `templates/full-access-agent.md`
### MCP-Enabled Agent
For browser automation, external APIs, or specialized MCP server tools. Mix core tools with MCP tools.
See: `templates/mcp-agent.md`
## Agent Plugin Configuration
### In plugin.json
```json
{
"agents": [
"./agents/code-reviewer.md",
"./agents/test-generator.md",
"./agents/security-analyzer.md"
]
}
```
### Directory-Based Loading
```json
{
"agents": "./agents"
}
```
Loads all `.md` files in `agents/` directory.
## Invoking Agents
Agents are launched via the Task tool:
```python
# In parent Claude conversation
Task(
subagent_type="code-reviewer",
description="Review authentication module",
prompt="""
Review the authentication module for:
- Security vulnerabilities
- Error handling
- Input validation
- Best practices
"""
)
```
## Agent Communication
### Input to Agent
- Task description
- Detailed prompt
- Access to conversation history (if configured)
### Output from Agent
- Final report/result
- No ongoing dialogue
- One-time execution
## Best Practices
### Clear Purpose
Each agent has a specific, well-defined purpose:
```markdown
---
name: migration-helper
description: Assists with database schema migrations
---
# Database Migration Agent
Specialized in creating and validating database migrations.
```
### Appropriate Tool Access
Only grant necessary tools:
```markdown
---
# Analysis agent - read-only
tools: Read, Grep, Glob
---
```
```markdown
---
# Implementation agent - can modify
tools: Read, Write, Edit, Glob, Grep
---
```
### Model Selection
Match model to task complexity:
- **haiku**: Simple, repetitive tasks
- **sonnet**: Standard tasks (default)
- **opus**: Complex reasoning required
### Iteration Limits
Set appropriate limits for task complexity:
```markdown
---
max_iterations: 5 # Simple, focused task
# max_iterations: 20 # Complex, multi-step workflow
---
```
### Clear Instructions
Provide explicit behavior guidelines:
```markdown
# Testing Agent
## Mandatory Requirements
- Generate tests for ALL public methods
- Achieve minimum 80% code coverage
- Include edge cases and error scenarios
- Use project's testing framework conventions
## Constraints
- Do not modify source code
- Follow existing test file naming patterns
- Use appropriate assertions
```
## Security Considerations
### Tool Restrictions
Limit dangerous operations:
```markdown
---
# Don't give Bash access to untrusted agents
tools:
- Read
- Write # Safer than arbitrary shell commands
---
```
### Input Validation
Validate agent inputs:
```markdown
# Deployment Agent
Before deploying:
1. Verify target environment is valid
2. Check deployment permissions
3. Validate configuration
4. Confirm destructive operations
```
### Sensitive Data
Never hardcode:
- Credentials
- API keys
- Private URLs
- Access tokens
## Agent Examples
For complete, production-ready agent templates:
- `templates/basic-agent.md` - Official minimal example
- `templates/read-only-analyzer.md` - Security analyzer pattern
- `templates/write-capable-agent.md` - Test generator pattern
- `templates/full-access-agent.md` - Refactoring pattern (no tool restrictions)
- `templates/mcp-agent.md` - Browser testing with MCP tools
## Troubleshooting
### Agent Not Found
- Verify agent file location matches plugin.json
- Check file naming (kebab-case, .md extension)
- Ensure plugin is properly installed
### Tool Access Denied
- Check tools allowlist in frontmatter
- Verify tool names match exactly
- EnsRelated in AI Agents
skill-development
IncludedComprehensive meta-skill for creating, managing, validating, auditing, and distributing Claude Code skills and slash commands (unified in v2.1.3+). Provides skill templates, creation workflows, validation patterns, audit checklists, naming conventions, YAML frontmatter guidance, progressive disclosure examples, and best practices lookup. Use when creating new skills, validating existing skills, auditing skill quality, understanding skill architecture, needing skill templates, learning about YAML frontmatter requirements, progressive disclosure patterns, tool restrictions (allowed-tools), skill composition, skill naming conventions, troubleshooting skill activation issues, creating custom slash commands, configuring command frontmatter, using command arguments ($ARGUMENTS, $1, $2), bash execution in commands, file references in commands, command namespacing, plugin commands, MCP slash commands, Skill tool configuration, or deciding between skills vs slash commands. Delegates to docs-management skill for official documentation.
reprompter
IncludedTransform messy prompts into well-structured, effective prompts — single or multi-agent. Use when: "reprompt", "reprompt this", "clean up this prompt", "structure my prompt", rough text needing XML tags and best practices, "reprompter teams", "repromptception", "run with quality", "smart run", "smart agents", multi-agent tasks, audits, parallel work, anything going to agent teams. Don't use when: simple Q&A, pure chat, immediate execution-only tasks. See "Don't Use When" section for details. Outputs: Structured XML/Markdown prompt, quality score (before/after), optional team brief + per-agent sub-prompts, agent team output files. Success criteria: Single mode quality score ≥ 7/10; Repromptception per-agent prompt quality score 8+/10; all required sections present, actionable and specific.
adaptive-compaction
IncludedAdaptive add-on policy and recovery layer that decides WHEN to compact, prune, snapshot, or fork -- replacing fixed-percent auto-compaction across Claude Code, Codex, and MCP-capable hosts. Trigger on auto-compact timing or damage: "when should I compact", "is it safe to compact now or start a fresh session", "auto-compact fires too early/mid-task", "switching to an unrelated task but the window still has space", "context rot", "answers get worse the longer the session runs", "the agent forgot the plan or my decisions after it summarized", "add a layer on top that manages context without changing the agent", raising autoCompactWindow to give the policy room, or installing/tuning a cross-tool compaction policy or PreCompact hook -- even when "compaction" is never said but the problem is context-window pressure or post-summarization memory loss. Do NOT use to summarize a conversation, build RAG, write a summarization prompt (decides WHEN not HOW), or answer max-context-length trivia.
agent-skill-creator
IncludedCreate cross-platform agent skills from workflow descriptions. Activates when users ask to create an agent, automate a repetitive workflow, create a custom skill, or need advanced agent creation. Triggers on phrases like create agent for, automate workflow, create skill for, every day I have to, daily I need to, turn process into agent, need to automate, create a cross-platform skill, validate this skill, export this skill, migrate this skill. Supports single skills, multi-agent suites, transcript processing, template-based creation, interactive configuration, cross-platform export, and spec validation.
llm-wiki
IncludedUse when building or maintaining a persistent personal knowledge base (second brain) in Obsidian where an LLM incrementally ingests sources, updates entity/concept pages, maintains cross-references, and keeps a synthesis current. Triggers include "second brain", "Obsidian wiki", "personal knowledge management", "ingest this paper/article/book", "build a research wiki", "compound knowledge", "Memex", or whenever the user wants knowledge to accumulate across sessions instead of being re-derived by RAG on every query.
skill-master
IncludedAgent Skills authoring, evaluation, and optimization. Create, edit, validate, benchmark, and improve skills following the agentskills.io specification. Use when designing SKILL.md files, structuring skill folders (references, scripts, assets), ingesting external documentation into skills, running trigger evals, benchmarking skill quality, optimizing descriptions, or performing blind A/B comparisons. Keywords: agentskills.io, SKILL.md, skill authoring, eval, benchmark, trigger optimization.