creating-claude-agents
Skill124 starsChanged 8 months agoMITView on GitHub
Use when creating or improving Claude Code agents. Expert guidance on agent file structure, frontmatter, persona definition, tool access, model selection, and validation against schema.
We split this skill into the rules it gives an agent
18 rules. About 0 are common, 14 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈14
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 8
Use this skill when creating or improving Claude Code agents.
- Distinctive: line 85
Should clearly explain when to use the agent
- Distinctive: line 86
Start with action words: "Reviews...", "Analyzes...", "Helps with..."
- Distinctive: line 122
Start with "You are..."
- Distinctive: line 213
Use command patterns to restrict Bash access:
- Distinctive: line 391
Follow the principle of least privilege:
- Very specific: line 406
Always include agentType: agent in frontmatter to preserve type information during format conversions:
- Distinctive: line 522
Before finalizing an agent:
- Very specific: line 599
Verify file is in .claude/agents/*.md
- Distinctive: line 600
Check for frontmatter syntax errors
- Distinctive: line 608
Check name pattern (lowercase, hyphens only)
- Distinctive: line 609
Verify required fields (name, description)
- Distinctive: line 610
Ensure content starts with H1 heading
- Distinctive: line 612
Check allowed-tools spelling and capitalization
- Very specific: line 619
Add tools to allowed-tools in frontmatter
- Very specific: line 620
Use correct capitalization (e.g., Read, not read)
- Distinctive: line 630
Add more specific process steps
- Distinctive: line 633
Consider using more powerful model (opus)
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Creating Claude Code Agents - Expert Skill
Use this skill when creating or improving Claude Code agents. Provides comprehensive guidance on agent structure, schema validation, and best practices for building long-running AI assistants.
When to Use This Skill
Activate this skill when:
- User asks to create a new Claude Code agent
- User wants to improve an existing agent
- User needs help with agent frontmatter or structure
- User is troubleshooting agent validation issues
- User wants to understand agent format requirements
- User asks about agent vs skill vs slash command differences
Quick Reference
Agent File Structure
---
name: agent-name
description: When and why to use this agent
allowed-tools: Read, Write, Bash
model: sonnet
agentType: agent
---
# 🔍 Agent Display Name
You are [persona definition - describe the agent's role and expertise].
## Instructions
[Clear, actionable guidance on what the agent does]
## Process
[Step-by-step workflow the agent follows]
## Examples
[Code samples and use cases demonstrating the agent's capabilities]File Location
Required Path:
.claude/agents/*.mdAgents must be placed in .claude/agents/ directory as markdown files.
Frontmatter Requirements
Required Fields
| Field | Type | Description | Example |
name | string | Agent identifier (lowercase, hyphens only) | code-reviewer |
description | string | Brief overview of functionality and use cases | Reviews code for best practices and potential issues |
Optional Fields
| Field | Type | Description | Values |
allowed-tools | string | Comma-separated list of available tools | Read, Write, Bash, WebSearch |
model | string | Claude model to use | sonnet, opus, haiku, inherit |
agentType | string | Explicit marker for format preservation | agent |
Validation Rules
Name Field:
- Pattern:
^[a-z0-9-]+$(lowercase letters, numbers, hyphens only) - Max length: 64 characters
- Example: ✅
code-reviewer❌Code_Reviewer
Description Field:
- Max length: 1024 characters
- Should clearly explain when to use the agent
- Start with action words: "Reviews...", "Analyzes...", "Helps with..."
Allowed Tools:
Valid tools: Read, Write, Edit, Grep, Glob, Bash, WebSearch, WebFetch, Task, Skill, SlashCommand, TodoWrite, AskUserQuestion
Model Values:
sonnet- Balanced, good for most agents (default)opus- Complex reasoning, architectural decisionshaiku- Fast, simple tasksinherit- Use parent conversation's model
Content Format Requirements
H1 Heading (Required)
The first line of content must be an H1 heading that serves as the agent's display title:
# 🔍 Code ReviewerBest Practices:
- Include an emoji icon for visual distinction
- Use title case
- Keep concise (2-5 words)
- Make it descriptive and memorable
Persona Definition (Required for Agents)
Immediately after the H1, define the agent's persona using "You are..." format:
You are an expert code reviewer with deep knowledge of software engineering principles and security best practices.Guidelines:
- Start with "You are..."
- Define role and expertise clearly
- Set expectations for the agent's capabilities
- Establish the agent's approach and tone
Content Structure
# 🔍 Agent Name
You are [persona definition].
## Instructions
[What the agent does and how it approaches tasks]
## Process
1. [Step 1]
2. [Step 2]
3. [Step 3]
## Examples
[Code samples showing good/bad patterns]
## Guidelines
- [Best practice 1]
- [Best practice 2]Schema Validation
Agents must conform to the JSON schema at:
https://github.com/pr-pm/prpm/blob/main/packages/converters/schemas/claude-agent.schema.json
Schema Structure
{
"frontmatter": {
"name": "string (required)",
"description": "string (required)",
"allowed-tools": "string (optional)",
"model": "enum (optional)",
"agentType": "agent (optional)"
},
"content": "string (markdown with H1, persona, instructions)"
}Common Validation Errors
| Error | Cause | Fix |
| Missing required field 'name' | Frontmatter lacks name field | Add name: agent-name |
| Missing required field 'description' | Frontmatter lacks description | Add description: ... |
| Invalid name pattern | Name contains uppercase or special chars | Use lowercase and hyphens only |
| Name too long | Name exceeds 64 characters | Shorten the name |
| Invalid model value | Model not in enum | Use: sonnet, opus, haiku, or inherit |
| Missing H1 heading | Content doesn't start with # | Add # Agent Name as first line |
Tool Configuration
Inheriting All Tools
Omit the allowed-tools field to inherit all tools from the parent conversation:
---
name: full-access-agent
description: Agent needs access to everything
# No allowed-tools field = inherits all
---Specific Tools Only
Grant minimal necessary permissions:
---
name: read-only-reviewer
description: Reviews code without making changes
allowed-tools: Read, Grep, Bash
---Bash Tool Restrictions
Use command patterns to restrict Bash access:
---
name: git-helper
description: Git operations only
allowed-tools: Bash(git *), Read
---Syntax:
Bash(git *)- Only git commandsBash(npm test:*)- Only npm test scriptsBash(git status:*),Bash(git diff:*)- Multiple specific commands
Model Selection Guide
Sonnet (Most Agents)
Use for:
- Code review
- Debugging
- Data analysis
- General problem-solving
model: sonnetOpus (Complex Reasoning)
Use for:
- Architecture decisions
- Complex refactoring
- Deep security analysis
- Novel problem-solving
model: opusHaiku (Speed Matters)
Use for:
- Syntax checks
- Simple formatting
- Quick validations
- Low-latency needs
model: haikuInherit (Context-Dependent)
Use for:
- Agent should match user's model choice
- Cost sensitivity
model: inheritCommon Mistakes
| Mistake | Problem | Solution |
Using _ in name | Violates pattern constraint | Use hyphens: code-reviewer not code_reviewer |
| Uppercase in name | Violates pattern constraint | Lowercase only: debugger not Debugger |
| Missing persona | Agent lacks role definition | Add "You are..." after H1 |
| No H1 heading | Content format invalid | Start content with # Agent Name |
| Vague description | Agent won't activate correctly | Be specific about when to use |
| Too many tools | Security risk, violates least privilege | Grant only necessary tools |
| No agentType field | May lose type info in conversion | Add agentType: agent |
| Generic agent name | Conflicts or unclear purpose | Use specific, descriptive names |
Best Practices
1. Write Clear, Specific Descriptions
The description determines when Claude automatically invokes your agent.
✅ Good:
description: Reviews code changes for quality, security, and maintainability issues❌ Poor:
description: A helpful agent # Too vague2. Define Strong Personas
Establish expertise and approach immediately after the H1:
# 🔍 Code Reviewer
You are an expert code reviewer specializing in TypeScript and React, with 10+ years of experience in security-focused development. You approach code review systematically, checking for security vulnerabilities, performance issues, and maintainability concerns.3. Provide Step-by-Step Processes
Guide the agent's workflow explicitly:
## Review Process
1. **Read the changes**
- Get recent git diff or specified files
- Understand the context and purpose
2. **Analyze systematically**
- Check each category (quality, security, performance)
- Provide specific file:line references
- Explain why something is an issue
3. **Provide actionable feedback**
- Categorize by severity
- Include fix suggestions
- Highlight positive patterns4. Include Examples
Show both good and bad patterns:
## Examples
When reviewing error handling:
❌ **Bad - Silent failure:**
\`\`\`typescript
try {
await fetchData();
} catch (error) {
console.log(error);
}
\`\`\`
✅ **Good - Proper error handling:**
\`\`\`typescript
try {
await fetchData();
} catch (error) {
logger.error('Failed to fetch data', error);
throw new AppError('Data fetch failed', { cause: error });
}
\`\`\`5. Use Icons in H1 for Visual Distinction
Choose emojis that represent the agent's purpose:
- 🔍 Code Reviewer
- 🐛 Debugger
- 📊 Data Scientist
- 🔒 Security Auditor
- ⚡ Performance Optimizer
- 📝 Documentation Writer
- 🧪 Test Generator
6. Maintain Single Responsibility
Each agent should excel at ONE specific task:
✅ Good:
code-reviewer- Reviews code for quality and securitydebugger- Root cause analysis and minimal fixes
❌ Poor:
code-helper- Reviews, debugs, tests, refactors, documents (too broad)
7. Grant Minimal Tool Access
Follow the principle of least privilege:
# Read-only analysis agent
allowed-tools: Read, Grep
# Code modification agent
allowed-tools: Read, Edit, Bash(git *)
# Full development agent
allowed-tools: Read, Write, Edit, Bash, Grep, Glob8. Include agentType for Round-Trip Conversion
Always include agentType: agent in frontmatter to preserve type information during format conversions:
---
name: code-reviewer
description: Reviews code for best practices
agentType: agent
---Example Agent Templates
Minimal Agent
---
name: simple-reviewer
description: Quick code review for common issues
allowed-tools: Read, Grep
model: haiku
agentType: agent
---
# 🔍 Simple Code Reviewer
You are a code reviewer focused on catching common mistakes quickly.
## Instructions
Review code for:
- Syntax errors
- Common anti-patterns
- Missing error handling
- Console.log statements
Provide concise feedback with file:line references.Comprehensive Agent
---
name: security-auditor
description: Deep security vulnerability analysis for code changes
allowed-tools: Read, Grep, WebSearch, Bash(git *)
model: opus
agentType: agent
---
# 🔒 Security Auditor
You are a security expert specializing in application security, with expertise in OWASP Top 10, secure coding practices, and threat modeling. You perform thorough security analysis of code changes.
## Review Process
1. **Gather Context**
- Read changed files
- Review git history for context
- Identify data flows and trust boundaries
2. **Security Analysis**
- Input validation and sanitization
- Authentication and authorization
- SQL injection risks
- XSS vulnerabilities
- CSRF protection
- Secrets exposure
- Cryptography usage
- Dependency vulnerabilities
3. **Threat Assessment**
- Rate severity (Critical/High/Medium/Low)
- Assess exploitability
- Determine business impact
- Provide remediation guidance
4. **Report Findings**
Use structured format with CVE references where applicable.
## Output Format
**Security Score: X/10**
### Critical Issues (Fix Immediately)
- [Vulnerability] (file:line) - [Explanation] - [CVE if applicable] - [Fix]
### High Priority
- [Issue] (file:line) - [Explanation] - [Fix]
### Medium Priority
- [Concern] (file:line) - [Explanation] - [Recommendation]
### Best Practices
- [Positive security pattern observed]
**Recommendation:** [Approve/Request Changes/Block]
## Examples
### SQL Injection Check
❌ **Vulnerable:**
\`\`\`typescript
const query = \`SELECT * FROM users WHERE id = \${userId}\`;
db.query(query);
\`\`\`
✅ **Safe:**
\`\`\`typescript
const query = 'SELECT * FROM users WHERE id = $1';
db.query(query, [userId]);
\`\`\`Validation Checklist
Before finalizing an agent:
- Name is lowercase with hyphens only
- Name is 64 characters or less
- Description clearly explains when to use the agent
- Description is 1024 characters or less
- Content starts with H1 heading (with emoji icon)
- Persona is defined using "You are..." format
- Process or instructions are clearly outlined
- Examples are included (showing good/bad patterns)
- Tool access is minimal and specific
- Model selection is appropriate for task complexity
- agentType field is set to "agent"
- File is saved in
.claude/agents/directory - Agent has been tested with real tasks
- Edge cases are considered
Schema Reference
Official Schema URL:
https://github.com/pr-pm/prpm/blob/main/packages/converters/schemas/claude-agent.schema.jsonLocal Schema Path:
/Users/khaliqgant/Projects/prpm/app/packages/converters/schemas/claude-agent.schema.jsonRelated Documentation
- agent-builder skill - Creating effective subagents
- slash-command-builder skill - For simpler, command-based prompts
- creating-skills skill - For context-aware reference documentation
- Claude Code Docs: https://docs.claude.com/claude-code
Agents vs Skills vs Commands
Use Agents When:
- ✅ Long-running assistants with persistent context
- ✅ Complex multi-step workflows
- ✅ Specialized expertise needed
- ✅ Tool access required
- ✅ Repeatable processes with quality standards
Use Skills When:
- ✅ Context-aware automatic activation
- ✅ Reference documentation and patterns
- ✅ Team standardization
- ✅ No persistent state needed
Use Slash Commands When:
- ✅ Simple, focused prompts
- ✅ Quick manual invocation
- ✅ Personal productivity shortcuts
- ✅ Single-file prompts
Decision Tree:
Need specialized AI assistant?
├─ Yes → Needs tools and persistent context?
│ ├─ Yes → Use Agent
│ └─ No → Quick invocation?
│ ├─ Yes → Use Slash Command
│ └─ No → Use Skill
└─ No → Just documentation? → Use SkillTroubleshooting
Agent Not Activating
Problem: Agent doesn't get invoked when expected
Solutions:
- Make description more specific to match use case
- Verify file is in
.claude/agents/*.md - Check for frontmatter syntax errors
- Explicitly request: "Use the [agent-name] agent"
Validation Errors
Problem: Agent file doesn't validate against schema
Solutions:
- Check name pattern (lowercase, hyphens only)
- Verify required fields (name, description)
- Ensure content starts with H1 heading
- Validate model value is in enum
- Check allowed-tools spelling and capitalization
Tool Permission Denied
Problem: Agent can't access needed tools
Solutions:
- Add tools to
allowed-toolsin frontmatter - Use correct capitalization (e.g.,
Read, notread) - For Bash restrictions, use pattern syntax:
Bash(git *) - Omit
allowed-toolsfield to inherit all tools
Poor Agent Performance
Problem: Agent produces inconsistent or low-quality results
Solutions:
- Strengthen persona definition
- Add more specific process steps
- Include examples of good/bad patterns
- Define explicit output format
- Consider using more powerful model (opus)
- Break complex agents into specialized ones
Remember: Great agents are specialized experts with clear personas, step-by-step processes, and minimal tool access. Focus each agent on doing ONE thing exceptionally well with measurable outcomes.
Other versions2 projects use a version of this.
Word for word · 1
- nek1987/auto-agent-harness★ 4100% same
Edited · 1
- AgentWorkforce/relay★ 1.1k100% same
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository64 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- beanstalk-deployCursor rule
- .cursor/rules/core-principles.mdcCursor rule
- .cursor/rules/creating-agents-md.mdcCursor rule
- .cursor/rules/creating-claude-agents.mdCursor rule
- .cursor/rules/creating-claude-commands.mdCursor rule
- .cursor/rules/creating-claude-hooks.mdCursor rule
- .cursor/rules/creating-continue-packages.mdCursor rule
- .cursor/rules/creating-copilot-packages.mdCursor rule
- .cursor/rules/creating-cursor-commands.mdCursor rule
- .cursor/rules/creating-cursor-rules.mdcCursor rule
- .cursor/rules/creating-kiro-agents.mdcCursor rule
- .cursor/rules/creating-kiro-packages.mdCursor rule
- .cursor/rules/creating-skills.mdcCursor rule
- .cursor/rules/creating-windsurf-packages.mdCursor rule
- .cursor/rules/elastic-beanstalk-deployment.mdCursor rule
- .cursor/rules/format-conversion.mdcCursor rule
- .cursor/rules/github-actions-testing.mdcCursor rule
- .cursor/rules/karen-repo-reviewer.mdcCursor rule
- .cursor/rules/prpm-json-best-practices.mdcCursor rule
- .cursor/rules/self-improve-cursor.mdcCursor rule
- .cursor/rules/testing-patterns.mdcCursor rule
- .cursor/rules/typescript-type-safety.mdcCursor rule
- .cursor/rules/typescript-type-specialist.mdcCursor rule
- creating-agent-skillsSkill
- adding-new-ai-formatSkill
- agent-builderSkill
- aws-beanstalk-expertSkill
- beanstalk-deploySkill
- claude-hook-writerSkill
- creating-agents-mdSkill
- creating-claude-commandsSkill
- creating-claude-hooksSkill
- creating-claude-rulesSkill
- creating-continue-packagesSkill
- creating-copilot-packagesSkill
- creating-cursor-commandsSkill
- creating-cursor-rules-skillSkill
- creating-kiro-agentsSkill
- creating-kiro-packagesSkill
- creating-opencode-agentsSkill
- creating-opencode-pluginsSkill
- creating-skillsSkill
- creating-windsurf-packagesSkill
- creating-zed-extensionsSkill
- documentation-standardsSkill
- elastic-beanstalk-deploymentSkill
- github-actions-testingSkill
- human-writingSkill
- integrating-stripe-webhooksSkill
- karen-repo-reviewerSkill
- npm-trusted-publishingSkill
- osgrepSkill
- postgres-migrationsSkill
- prpm-developmentSkill
- prpm-json-best-practicesSkill
- pulumi-troubleshootingSkill
- self-improvingSkill
- slash-command-builderSkill
- The first 60 shown.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

