cursor-rules-location — Claude Code rule: what it does
cursor-rules-location keeps repository rule files organized by rejecting any .mdc files created outside the .cursor/rules directory.
no license ★ 1,054 updated 2025-07-17
.cursor/rules/cursor-rules-location.mdcWhat cursor-rules-location does
This rule monitors the creation of .mdc files and content containing <rule> blocks. When an assistant attempts to write instructions into the project root or arbitrary directories, the rule immediately rejects the operation.
It enforces placing all Cursor instructions strictly inside .cursor/rules/, assigning kebab-case filenames, and using the .mdc extension. Any rule written to unauthorized paths will fail to save.
What it helps with
- prevent
.mdcrule files from cluttering the repository root - enforce storing all Cursor instructions inside
.cursor/rules - enforce kebab-case naming for rule files
Example prompts for the agent
- Create a new rule for linting standards in
.cursor/rules/linting.mdc - Set up a project guideline file for testing conventions
How to install cursor-rules-location
Manually: put the files in place
.cursor/rules/cursor-rules-location.mdcFrontmatter: description, globs, alwaysApply
Manually: put the files in place
.claude/rules/cursor-rules-location.mdThe paths frontmatter field limits the files: move globs from the source into paths
AGENTS.md
Codex reads AGENTS.md: paste the rule text there
Manually: put the files in place
.github/instructions/cursor-rules-location.instructions.mdThe applyTo field sets which files it applies to: move globs from the source into applyTo
Manually: put the files in place
.devin/rules/cursor-rules-location.mdManually: put the files in place
.clinerules/cursor-rules-location.mdStep by step, with commands for each platform: Cursor rules: .mdc files, four modes and what replaced .cursorrules
Questions about cursor-rules-location
How to install cursor-rules-location in Claude Code?
Save the rule file to .claude/rules/cursor-rules-location.md. For Cline, place it in .clinerules/cursor-rules-location.md.
What does cursor-rules-location do?
It rejects the creation of .mdc files anywhere outside the .cursor/rules folder.
What naming convention does this rule enforce?
It requires all rule files to use the kebab-case format and keep the .mdc extension.