cursorrules / rules
Cursor rule88 starsChanged 13 months agoMITView on GitHub
Describes how and where to create Cursor Rules
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 repository70 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .cursor/rules/accessibility-standards.mdcCursor rule
- .cursor/rules/api-standards.mdcCursor rule
- .cursor/rules/behat-ai-guide.mdcCursor rule
- .cursor/rules/behat-steps.mdcCursor rule
- .cursor/rules/build-optimization.mdcCursor rule
- .cursor/rules/code-generation-standards.mdcCursor rule
- .cursor/rules/confluence-editing-standards.mdcCursor rule
- .cursor/rules/debugging-standards.mdcCursor rule
- .cursor/rules/docker-compose-standards.mdcCursor rule
- .cursor/rules/drupal-authentication-failures.mdcCursor rule
- .cursor/rules/drupal-broken-access-control.mdcCursor rule
- .cursor/rules/drupal-cryptographic-failures.mdcCursor rule
- .cursor/rules/drupal-database-standards.mdcCursor rule
- .cursor/rules/drupal-file-permissions.mdcCursor rule
- .cursor/rules/drupal-injection.mdcCursor rule
- .cursor/rules/drupal-insecure-design.mdcCursor rule
- .cursor/rules/drupal-integrity-failures.mdcCursor rule
- .cursor/rules/drupal-logging-failures.mdcCursor rule
- .cursor/rules/drupal-security-misconfiguration.mdcCursor rule
- .cursor/rules/drupal-ssrf.mdcCursor rule
- .cursor/rules/drupal-vulnerable-components.mdcCursor rule
- .cursor/rules/generic_bash_style.mdcCursor rule
- .cursor/rules/git-commit-standards.mdcCursor rule
- .cursor/rules/github-actions-standards.mdcCursor rule
- .cursor/rules/improve-cursorrules-efficiency.mdcCursor rule
- .cursor/rules/javascript-broken-access-control.mdcCursor rule
- .cursor/rules/javascript-cryptographic-failures.mdcCursor rule
- .cursor/rules/javascript-identification-authentication-failures.mdcCursor rule
- .cursor/rules/javascript-injection.mdcCursor rule
- .cursor/rules/javascript-insecure-design.mdcCursor rule
- .cursor/rules/javascript-performance.mdcCursor rule
- .cursor/rules/javascript-security-logging-monitoring-failures.mdcCursor rule
- .cursor/rules/javascript-security-misconfiguration.mdcCursor rule
- .cursor/rules/javascript-server-side-request-forgery.mdcCursor rule
- .cursor/rules/javascript-software-data-integrity-failures.mdcCursor rule
- .cursor/rules/javascript-standards.mdcCursor rule
- .cursor/rules/javascript-vulnerable-outdated-components.mdcCursor rule
- .cursor/rules/lagoon-docker-compose-standards.mdcCursor rule
- .cursor/rules/lagoon-yml-standards.mdcCursor rule
- .cursor/rules/multi-agent-coordination.mdcCursor rule
- .cursor/rules/new-pull-request.mdcCursor rule
- .cursor/rules/node-dependencies.mdcCursor rule
- .cursor/rules/php-drupal-best-practices.mdcCursor rule
- .cursor/rules/php-drupal-development-standards.mdcCursor rule
- .cursor/rules/php-memory-optimisation.mdcCursor rule
- .cursor/rules/project-definition-template.mdcCursor rule
- .cursor/rules/pull-request-changelist-instructions.mdcCursor rule
- .cursor/rules/python-authentication-failures.mdcCursor rule
- .cursor/rules/python-broken-access-control.mdcCursor rule
- .cursor/rules/python-cryptographic-failures.mdcCursor rule
- .cursor/rules/python-injection.mdcCursor rule
- .cursor/rules/python-insecure-design.mdcCursor rule
- .cursor/rules/python-integrity-failures.mdcCursor rule
- .cursor/rules/python-logging-monitoring-failures.mdcCursor rule
- .cursor/rules/python-security-misconfiguration.mdcCursor rule
- .cursor/rules/python-ssrf.mdcCursor rule
- .cursor/rules/python-vulnerable-outdated-components.mdcCursor rule
- .cursor/rules/react-patterns.mdcCursor rule
- The first 60 shown.
The file
Show its rules and text
We split this cursor-rules.mdc into the rules it gives an agent
14 rules. About 0 are common, 12 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈12
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 31
Location: Always place rule files in PROJECT_ROOT/.cursor/rules/
- Very specific: line 43
Use kebab-case for filenames (e.g., php-drupal-standards.mdc)
- Distinctive: line 44
Always use the .mdc extension
- Distinctive: line 78
Check for overlapping or conflicting rules
- Distinctive: line 79
Ensure patterns are efficient and specific
- Distinctive: line 80
Test rules against sample code
- Distinctive: line 83
Document changes in commit messages
- Distinctive: line 88
Use clear, specific regex patterns
- Distinctive: line 92
Use multiple conditions for complex rules
- Distinctive: line 93
Consider performance impact of complex patterns
- Distinctive: line 96
Test rules against both compliant and non-compliant code
- Distinctive: line 97
Verify that messages are clear and helpful
- Distinctive: line 98
Check for false positives and false negatives
- Distinctive: line 99
Ensure rules don't conflict with each other
≈ “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
---
description: Describes how and where to create Cursor Rules
globs: *.mdc
---
# Cursor Rules Location
Standards for placing and organizing Cursor rule files in the repository, ensuring rules are always up-to-date and follow best practices.
## Rule Details
- **Name:** cursor_rules_location_and_maintenance
- **Description:** Standards for placing and maintaining Cursor rule files in the correct directory
## Filters
- file extension pattern: `\\.mdc$`
- Match files that look like Cursor rules
- content: `(?s)<rule>.*?</rule>`
- Match file creation or modification events
- event: `file_create|file_modify`
## Rejections
- Conditions:
- pattern `^(?!\\.\\/\\.cursor\\/rules\\/.*\\.mdc$)` – Cursor rule files (.mdc) must be placed in the .cursor/rules directory
## Suggestions
- Guidance:
## Cursor Rules Best Practices
### 1. Location and Structure
- **Location:** Always place rule files in **PROJECT_ROOT/.cursor/rules/**
- **Directory Structure:**
```
PROJECT_ROOT/
├── .cursor/
│ └── rules/
│ ├── your-rule-name.mdc
│ └── ...
└── ...
```
### 2. Naming Conventions
- Use **kebab-case** for filenames (e.g., `php-drupal-standards.mdc`)
- Always use the **.mdc** extension
- Make names descriptive of the rule's purpose
- Group related rules with common prefixes (e.g., `drupal-*`, `lagoon-*`)
### 3. Rule File Structure
```
---
description: Brief description of the rule
globs: *.php, *.module, *.inc
alwaysApply: false
---
# Rule Title
<rule>
name: rule_name_in_snake_case
description: Detailed description of what the rule enforces
filters:
- type: file_extension
pattern: "pattern_to_match"
actions:
- type: enforce|suggest|validate
conditions:
- pattern: "regex_pattern"
message: "Clear message explaining the issue"
metadata:
priority: high|medium|low
version: 1.1
</rule>
```
### 4. Rule Maintenance
- **When adding new rules:**
- Check for overlapping or conflicting rules
- Ensure patterns are efficient and specific
- Test rules against sample code
- **When modifying existing rules:**
- Update version number
- Document changes in commit messages
- Review and update related rules for consistency
- Consider backward compatibility
### 5. Best Practices for Rule Content
- Use clear, specific regex patterns
- Provide helpful, actionable messages
- Include examples of good and bad code
- Set appropriate priority levels
- Use multiple conditions for complex rules
- Consider performance impact of complex patterns
### 6. Rule Testing
- Test rules against both compliant and non-compliant code
- Verify that messages are clear and helpful
- Check for false positives and false negatives
- Ensure rules don't conflict with each other
## Metadata
- Priority: high|medium|low
- Version: 1.1
- - **When Adding New Rules: **
- - **When Modifying Existing 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.

