prpm / rules
Cursor rule122 starsChanged 9 months agoMITView on GitHub
Guidelines for creating Claude Code agents with proper frontmatter, persona definition, and schema validation
Where files are headingNew Cursor rule files have more rules about planning and tracking tasks, and fewer about code style.
Of the Cursor rule files we read, the 1,533 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
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-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-agentsSkill
- 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.
The file
Show its rules and text
We split this creating-claude-agents.md into the rules it gives an agent
18 rules. About 0 are common, 15 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈15
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 26
All agents require YAML frontmatter with required and optional fields:
- Distinctive: line 42
Only lowercase letters, numbers, and hyphens
- Distinctive: line 48
Should clearly explain when to use the agent
- Distinctive: line 49
Start with action words: "Reviews...", "Analyzes...", "Helps with..."
- Very specific: line 63
Use opus for complex reasoning
- Very specific: line 64
Use haiku for speed-critical tasks
- Very specific: line 65
Use inherit to match parent conversation
- Distinctive: line 109
Start with "You are..."
- Distinctive: line 208
Follow principle of least privilege:
- Distinctive: line 223
Use command patterns to restrict Bash access:
- Distinctive: line 253
Use for most agents - balanced performance:
- Distinctive: line 264
Use for sophisticated analysis:
- Distinctive: line 275
Use for simple, fast tasks:
- Distinctive: line 286
Use to match parent conversation:
- Distinctive: line 389
Before finalizing an agent:
- Distinctive: line 508
No persistent state needed
- Distinctive: line 546
No persona definition ("You are...") ❌
- Distinctive: line 551
No examples or process steps ❌
≈ “Common” is an estimate: at least 1 in 5 of the 3,030 Cursor rule 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
Claude Code agents are long-running AI assistants with tool access that perform complex, multi-step tasks. This guide ensures agents conform to the required format and schema.
File Location
Agents must be placed in .claude/agents/ directory as markdown files:
.claude/agents/agent-name.mdFormat Requirements
Frontmatter
All agents require YAML frontmatter with required and optional fields:
---
name: agent-name # REQUIRED: lowercase, hyphens only, max 64 chars
description: Brief description # REQUIRED: max 1024 chars
allowed-tools: Read, Write, Bash # OPTIONAL: comma-separated list
model: sonnet # OPTIONAL: sonnet|opus|haiku|inherit
agentType: agent # OPTIONAL: explicit type marker
---Required Fields
- name (string): Agent identifier
- Pattern:
^[a-z0-9-]+$ - Only lowercase letters, numbers, and hyphens
- Max length: 64 characters
- Examples:
code-reviewer,debugger,data-scientist
- Pattern:
- description (string): Human-readable description
- Max length: 1024 characters
- Should clearly explain when to use the agent
- Start with action words: "Reviews...", "Analyzes...", "Helps with..."
Optional Fields
- allowed-tools (string): Comma-separated list of available tools
- Valid tools:
Read,Write,Edit,Grep,Glob,Bash,WebSearch,WebFetch,Task,Skill,SlashCommand,TodoWrite,AskUserQuestion - Omit to inherit all tools from parent conversation
- Examples:
Read, Grep- Read-only accessRead, Edit, Bash(git *)- Edit files and git commands onlyRead, Write, Bash- Full file and command access
- Valid tools:
- model (string): Claude model to use
- Values:
sonnet(default),opus,haiku,inherit - Use
opusfor complex reasoning - Use
haikufor speed-critical tasks - Use
inheritto match parent conversation
- Values:
- agentType (string): Explicit marker
- Value:
agent - Preserves type information during format conversions
- Value:
Content Structure
Content must follow this structure:
# 🔍 Agent Display Name
You are [persona definition - describe the agent's role and expertise].
## Instructions
[What the agent does and how it approaches tasks]
## Process
1. [Step 1]
2. [Step 2]
3. [Step 3]
## Examples
[Code samples and use cases]
## Guidelines
- [Best practice 1]
- [Best practice 2]H1 Heading (Required)
- First line of content must be H1 with emoji icon
- Use title case
- Include relevant emoji for visual distinction
- Examples:
# 🔍 Code Reviewer,# 🐛 Debugger,# 📊 Data Scientist
Persona Definition (Required)
- Start with "You are..."
- Define role and expertise clearly
- Set expectations for capabilities and approach
- Example:
You are an expert code reviewer with deep knowledge of software engineering principles and security best practices.
Schema Validation
Agents must conform to the JSON schema at:
Schema URL:
https://github.com/pr-pm/prpm/blob/main/packages/converters/schemas/claude-agent.schema.jsonValid Example
---
name: code-reviewer
description: Reviews code changes for quality, security, and maintainability issues
allowed-tools: Read, Grep, Bash(git *)
model: sonnet
agentType: agent
---
# 🔍 Code Reviewer
You are an expert code reviewer with deep knowledge of software engineering principles.
## Instructions
Review code changes thoroughly for:
1. Code quality and readability
2. Security vulnerabilities
3. Performance issues
4. Best practices adherence
5. Test coverage
## 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, etc.)
- Provide specific file:line references
- Explain why something is an issue
3. **Provide actionable feedback**
Format findings by severity with specific fix recommendations.
## 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 });
}
\`\`\`
## Guidelines
- Provide specific file:line references for all issues
- Explain the "why" behind each recommendation
- Include code examples in feedback
- Focus on what matters, be thorough but conciseCommon Validation Errors
| Error | Cause | Fix |
| Missing required field 'name' | No name in frontmatter | Add name: agent-name |
| Missing required field 'description' | No description in frontmatter | Add description: ... |
| Invalid name pattern | Uppercase or special characters | Use lowercase and hyphens only |
| Name too long | 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 |
| No persona definition | Missing "You are..." | Add persona after H1 |
Tool Configuration
Grant Minimal Permissions
Follow principle of least privilege:
# Read-only analysis
allowed-tools: Read, Grep
# Code modification
allowed-tools: Read, Edit, Bash(git *)
# Full development
allowed-tools: Read, Write, Edit, Bash, Grep, GlobBash Tool Restrictions
Use command patterns to restrict Bash access:
# Only git commands
allowed-tools: Bash(git *), Read
# Only npm test scripts
allowed-tools: Bash(npm test:*), Read
# Multiple specific commands
allowed-tools: Bash(git status:*), Bash(git diff:*), ReadInherit All Tools
Omit allowed-tools field to inherit all tools from parent conversation:
---
name: full-access-agent
description: Agent with access to all available tools
# No allowed-tools field = inherits all
---Model Selection
Choose the appropriate model for the agent's complexity:
Sonnet (Default)
Use for most agents - balanced performance:
- Code review
- Debugging
- Data analysis
- General problem-solving
model: sonnetOpus (Complex Reasoning)
Use for sophisticated analysis:
- Architecture decisions
- Complex refactoring
- Deep security analysis
- Novel problem-solving
model: opusHaiku (Speed)
Use for simple, fast tasks:
- Syntax checks
- Simple formatting
- Quick validations
- Low-latency needs
model: haikuInherit (Context-Dependent)
Use to match parent conversation:
- Cost-sensitive scenarios
- User preference respect
model: inheritBest Practices
1. 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 (too broad)
2. 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 vague
description: Does code stuff # Not specific3. Strong Persona Definitions
Establish expertise immediately after H1:
You are an expert TypeScript developer with 10+ years of experience in building scalable web applications. You specialize in React, Node.js, and modern JavaScript patterns, with a focus on type safety and maintainability.4. Step-by-Step Processes
Guide the agent's workflow explicitly:
## Process
1. **Gather Context**
- Read relevant files
- Check recent changes
- Understand the goal
2. **Analyze Systematically**
- Apply quality checks
- Verify patterns
- Identify issues
3. **Provide Feedback**
- Categorize by severity
- Include file:line refs
- Suggest fixes5. Include Examples
Show both good and bad patterns:
## Examples
❌ **Anti-pattern:**
\`\`\`typescript
// Bad code example
\`\`\`
✅ **Best practice:**
\`\`\`typescript
// Good code example
\`\`\`6. Use Emoji Icons in H1
Choose emojis that represent the agent's purpose:
- 🔍 Code Reviewer
- 🐛 Debugger
- 📊 Data Scientist
- 🔒 Security Auditor
- ⚡ Performance Optimizer
- 📝 Documentation Writer
- 🧪 Test Generator
7. Always Include agentType
Preserve type information for conversions:
---
name: my-agent
description: My agent description
agentType: agent
---Validation Checklist
Before finalizing an agent:
- Name is lowercase with hyphens only (max 64 chars)
- Description clearly explains when to use (max 1024 chars)
- Content starts with H1 heading (with emoji icon)
- Persona is defined using "You are..." format
- Process/instructions are clearly outlined
- Examples are included (good/bad patterns)
- Tool access is minimal and specific
- Model selection is appropriate
- agentType field is set to "agent"
- File is saved in
.claude/agents/directory - No validation errors against schema
Example Templates
Minimal Agent
---
name: quick-reviewer
description: Fast code review for common issues
allowed-tools: Read, Grep
model: haiku
agentType: agent
---
# 🔍 Quick 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.
## Review Process
1. **Gather Context**
- Read changed files
- Review git history
- Identify data flows
2. **Security Analysis**
- Input validation
- Authentication/authorization
- SQL injection risks
- XSS vulnerabilities
- Secrets exposure
3. **Threat Assessment**
- Rate severity
- Assess exploitability
- Provide remediation
4. **Report Findings**
Structured format with CVE references.
## Output Format
**Security Score: X/10**
### Critical Issues
- [Vulnerability] (file:line) - [Fix]
### High Priority
- [Issue] (file:line) - [Fix]
### Best Practices
- [Positive patterns]
## Examples
❌ **Vulnerable:**
\`\`\`typescript
const query = \`SELECT * FROM users WHERE id = \${userId}\`;
\`\`\`
✅ **Safe:**
\`\`\`typescript
const query = 'SELECT * FROM users WHERE id = $1';
db.query(query, [userId]);
\`\`\`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
Schema Reference
Official Schema:
- GitHub: https://github.com/pr-pm/prpm/blob/main/packages/converters/schemas/claude-agent.schema.json
- Schema ID: https://prpm.dev/schemas/claude-agent.schema.json
Required Structure:
{
"frontmatter": {
"name": "string (pattern: ^[a-z0-9-]+$, maxLength: 64)",
"description": "string (maxLength: 1024)",
"allowed-tools": "string (optional)",
"model": "enum: sonnet|opus|haiku|inherit (optional)",
"agentType": "string: 'agent' (optional)"
},
"content": "string (markdown with H1, persona, instructions)"
}Related Resources
- Agent Builder Skill:
.claude/skills/agent-builder/SKILL.md - Claude Code Docs: https://docs.claude.com/claude-code
- PRPM Format Spec:
/packages/converters/docs/claude.md
Common Mistakes to Avoid
- Using underscores or uppercase in name:
code_reviewerorCodeReviewer❌ - Missing H1 heading in content ❌
- No persona definition ("You are...") ❌
- Vague description that doesn't explain when to use ❌
- Granting too many tools (violates least privilege) ❌
- Missing agentType field (loses type info) ❌
- Creating overly broad agents (should be specialized) ❌
- No examples or process steps ❌
Remember: Great agents are specialized experts with clear personas, explicit processes, and minimal tool access. Focus each agent on doing ONE thing exceptionally well.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
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.

