Cursor rules
Definition
Instruction files in a project's .cursor/rules folder that tell Cursor's agent about conventions, applied always, by file pattern or on request.
In more detail
Each rule is a Markdown file, usually with an .mdc extension, whose frontmatter controls when it applies: always, when files matching a glob are involved, or when the agent decides from the description that it is relevant. A single .cursorrules file in the project root is the older, legacy format.
Cursor also reads AGENTS.md, so many teams keep shared conventions there, where other agents can read them too, and use Cursor rules only for Cursor-specific or path-specific guidance. Keep rules short and concrete, since every always-on rule costs context.
Related terms
AGENTS.md
An open, tool-neutral Markdown file of instructions for coding agents working in a repository, read by many different agents and editors.
CLAUDE.md
Claude Code's instruction file, read at the start of a session from the project and user directories, so standing rules apply every time.
Frontmatter
A block of YAML metadata between two lines of three dashes at the top of a Markdown file, which tools read before the body that follows.
Read more about Cursor rules
- Cursor agent basics: tasks, rules and skills
Use Cursor's agent on a real task: scope it, plan first, use checkpoints, add project rules, AGENTS.md and skills, and review every change before you keep it.
- Write a useful AGENTS.md: example, template and test
An AGENTS.md example and template with build and test commands, conventions and traps, plus a before-and-after task that shows whether the file actually helps.
- Cursor
VS Code-based editor with agent mode, completions and Agent Skills support.