CursorAI/How To/Share Cursor Project Rules Across Repositories and Users
Properties
- tags
- CursorAI, git, Diataxis/How To
How to share CursorAI/Project Rules across multiple projects and users
Overview
- Cursor project rules are a unique set of Metaprogramming tools. A set of related cursor project rules define the CursorAI Agent Mode's Agentic System, each encapsulating a particular aspect of the overall capabilities of that system.
- It is important for Cursor's users be able to share and collaborate on cursor project rules in a modular, open-source manner where possible, or on teams where that is not feasible, sharing private cursor project rules across the team or across certain scopes of repositories, while maintaining the ability to version the rules and obtain updates to the rules after they have been tested.
- In my opinion, Cursor Project Rules may deserve a new type of Package Manager that allows for rapid prototyping, that is, that allowed one to install a particular version of a "package" of rules, and then modify the library on the fly in response to observed behavior, and have the option to easily offer those contributions back to the source as a merge request. The proposal for such a package manager is out of the scope of this page, however. This guide focuses on how to achieve collaborative sharing of versioned, vetted project rules across repositories and users.
Prerequisites
- Your project must be a git repository
- You must have git installed
- You must have SSH access to GitHub configured (for GitHub-hosted rules)
- Cursor version
0.47or later (which supports project rules in subdirectories) - see CursorAI/Project Rule/Test/Agent/✅/Find MDC/in Subfolder
Steps (adapted from Person/codekiln/GitHub/logseq-cursor-rules README.md)
For Existing Projects
Updating the Rules
Alternatives (Not recommended)
Copy and paste
Use OS/File/System/Link/Soft
- While I have not yet documented it under CursorAI Project Rule Tests, I have found that Cursor does follow rules that are symlinked under
.cursor/rules. To achieve similar behavior to git submodules, one can clone a repository of project rules and then symlink in the rules. Downsides
Extra Tooling
Issues with cross-platform compatibility
- Symlinks work differently in Linux than in Windows.
- Symlinks are only stable in git if they are relative paths. If relative paths are made from
projects/my-project/.cursor/rules/link-*.mdctoprojects/my-centralized-project-rules/link-*.mdc, then all users who editmy-projectwho wish to use the rules inmy-centralized-project-ruleswill need to place it as a sibling directory tomy-project. This is a hard requirement that may or may not make sense for all users.- On may work around this by using two symlinks - the first would go from
projects/my-project/.cursor/rules/link-*.mdctoprojects/my-project/user-rules/link-*.mdc, wheremy-project/user-rulesis added to.gitignoreand not in version control, treating it as a directory similar to.vscodeor.ideafor IDEA, which is allowed to vary between users. It would be a user's responsibility to create symlinks to the rules in this directory on their machine. However, again, there's a need for standardized tooling.
- On may work around this by using two symlinks - the first would go from
- While I have not yet documented it under CursorAI Project Rule Tests, I have found that Cursor does follow rules that are symlinked under