69 lines
No EOL
1.7 KiB
Text
69 lines
No EOL
1.7 KiB
Text
---
|
|
description: Standards for placing Cursor rule files in the correct directory
|
|
globs: *.mdc
|
|
---
|
|
<rule>
|
|
filters:
|
|
# Match any .mdc files
|
|
- type: file_extension
|
|
pattern: "\\.mdc$"
|
|
# Match files that look like Cursor rules
|
|
- type: content
|
|
pattern: "(?s)<rule>.*?</rule>"
|
|
# Match file creation events
|
|
- type: event
|
|
pattern: "file_create"
|
|
|
|
actions:
|
|
- type: reject
|
|
conditions:
|
|
- pattern: "^(?!\\.\\/\\.cursor\\/rules\\/.*\\.mdc$)"
|
|
message: "Cursor rule files (.mdc) must be placed in the .cursor/rules directory"
|
|
|
|
- type: suggest
|
|
message: |
|
|
When creating Cursor rules:
|
|
|
|
1. Always place rule files in PROJECT_ROOT/.cursor/rules/:
|
|
```
|
|
.cursor/rules/
|
|
├── your-rule-name.mdc
|
|
├── another-rule.mdc
|
|
└── ...
|
|
```
|
|
|
|
2. Follow the naming convention:
|
|
- Use kebab-case for filenames
|
|
- Always use .mdc extension
|
|
- Make names descriptive of the rule's purpose
|
|
|
|
3. Directory structure:
|
|
```
|
|
PROJECT_ROOT/
|
|
├── .cursor/
|
|
│ └── rules/
|
|
│ ├── your-rule-name.mdc
|
|
│ └── ...
|
|
└── ...
|
|
```
|
|
|
|
4. Never place rule files:
|
|
- In the project root
|
|
- In subdirectories outside .cursor/rules
|
|
- In any other location
|
|
|
|
metadata:
|
|
priority: high
|
|
version: 1.0
|
|
</rule>
|
|
|
|
examples:
|
|
- input: |
|
|
# Bad: Rule file in wrong location
|
|
rules/my-rule.mdc
|
|
my-rule.mdc
|
|
.rules/my-rule.mdc
|
|
|
|
# Good: Rule file in correct location
|
|
.cursor/rules/my-rule.mdc
|
|
output: "Correctly placed Cursor rule file" |