Workflow

Cursor Rules: How They Work and What Belongs in Them

Published Updated 4 min readBy Vibe Coding Intel editorial

Researched from official docs and public sources, checked .

The short answer: Cursor rules are instruction files the Agent reads so you stop repeating yourself. Project rules live in .cursor/rules/ as .mdc files with a short frontmatter block, and each one is set to apply in one of four ways: always, when the Agent judges it relevant, when matching files are open, or only when you @-mention it. A plain AGENTS.md in the project root is the simpler alternative. Cursor’s own guidance is to keep each rule under 500 lines and to add rules only after the Agent repeats a mistake.

The four rule types

From Cursor’s rules documentation, checked 29 September 2026. The type is set by the frontmatter, which has three fields: alwaysApply, description and globs.

TypeWhen it is includedFrontmatter that sets itUse it for
Always ApplyEvery chat sessionalwaysApply: trueShort facts true everywhere: package manager, test command
Apply IntelligentlyAgent decides from the descriptionalwaysApply: false plus a descriptionTopic guidance, such as frontend component standards
Apply to Specific FilesFiles matching the glob are in playglobs with * and ** patternsLanguage- or folder-specific conventions
Apply ManuallyYou @-mention it, for example @my-ruleNo trigger fieldsRarely needed procedures

Two format details cause most confusion. Project rules must use the .mdc extension; plain .md files in the rules folder are ignored, except the special AGENTS.md. And you rarely need to write the file by hand: typing /create-rule in Agent and describing what you want generates it with frontmatter and saves it to .cursor/rules.

Three places instructions can live

WhereScopeNotes from the docs
.cursor/rules/*.mdcThe project, version-controlledStructured, with the four types above
AGENTS.md (root or subfolders)The projectPlain markdown, “without the overhead of structured rules”; nested files in subdirectories are supported
User Rules (Customize, then Rules)All your projectsApply to Agent chat only, not Inline Edit or other AI features
Team RulesAn organisation, on Team and Enterprise plansSet from the dashboard

When they conflict, precedence runs Team Rules, then Project Rules, then User Rules; all applicable rules are merged and the earlier source wins.

What to put in a rule

Cursor’s guidance, paraphrased: keep rules focused and under 500 lines, split large ones into composable pieces, point at files instead of copying them, do not restate a style guide or common commands, and start small, adding a rule when you see the Agent make the same mistake twice.

A worked layout for a small web app, our example rather than Cursor’s:

  • One alwaysApply: true rule: package manager, how to run tests and the build, and “run the build after a series of changes”.
  • One globs rule for **/*.tsx: component conventions the linter cannot enforce.
  • One intelligent rule with a description like “database migrations and schema changes”, so it loads only when that comes up.
  • Anything longer than a page moves to a referenced doc rather than a rule.

Rules work best alongside the habits that keep Agent output reviewable: one narrow task at a time, @-mentioning the files it depends on, reading every diff before accepting, and committing after each working step. More on the Agent itself is in the Cursor review.

If you also use Claude Code

The two tools converge on the same idea with different limits:

AttributeCursorClaude Code
Always-on filealwaysApply rules or AGENTS.mdCLAUDE.md, loaded every session
Scoped by pathglobs rules.claude/rules/ files with paths frontmatter
On demandApply Intelligently or ManualSkills
Size guidanceUnder 500 lines per ruleCLAUDE.md under about 200 lines
Shared fileAGENTS.mdReads AGENTS.md by default only when there is no CLAUDE.md; a setting reads both

Because both can read AGENTS.md (Claude Code under the condition above), that file is the low-effort way to keep one set of project instructions for both tools. Writing the Claude side well is covered in CLAUDE.md best practices, and the tools are set against each other in Claude Code vs Cursor. Rules do not change what Cursor costs; that is in Cursor pricing explained.

Method

Researched from Cursor’s and Anthropic’s documentation on 29 September 2026. We have not run a comparison of how strictly each tool follows rules, so nothing here rates adherence. Cursor’s rules docs have changed format before; check the current page if a step differs. Re-checked every 60 days.

Common questions

Where do Cursor rules go?

In .cursor/rules/ as .mdc files, or in an AGENTS.md at the project root or in subfolders.

What is the difference between Always Apply and Apply Intelligently?

Always Apply is included in every chat. Apply Intelligently is included when the Agent decides, from its description, that the rule is relevant.

Do User Rules affect Inline Edit?

No. Cursor’s docs say User Rules apply to Agent chat only.

Sources

Update log

  1. New page. Rule types, format, precedence and size guidance read on Cursor's rules docs; Claude Code equivalents from Anthropic's docs.