NAME
.cursorrules — instruction file for Cursor
SYNOPSIS
./.cursorrules
METADATA
DESCRIPTION
.cursorrules is the original (now deprecated) project-level instruction file for Cursor, the AI-powered code editor. It is a plain text file placed at the project root that gets injected into the system prompt for all AI interactions — Tab completions, Cmd+K edits, and Chat.
The format is entirely unstructured: Cursor reads the file as a raw string and prepends it to the AI context. While many developers used Markdown-style formatting for readability, Cursor assigns no semantic meaning to headings or structure.
As of late 2024, Cursor deprecated .cursorrules in favor of the new .cursor/rules/*.mdc format, which adds YAML frontmatter, glob-based file scoping, and support for multiple rule files. Existing .cursorrules files continue to work but should be migrated.
STRUCTURE
ANNOTATED EXAMPLE
1You are an expert in TypeScript, React, and Tailwind CSS.
2
3Key principles:
4- Write concise, type-safe TypeScript code
5- Use functional and declarative patterns; avoid classes
6- Prefer iteration and modularization over code duplication
7- Use descriptive variable names with auxiliary verbs (isLoading, hasError)
8
9TypeScript:
10- Use "interface" over "type" for object shapes
11- Avoid enums; use const maps instead
12- Use strict mode with no implicit any
13
14React:
15- Use functional components with TypeScript interfaces for props
16- Use Tailwind CSS for all styling; no CSS modules or styled-components
17- Implement responsive design with mobile-first approach
18- Place static content and interfaces at the end of files
19
20Naming:
21- Components: PascalCase
22- Files: kebab-case
23- Variables/functions: camelCase
24- Constants: UPPER_SNAKE_CASE
COMMON MISTAKES
Cursor's official documentation no longer references .cursorrules. The modern approach uses .cursor/rules/ with .md or .mdc files supporting YAML frontmatter, four activation modes (Always, Auto Attached, Agent Requested, Manual), and three-tier precedence (Team > Project > User). The legacy format still works but receives no new features.
Unlike CLAUDE.md, .cursorrules has no concept of sections or directives. The entire file content is injected into the system prompt as-is. Markdown formatting is preserved visually but has no semantic meaning to Cursor.
The legacy format supports exactly one file at the project root. For directory-scoped rules, migrate to the new .cursor/rules/*.mdc format which supports glob-based file matching.
The .cursorrules content is prepended to every AI request. Long files eat into the context window that could otherwise hold relevant code. Focus on the 10-20 most important conventions.