Guide for creating custom agents for Claude Code with specialized behaviors and tools
Create custom agents with specialized behaviors and tool access for specific workflows. Use when you need domain-specific agents for tasks like code review, testing, or migrations.
/plugin marketplace add vinnie357/claude-skills/plugin install claude-code@vinnie357This skill is limited to using the following tools:
Guide for creating custom agents that provide specialized behaviors and tool access for specific tasks.
Activate this skill when:
Agents are specialized Claude instances with:
| 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 |
Agents are defined in markdown files located in:
<plugin-root>/agents/.claude/agents/code-reviewer.md---
name: code-reviewer
description: Specialized agent for conducting thorough code reviews
tools:
- Read
- Grep
- Glob
model: sonnet
---
# Code Review Agent
I am a specialized code review agent focused on:
## Responsibilities
- Analyzing code for correctness and style
- Identifying security vulnerabilities
- Checking test coverage
- Ensuring documentation quality
- Suggesting improvements
## Review Process
When reviewing code, I will:
1. Read the changed files
2. Check for common anti-patterns
3. Verify error handling
4. Assess test coverage
5. Provide actionable feedback
## Guidelines
- Focus on significant issues
- Provide specific examples
- Suggest concrete improvements
- Consider project context
Required and optional fields:
---
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
---
Restrict agent to specific tools:
---
tools:
- Read # Can read files
- Grep # Can search code
- Glob # Can find files
# Cannot use Write, Edit, Bash, etc.
---
No tool restrictions (access to all tools):
---
# Omit tools field entirely
---
Choose appropriate model for the task:
---
model: haiku # Fast, cost-effective for simple tasks
# model: sonnet # Balanced (default)
# model: opus # Most capable for complex tasks
---
---
name: security-analyzer
description: Analyzes code for security vulnerabilities
tools:
- Read
- Grep
- Glob
model: sonnet
---
# Security Analysis Agent
I perform security analysis on codebases.
## Analysis Areas
- SQL injection vulnerabilities
- XSS attack vectors
- Authentication/authorization issues
- Sensitive data exposure
- Insecure dependencies
## Process
1. Scan for common vulnerability patterns
2. Check security best practices
3. Identify potential risks
4. Provide remediation guidance
---
name: test-generator
description: Generates comprehensive test suites
tools:
- Read
- Write
- Glob
model: sonnet
---
# Test Generation Agent
I create comprehensive test suites for your code.
## Test Types
- Unit tests
- Integration tests
- Edge case coverage
- Error scenario tests
## Approach
1. Analyze source code structure
2. Identify testable units
3. Generate test cases
4. Create test files with proper naming
5. Include setup and teardown logic
---
name: docs-generator
description: Creates and updates project documentation
tools:
- Read
- Write
- Glob
- Grep
model: sonnet
---
# Documentation Agent
I create and maintain project documentation.
## Documentation Types
- README files
- API documentation
- Code comments
- Architecture docs
- User guides
## Standards
- Clear, concise language
- Practical examples
- Up-to-date with codebase
- Proper formatting (Markdown, JSDoc, etc.)
---
name: refactorer
description: Safely refactors code while maintaining functionality
tools:
- Read
- Write
- Edit
- Grep
- Glob
model: sonnet
max_iterations: 20
---
# Code Refactoring Agent
I refactor code to improve quality while preserving behavior.
## Refactoring Goals
- Improve readability
- Reduce complexity
- Eliminate duplication
- Enhance maintainability
- Follow best practices
## Safety Measures
- Preserve existing functionality
- Maintain test coverage
- Document changes
- Use safe transformations
{
"agents": [
"./agents/code-reviewer.md",
"./agents/test-generator.md",
"./agents/security-analyzer.md"
]
}
{
"agents": "./agents"
}
Loads all .md files in agents/ directory.
Agents are launched via the Task tool:
# 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
"""
)
Each agent should have a specific, well-defined purpose:
---
name: migration-helper
description: Assists with database schema migrations
---
# Database Migration Agent
Specialized in creating and validating database migrations.
Only grant necessary tools:
---
# Analysis agent - read-only
tools:
- Read
- Grep
- Glob
---
---
# Implementation agent - can modify
tools:
- Read
- Write
- Edit
- Glob
- Grep
---
Match model to task complexity:
Set appropriate limits for task complexity:
---
max_iterations: 5 # Simple, focused task
# max_iterations: 20 # Complex, multi-step workflow
---
Provide explicit behavior guidelines:
# 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
Limit dangerous operations:
---
# Don't give Bash access to untrusted agents
tools:
- Read
- Write # Safer than arbitrary shell commands
---
Validate agent inputs:
# Deployment Agent
Before deploying:
1. Verify target environment is valid
2. Check deployment permissions
3. Validate configuration
4. Confirm destructive operations
Never hardcode:
---
name: pr-reviewer
description: Reviews pull requests for quality and completeness
tools:
- Read
- Grep
- Glob
model: sonnet
---
# Pull Request Review Agent
Conducting thorough PR review...
## Checklist
- [ ] Code quality and style
- [ ] Test coverage
- [ ] Documentation updates
- [ ] Breaking changes noted
- [ ] Security considerations
- [ ] Performance implications
## Review Process
1. Analyze changed files
2. Check for common issues
3. Verify tests exist
4. Review documentation
5. Provide constructive feedback
---
name: code-migrator
description: Migrates code from one framework/version to another
tools:
- Read
- Write
- Edit
- Glob
- Grep
model: opus
max_iterations: 30
---
# Code Migration Agent
Performing framework migration...
## Migration Steps
1. Analyze current codebase
2. Identify migration patterns
3. Apply transformations
4. Update dependencies
5. Verify compatibility
6. Document changes
## Safety Checks
- Backup original code
- Incremental changes
- Validate each step
- Maintain git history
For more information:
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems. Create original algorithmic art rather than copying existing artists' work to avoid copyright violations.
Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.
Create beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists' work to avoid copyright violations.