prpm / rules
Cursor rule122 starsChanged 9 months agoMITView on GitHub
Guidelines for creating Cursor slash commands with correct format, validation, and best practices
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-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-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
We split this creating-cursor-commands.md into the rules it gives an agent
6 rules. About 0 are common, 5 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 30
Descriptive filename: - Use kebab-case (e.g., review-code.md)
- Distinctive: line 68
Must be plain Markdown
- Distinctive: line 69
No YAML frontmatter allowed
- Distinctive: line 254
Before creating a command:
- Distinctive: line 320
NO frontmatter - plain Markdown only
- Distinctive: line 326
When creating Cursor commands, always use plain Markdown without frontmatter.
≈ “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 Cursor Slash Commands
Guidelines for creating effective Cursor slash commands in .cursor/commands/*.md with correct format and validation.
Overview
Cursor slash commands are plain Markdown files that provide quick, focused instructions to the AI assistant. They are invoked explicitly with /command-name in chat.
Key Characteristics:
- File Location:
.cursor/commands/*.md - Format: Plain Markdown (NO frontmatter)
- Invocation:
/command-namein chat - Purpose: Single, focused tasks
Format Requirements
Critical Rules
- NO frontmatter - Cursor commands do NOT support YAML frontmatter
- Plain Markdown only - Just the command instructions
- Descriptive filename - Use kebab-case (e.g.,
review-code.md) - Clear instructions - Tell AI exactly what to do
File Naming
Good:
.cursor/commands/review-code.md → /review-code
.cursor/commands/generate-tests.md → /generate-tests
.cursor/commands/optimize-performance.md → /optimize-performanceBad:
.cursor/commands/rc.md → Too cryptic
.cursor/commands/review_code.md → Use hyphens
.cursor/commands/ReviewCode.md → Use lowercaseSchema Reference
Schema URL: https://github.com/pr-pm/prpm/blob/main/packages/converters/schemas/cursor-command.schema.json
Schema Structure:
{
"type": "object",
"required": ["content"],
"properties": {
"content": {
"type": "string",
"description": "Plain Markdown content describing what the command should do. No frontmatter supported."
}
}
}Key Validation Rules:
- Must be plain Markdown
- No YAML frontmatter allowed
- Content-only structure
Command Structure
Basic Template
# Command Name
Clear description of what this command does.
Include:
- Specific requirements
- Expected output format
- Step-by-step instructions
- Examples of good output
Provide any constraints or conventions to follow.With Detailed Instructions
# Review Code
Review the selected code for:
1. **Code Quality**
- Clean, readable code
- Proper naming conventions
- DRY principle
2. **Security**
- Input validation
- SQL injection risks
- XSS vulnerabilities
3. **Performance**
- Inefficient algorithms
- Memory leaks
- Database optimization
Provide specific file:line references for all issues.
Format as numbered list with severity levels.Common Mistakes
| Mistake | Problem | Solution |
| Adding frontmatter | Not supported in Cursor commands | Remove --- blocks entirely |
| Vague instructions | AI doesn't know what to do | Add specific steps and examples |
| Too many tasks | Command loses focus | Create separate commands |
| No output format | Inconsistent results | Specify expected format |
| Missing context | AI makes assumptions | Reference project conventions |
Example Commands
Code Review
.cursor/commands/review-code.md:
# Review Code
Review the selected code for:
- Code quality and best practices
- Potential bugs or edge cases
- Performance improvements
- Security vulnerabilities
Provide specific, actionable feedback with code examples where appropriate.Test Generation
.cursor/commands/generate-tests.md:
# Generate Tests
Generate comprehensive unit tests for the selected code.
Include:
- Happy path test cases
- Edge cases and error handling
- Mock external dependencies
- Follow existing test patterns in the project
Use the testing framework already configured in the project.Documentation
.cursor/commands/document-function.md:
# Document Function
Generate comprehensive documentation for the selected function.
Include:
- Function signature with parameter types
- Description of what it does and why
- Usage examples
- Any side effects or performance notes
Use JSDoc/TSDoc format for TypeScript/JavaScript.Performance Optimization
.cursor/commands/optimize-performance.md:
# Optimize Performance
Analyze the selected code for performance improvements.
Look for:
- O(n²) or worse algorithms
- Unnecessary re-renders (React)
- Redundant computations
- Memory leaks
- Large bundle contributions
Suggest specific optimizations with code examples and estimated impact.Refactoring
.cursor/commands/refactor-clean.md:
# Refactor for Clean Code
Refactor the selected code to improve maintainability.
Apply:
- Extract large functions (> 50 lines)
- Reduce nesting (early returns)
- Eliminate duplication
- Use meaningful variable names
- Add proper TypeScript types
Preserve all existing functionality and tests.Best Practices
1. Be Specific and Actionable
❌ Bad: "Review the code for issues" ✅ Good: "Review for security vulnerabilities, performance issues, and code quality. Provide specific file:line references."
2. Include Expected Output Format
❌ Bad: "Generate tests" ✅ Good: "Generate tests using Jest. Include happy path, edge cases, and mocks. Follow existing test patterns."
3. Provide Context
❌ Bad: "Add error handling" ✅ Good: "Add try/catch blocks with our standard error handler. Log errors and show user-friendly messages."
4. Keep It Focused
Each command should do ONE thing well.
❌ Bad: Full-stack feature generator ✅ Good: Separate commands for API, component, tests
5. Reference Project Conventions
✅ Good: "Follow component patterns in components/ directory" ✅ Good: "Use the same testing approach as existing tests"
Storage Locations
Commands can be stored in:
- Project:
.cursor/commands/(shared with team, in git) - Global:
~/.cursor/commands/(personal, all projects) - Team: Cursor Dashboard (enterprise)
Recommendation: Store team commands in .cursor/commands/ and commit to version control.
Validation Checklist
Before creating a command:
- Filename is kebab-case and descriptive
- NO frontmatter (plain Markdown only)
- Instructions are clear and specific
- Expected output format is described
- Examples are included
- Steps are actionable
- Command is focused on one task
- File is in
.cursor/commands/directory
Commands vs. Rules
Use Commands When:
- Explicit invocation desired
- Simple, focused task
- Personal productivity shortcut
- One-time operation
Use Rules When:
- Context-aware automatic activation
- File-type specific guidance
- Team conventions
- Always-on standards
Example:
- Command:
/generate-tests- Explicitly generate tests - Rule: Auto-attach testing conventions to
*.test.tsfiles
Common Use Cases
Code Quality
/review-code- Comprehensive code review/refactor-clean- Clean code refactoring/fix-lint- Fix linting issues/improve-types- Improve TypeScript types
Testing
/generate-tests- Generate unit tests/test-edge-cases- Add edge case tests/test-coverage- Analyze test coverage
Documentation
/document-function- Document functions/add-comments- Add explanatory comments/explain-code- Explain complex code
Performance
/optimize-performance- Performance optimization/analyze-complexity- Time complexity analysis/reduce-bundle- Bundle size reduction
Security
/security-audit- Security review/sanitize-input- Add input validation/check-auth- Review authentication
References
- Schema: https://github.com/pr-pm/prpm/blob/main/packages/converters/schemas/cursor-command.schema.json
- Cursor Docs:
/Users/khaliqgant/Projects/prpm/app/packages/converters/docs/cursor.md - Official Docs: https://cursor.com/docs/agent/chat/commands
Remember
Golden Rules:
- NO frontmatter - plain Markdown only
- Descriptive filenames become command names
- Clear, specific instructions
- Include examples and expected output
- One task per command
When creating Cursor commands, always use plain Markdown without frontmatter. This is the key difference from Cursor rules.
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.

