Rules live in .cursor/rules/ and use .mdc files. As of Cursor 2.2, the format transitions toward folders with RULE.md.
A rule's frontmatter exposes description, globs, and alwaysApply. The combination tells Cursor when the rule should enter the chat.
alwaysApply: true
Injected into every chat message. Globs are ignored.
globs set · alwaysApply: false
Auto-attaches when a referenced/open file matches the glob.
description only
Agent decides whether to load it based on the description.
all empty
Only loads when the user types @rule-name.
A rule that auto-attaches on .tsx files.
--- description: "React component standards for frontend UI files" globs: src/components/**/*.tsx, src/components/**/*.ts alwaysApply: false --- # React Component Guidelines - Define the props 'interface' at the top of the file - Export as a named export (no default exports) - Use Tailwind utility classes; avoid inline style={} objects - Use TanStack Query for server state; never useEffect + fetch @component-template.tsx
Cursor has four scopes layered in precedence order. Commands (a passive context, command set) is a newer surface — 2.0 added that, and the CLI ships built-in slash commands like /summarize.
Enterprise plans — set admin-wide, no frontmatter needed.
Live in the repo and get committed. The format configured with the .cursor/ tree.
Apply only to Agent (Chat) and Inline Edit — and do not influence Cursor's Tab autocomplete.
Keep large rules out of 500 lines; split into composable commands. Communities like cursor.directory distribute ~3.5k-star shared packs.