Cursor rules

A Cursor rule is a persistent instruction that tells Cursor’s AI how to generate, edit, and review code for a project. Rules capture conventions like code style, architecture choices, and test expectations, so engineers stop repeating them in every prompt. They make AI output more consistent but do not replace review or tests. This guide assumes rules change how one engineer works; the process around them decides how fast a team delivers.

What are Cursor rules?

Cursor rules are instructions supplied to the agent as model context. They bundle prompts, scripts, and guidance together, making it easy to manage and share workflows across a team. Rules provide persistent, reusable context at the prompt level because large language models do not retain memory between completions.

  • Project Rules in .cursor/rules, version-controlled and scoped to the codebase
  • User Rules, global to your environment and used by the agent
  • Team Rules, managed from the dashboard on Team and Enterprise plans
  • AGENTS.md, a plain markdown alternative in the project root or subdirectories

How are Cursor rules applied?

Rule mode Frontmatter When it loads
Always Apply alwaysApply: true Every chat session; globs ignored
Apply to Specific Files alwaysApply: false with globs A matching file is in context
Apply Intelligently alwaysApply: false with description Agent pulls it in when relevant
Apply Manually alwaysApply: false, no description or globs Only when @-mentioned

File extension matters. A plain markdown file in .cursor/rules is ignored by the rules system because it has no frontmatter, even though the Terminal UI reads every .md file in the same directory. Rules do not affect Tab completion or other AI features.

How do I give rules to Cursor?

Create a rule through Customize then Rules, or type /create-rule in chat and describe what you want. Name the rule for the concern it covers, choose an activation mode, and save it as an .mdc file under .cursor/rules. Point the rule body at real code by referencing a file with an @ symbol followed by the full path. The root .cursorrules file is the legacy format; Cursor documents moving its contents into an Always Apply project rule and removing the old file.

  • Keep each rule under 500 lines; split large rules into composable ones
  • Provide concrete examples or referenced files rather than vague guidance
  • Reference files instead of copying their contents so rules do not go stale
  • Add rules only when you notice the agent repeating the same mistake
  • Check rules into git so the whole team benefits

Where do rules stop being useful?

Rules encode repository conventions, not system-level facts. When a service boundary or dependency changes, a rule such as use CatalogReader must be re-evaluated against the new architecture rather than copied into more prompts. Vague instructions and too many always-on rules crowd out task-specific context, and incorrect paths or metadata can prevent a scoped rule from loading. Human review, automated tests, and security checks still decide whether a change is safe.

How do teams share and maintain rules?

Commit project rules with the code and review edits through pull requests. Team rules are managed from the dashboard and can be enforced so members cannot disable them. When guidance conflicts, rules apply in this order: team, then project, then user. Give each shared rule an owner who updates it when the helpers or paths it references change.

Option Who it fits Downside
Plain prompts Quick evaluation of AI coding Every correction is repeated in the next prompt
Legacy .cursorrules file Older projects not yet migrated Slated for deprecation and less flexible than .mdc rules
Project rules (.mdc) Teams committed to the editor Rules drift when helpers, paths, or contracts change
Pilot: rules plus measured process Teams wanting delivery gains they can verify Three months of one engineer’s focus, and it cannot fix a broken review or release process

Where simpler beats the pilot

If your team is small, has not adopted AI coding tools, and only needs to stop repeating one or two corrections in chat, a single well-scoped rule file and a short review checklist are enough. The pilot’s three months of measured process add overhead a small team does not need. Start with rules, keep them current, and revisit process changes only when the rule file stops moving delivery.