# Cursor rules: how to write them, with an example

Ahmet Karaca · 12 October 2026 · Updated 30 October 2026 · https://coredence.com/guides/cursor-rules

Cursor reads instructions from `.mdc` files in `.cursor/rules`, your user rules, team rules and `AGENTS.md`. The useful ones are short, specific, and come from the times it got you wrong.

## Where does Cursor read its rules from?

- Project rules: `.mdc` files in the project's `.cursor/rules` folder, committed with the code. A plain `.md` file there is ignored. `/create-rule` in chat writes one for you.
- User rules: your own instructions under Customize › Rules, applied in every project and used by Agent (Chat).
- Team rules: set from the dashboard on Team and Enterprise plans. When rules conflict, the order is team, project, user.
- `AGENTS.md`: a plain Markdown file in the project root or any subfolder, the simple alternative to `.cursor/rules` and the file other agents read too.
- MCP servers: tools Cursor can call during a task, configured in `~/.cursor/mcp.json` in your home folder or in `.cursor/mcp.json` in a project.

Everything in an always-on rule is read on every request, so a rule should be scoped to the files it is about whenever that is possible.

## How does a Cursor rule activate?

| Type | When it applies |
| --- | --- |
| Always Apply | In every chat session |
| Apply Intelligently | When the agent judges the description relevant |
| Apply to Specific Files | When a file matches the rule's pattern |
| Apply Manually | When you @-mention the rule |

## What makes a rule worth keeping?

A rule earns its place when it changes what Cursor does. "Write clean code" changes nothing; "read the existing file before proposing a new one" does. Recent chats are a good place to look: what you had to ask for twice is likely to be a rule.

Write the reason with the rule when it is not obvious. A model that knows why you avoid hard-coded numbers will apply it to a case you never mentioned.

Save this as `.cursor/rules/how-i-work.mdc`:

```
---
description: How I want changes to be made
alwaysApply: true
---

- Read the existing file before proposing a new one.
- Ask before deleting files or running destructive commands.
- Plan in a few lines before touching more than three files.
- Formulas over hard-coded numbers.
```

Cursor suggests keeping a rule under 500 lines and splitting larger ones. If a rule does not apply, its type is the first thing to check: an Apply Intelligently rule needs a description, and a file rule needs a pattern that matches.

## How do you keep rules the same across tools?

If you use more than one assistant, each keeps its own copy of your preferences: a Cursor rule here, a `CLAUDE.md` there, a custom instruction somewhere else. The copies drift apart, and only the one you edited last is current.

For a project, a shared [`AGENTS.md`](https://coredence.com/guides/agents-md) already solves most of this: Cursor, Codex and Copilot read it, and Claude Code can. Your personal preferences are harder, because each tool keeps them in its own place. One option is a [local MCP server](https://coredence.com/guides/mcp-personal-context) that Cursor, Claude, Claude Code and Codex can all call, so that what is added once can be read everywhere.

## Where Coredence fits

If you would rather not write these rules by hand, Coredence reads your own sessions and commits and turns your corrections into memories about how you work, each linked to the traces it grew from. Cursor reaches it through a read-only MCP server, which Coredence can connect for you during setup. MCP means the agent has to choose to call it, so the app counts actual reads, and Settings › Assistants shows what to tell an assistant that has never read it. Claude Code gets the same mind as a skill.

Coredence runs on macOS 14 or later (Apple silicon) and Windows 10 or later, with no Coredence account. Consolidation needs a model, and you choose it: your Claude Code subscription, your own API key, or a local model through Ollama. On those paths Coredence itself is free to use. It is not open source. If you would rather not bring a key, its own [paid plans](https://coredence.com/pricing) include the model.

## Sources, checked on 30 October 2026

- [Cursor docs: Rules](https://cursor.com/docs/rules)
- [Cursor docs: MCP](https://cursor.com/docs/mcp)
