agentleFS
ivangrynenkoivangrynenko/cursorrules/.cursor/rules/cursor-rules.mdc

cursorrules / rules

Cursor rule88 starsChanged 13 months agoMITView on GitHub

Describes how and where to create Cursor Rules

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
  1. Very specific:

    Location: Always place rule files in PROJECT_ROOT/.cursor/rules/

    line 31
  2. Very specific:

    Use kebab-case for filenames (e.g., php-drupal-standards.mdc)

    line 43
  3. Distinctive:

    Always use the .mdc extension

    line 44
  4. Distinctive:

    Check for overlapping or conflicting rules

    line 78
  5. Distinctive:

    Ensure patterns are efficient and specific

    line 79
  6. Distinctive:

    Test rules against sample code

    line 80
  7. Distinctive:

    Document changes in commit messages

    line 83
  8. Distinctive:

    Use clear, specific regex patterns

    line 88
  9. Distinctive:

    Use multiple conditions for complex rules

    line 92
  10. Distinctive:

    Consider performance impact of complex patterns

    line 93
  11. Distinctive:

    Test rules against both compliant and non-compliant code

    line 96
  12. Distinctive:

    Verify that messages are clear and helpful

    line 97
  13. Distinctive:

    Check for false positives and false negatives

    line 98
  14. Distinctive:

    Ensure rules don't conflict with each other

    line 99

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
cursor-rules.mdc
---
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: **

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.