← back to stream

Cursor rules

#tools#ai

Rules are markdown files that give the Cursor agent persistent context — effectively fragments of the system prompt scoped to a user, a project, or a file pattern. They live in .cursor/rules/*.mdc (workspace-level) or in Cursor's user settings (global). AGENTS.md at the repo root is the de-facto standard name the agent picks up automatically.

Each rule declares how it attaches:

  • Always applied — injected on every turn (use sparingly, costs context).
  • Agent-requestable — the agent reads them only when a short description matches the task.
  • Auto-attached — triggered by a glob (e.g. **/*.tsx for React-specific conventions).
  • Manual — explicitly referenced by the user.

Good rules encode conventions the agent can't infer from the codebase alone: stack choices, commit style, "don't add a DB", "use pnpm not npm". Bad rules restate what a good README already says. The rule of thumb: if you'd hire a new engineer and hand them a one-pager on day one, that's a rule.