Skillwright
 Blog

June 4, 2026 · 13 min read · by Harish Ganapathi

Cursor Rules: The Complete Guide (.cursorrules + .mdc)

Cursor rules are how you tell Cursor’s AI to follow your conventions instead of guessing. In 2026 there are two systems: the legacy .cursorrules file and the newer .cursor/rules .mdc directory. This guide covers both — the formats, the four rule types, globs, and the practices that keep rules working.

Key takeaways

  • The modern system is .cursor/rules/*.mdc — scoped rules with frontmatter. A plain .md file there is ignored.
  • Three frontmatter fields control everything: description, globs, and alwaysApply.
  • Four rule types: Always Apply, Apply Intelligently, Apply to Specific Files, Apply Manually (a.k.a. Always / Agent Requested / Auto Attached / Manual).
  • The root .cursorrules file is legacy but still read. Cursor also natively reads AGENTS.md.

What are Cursor rules?

Cursor rules are persistent instructions injected into the model’s context so the AI codes the way your project expects — your stack, your patterns, your forbidden moves. Without them, Cursor re-derives your conventions from whatever files happen to be open, and gets them wrong often enough to be annoying. With them, “use our internal RPC pattern” or “never use any” becomes a standing order.

There are two generations of the feature. Understanding which is which is the whole game.

The legacy .cursorrules file

The original mechanism was a single .cursorrulesfile at the repo root: free-form text or Markdown, no frontmatter, injected into every conversation. It’s elegant — one file, no schema — but everything in it is always on, with no way to scope a rule to one task or one file type. As the file grows it starts contradicting itself.

# Project: Acme API
## Standards
- Strict TypeScript. No `any`, no unguarded `as` casts.
- Functions under 50 lines, files under 800.
## Testing
- Vitest for unit, Playwright for E2E. 80% line coverage.
## Don't
- Don't run `pnpm install` without asking.

Status: legacy

Cursor now treats .cursorrulesas legacy and recommends migrating to Project Rules. It’s still read at the repo root for backward compatibility, but new capabilities target the .mdcsystem, and recent releases have had bugs where root rules weren’t reliably injected. Treat it as a migration source, not a place to invest.

The .cursor/rules system (.mdc)

Project Rules live in .cursor/rules/ as individual .mdcfiles — “Markdown with metadata.” The metadata matters: a plain .md file in that directory is ignored, because it has no frontmatter to tell Cursor when to apply it.

---
description: RPC service conventions for our internal framework
globs: ["src/**/*.ts", "src/**/*.tsx"]
alwaysApply: false
---

- Use our internal RPC pattern when defining services.
- Service names are snake_case.
- See the canonical template below and mirror its structure.

@service-template.ts

The three frontmatter fields

The four rule types

The three fields combine into four practical activation modes. Heads up on naming:Cursor’s current UI says one thing, and almost every third-party guide (and Cursor’s own earlier docs) says another. They’re the same four modes — here are both vocabularies:

Official labelCommon nameWhen it loadsSet by
Always ApplyAlwaysEvery chat sessionalwaysApply: true
Apply IntelligentlyAgent RequestedWhen the agent judges it relevantdescription (no globs)
Apply to Specific FilesAuto AttachedWhen a file matches the patternglobs
Apply ManuallyManualOnly when you @-mention itNeither field

@file references

A rule can pull another file into context with @filename.ts. Instead of pasting a whole boilerplate template into the rule, reference the real file — the rule stays small and never drifts from the source. You can also @-mention a rule in chat to apply it on the spot.

Project Rules vs User Rules vs Team Rules vs Memories

Cursor has four related concepts. Keeping them straight saves a lot of confusion:

ConceptScopeWhere it lives
Project RulesOne codebase.cursor/rules/*.mdc, in version control
User RulesAll your projectsCursor Settings (global, Agent/Chat only)
Team RulesWhole orgCursor dashboard (Team/Enterprise plans)
MemoriesPer project, per userAuto-generated from your chats

The key distinction is Rules vs Memories. Rules are static text you maintain on purpose. Memories are auto-generated— Cursor watches a chat, extracts a durable preference, and stores it so you stop re-explaining yourself. Memories are per-project and per-user, so a teammate doesn’t inherit yours unless you promote it into a rules file by hand.

How to create rules

Best practices

For copy-paste starting points by framework, see the best .cursorrules examples by stack.

Cursor and AGENTS.md

As of 2026, Cursor natively reads AGENTS.md — including nested files in subdirectories, with more specific paths taking precedence. Cursor positions it as a simple, portable alternative to .cursor/rules for straightforward cases. The trade-off: AGENTS.md is plain Markdown with no globs or per-mode activation, so you give up Cursor-specific scoping in exchange for a file that every other agent reads too.

Using Cursor alongside other tools

Here’s the catch almost no rules guide mentions: most developers don’t only use Cursor. The moment you also run Claude Code or Copilot, the same conventions you just encoded in .mdc files have to be re-encoded in CLAUDE.md and copilot-instructions.md — and then kept in sync forever.

Two ways forward: convert your .cursorrules into the other formats once, or keep a single canonical library and compile to all of them. Skillwright does the latter — author once, deploy to Cursor, Claude Code, Windsurf, and Copilot. See how to manage AI coding rules across tools for the full picture, or grab ready-made rule templates to start.

Frequently asked questions

What's the difference between .cursorrules and .cursor/rules?

.cursorrules is the legacy single file at your repo root — always loaded, no scoping. .cursor/rules/ is the newer system: a directory of .mdc files, each with frontmatter (description, globs, alwaysApply) and one of four activation modes. Use .cursor/rules for anything beyond a trivial project.

Are .cursorrules deprecated?

Effectively yes. Cursor treats the root .cursorrules file as legacy and recommends migrating to Project Rules in .cursor/rules. It's still read for backward compatibility today, but new features target the .mdc system, and some recent versions have had bugs where .cursorrules wasn't reliably injected.

How many Cursor rules is too many?

There's no hard cap on the number of rules, but each rule should stay under about 500 lines, and your total context budget is finite. The guidance is to split large rules into smaller composable ones and use Auto Attached / Agent Requested modes so only relevant rules load.

Do Cursor rules work in Agent mode?

Yes. Rules apply in Agent and Chat. User Rules apply only to the Agent/Chat, and Auto Attached rules fire automatically when the agent reads or writes a file matching their globs.

Should I use .cursor/rules or AGENTS.md?

Cursor reads both. Use .cursor/rules when you need globs or per-mode activation that's specific to Cursor. Use AGENTS.md when you want portable, plain-Markdown instructions that other tools (Codex, Copilot, Gemini) also read. Many teams keep AGENTS.md as the source of truth and add .mdc rules only for Cursor-specific scoping.