Skip to content

What Are Cursor Rules

Understanding Cursor Rules

Cursor rules are declarative configuration files that define how Cursor AI behaves within your project. They act as persistent instructions that shape every AI interaction — from code generation and refactoring to code review and debugging. Rather than repeating context in every prompt, rules encode your project's standards once and apply them automatically.

Types of Cursor Rules

1. Project Rules (.cursor/rules/)

The modern approach uses a .cursor/rules/ directory containing .mdc files. Each rule file can target specific file patterns (globs), apply conditionally, and describe exactly when and how Cursor should apply the instruction. This is the recommended format for new projects.

2. Legacy .cursorrules

The older .cursorrules file is a single markdown document in the project root. It applies globally to all interactions within the project. While supported for backward compatibility, it lacks per-file targeting.

3. AGENTS.md

AGENTS.md is an emerging standard for AI coding assistant instructions. It serves a similar purpose to Cursor rules but is designed to be portable across different AI tools (Cursor, Codex, Copilot, etc.).

What Can Cursor Rules Control?

  • Coding style and conventions (indentation, naming, patterns)
  • Framework and library preferences
  • Testing requirements (framework, coverage expectations)
  • Documentation standards
  • Security and performance constraints
  • Project architecture and file organization rules
  • Response format and tone preferences

Next Steps

Ready to create your own rules? Use the Cursor Rules Generator to build rules from templates, or read our project rules guide for detailed configuration examples. Browse templates to find pre-built rule sets for your tech stack.