In this categoryCursor ยท 26
CursorBeginner

How to Set Project Rules in Cursor

Add a project rules file so Cursor follows your conventions on every edit instead of relying on per-prompt reminders.

7 minBeginner

Cursor can read a project rules file that it applies to every AI edit in the repo. Setting it up once means you stop repeating the same conventions in each prompt, and the editor's suggestions arrive already shaped to your house style.

What you need

  • Cursor installed with a project open
  • A short list of conventions you care about
  • About 6 minutes

Step 1: Create the rules file

Project rules live in a rules folder at the repo root. Create the folder and a rules file inside it.

zsh - rules dir
$mkdir -p .cursor/rules
$touch .cursor/rules/conventions.mdc
$

Step 2: Write crisp, imperative rules

Short commands work better than prose. List the conventions you most want enforced and keep each to one line.

.cursor/rules/conventions.mdc
# Conventions
- TypeScript strict; never use the any type.
- Named exports only, no default exports.
- Co-locate tests next to the file they cover.
- No comments that just restate the code.

Step 3: Confirm Cursor applies them

Ask the editor for a change that would normally tempt a default export. If the rules are loaded, it uses a named export without being told.

Cursor - rules in effect
Explorer
conventions.mdc
parser.ts
parser.test.ts
src/parser.ts
1// asked: add a parse() helper
2export function parse(input: string) {
3 // named export, per project rules
4}
A new module follows the named-export rule on its own.
Commit the rules
Check the rules file into git so every teammate's Cursor follows the same conventions. Shared rules keep AI edits consistent across the whole team.

Result: Cursor applies your conventions to every edit automatically, so you stop re-explaining house style in each prompt.

Watch related tutorials

Free weekly email

New guides in your inbox

Fresh step-by-step how-to guides as we publish them. One email a week, no more.

Tags
#cursor#rules#conventions#editor#setup