Cursor Rules Directory
Scoped .cursor/rules/*.mdc files with glob patterns, auto-attach triggers, and file references. The modern Cursor project setup.
Description
Cursor deprecated the single .cursorrules file in favor of the .cursor/rules/ directory. Each rule is an .mdc file with YAML frontmatter that controls when it activates: alwaysApply for global standards, glob patterns for file-type scoping, or manual invocation via @ruleName. Rules can reference other files with @filename.ts syntax, pulling in templates and examples as context. This pattern scales naturally — start with one global rule, then add scoped rules as friction points emerge. The WorkOS team and Cursor docs both recommend small, focused rules over one massive file. Community rules are shareable via cursor.directory.
Who is this for
Teams using Cursor as their primary AI editor on medium-to-large codebases with multiple languages or frameworks.
Why files are split this way
Different parts of a codebase need different AI guidance. A React component rule should not fire when editing a database migration. Cursor's glob-based scoping solves this by attaching rules only to matching file paths, keeping each rule focused and reducing prompt bloat.
What changed from the previous setup
A single .cursorrules file in the project root, which is now deprecated by Cursor in favor of the .cursor/rules/ directory.
Related patterns
Universal AGENT.md with Symlinks
One AGENT.md file as the single source of truth, with symlinks to CLAUDE.md, .cursorrules, .windsurfrules, and copilot-instructions.md.
Spec-Driven AI Development
Separates what to build (SPEC.md) from how the AI should work (CLAUDE.md). Specs define features and constraints, CLAUDE.md defines workflow and conventions.
Multi-Editor Frontend Setup
Frontend-optimized AI config covering design system tokens, component conventions, and testing patterns across Cursor, Copilot, and Claude Code simultaneously.