Skip to content
ML2
Vibe-Coding & Prompt-to-AppSetupCursorrulescontext

Cursor Rules and AGENTS.md

Added Updated Copyable prompt below

Published Last verified

Our verdict

If you build in Cursor, rules are how you stop re-explaining your stack. Start with one short project rule, or a plain AGENTS.md if you also use other agents, and add a rule only when the agent repeats a mistake. Rules are guidance, not enforcement, so keep a linter and tests for anything that must never break.

Who it's for
Cursor users on any project that lasts more than a day
Leverage
Consistent A.I. output across sessions
Effort
Low
Date added

What Cursor rules do

Cursor adds rule contents to the start of the model's context so the agent follows your conventions every session. There are four kinds: project rules (.mdc files in .cursor/rules, committed to git), user rules (global preferences in Cursor's settings), team rules (set by admins in the dashboard on Team and Enterprise plans) and AGENTS.md, a plain Markdown file in the project root or any subfolder. Project rules can apply always, when the agent judges them relevant, when matching files are in context, or only when you @-mention them.

How builders use Cursor rules

  • Type /create-rule in Agent and describe the rule; Cursor writes the .mdc file with the right frontmatter into .cursor/rules.
  • Keep one alwaysApply rule for stack and do/don'ts, and scope the rest with globs such as src/components/**/*.tsx.
  • Point to example files with @ instead of pasting code, so rules stay short and don't go stale.
  • Put an AGENTS.md in frontend/ and backend/ for folder-specific instructions; Cursor combines them with the root file.
  • Commit .cursor/rules to git so every collaborator gets the same rules.

How a project rule gets applied

From Cursor's rules docs, checked 17 Nov 2026. The frontmatter fields decide when a rule loads.

TypeFrontmatterLoads when
Always ApplyalwaysApply: trueEvery chat session
Apply to Specific FilesalwaysApply: false + globsA matching file is in context
Apply IntelligentlyalwaysApply: false + descriptionThe agent judges it relevant from the description
Apply ManuallyalwaysApply: false, nothing elseYou @-mention it, for example @my-rule

Details that trip people up

  • Project rules must use the .mdc extension. A plain .md file in .cursor/rules is ignored; use AGENTS.md if you prefer plain Markdown.
  • An @file mention in a rule tells the agent where to look; the file isn't pasted into the prompt. Put anything that must always be in context in the rule body.
  • When rules conflict, team rules win over project rules, which win over user rules. All applicable rules are merged.
  • Nested AGENTS.md files combine with their parent folders, and the more specific one wins.
  • Rules don't affect Cursor Tab completions, only the agent and chat.

Cursor rules: limits and gotchas

  • Rules are prompt context, not enforcement. Cursor's own docs say A.I. guidance shouldn't be your only security control, so keep linters, tests and CI for hard rules.
  • Long rules cost context and get followed less. Cursor recommends keeping each rule under 500 lines and splitting large ones.
  • An Apply Intelligently rule without a description, or a glob that doesn't match, silently never loads; check the rule type when one is ignored.
  • Team rules need a Team or Enterprise plan.
  • .cursor/rules is Cursor-specific. Other agents won't read it, so keep shared conventions in AGENTS.md if your team mixes tools.

Cursor rules compared with other tools here

  • Write an AGENTS.md: one plain file that Cursor, Codex, Jules and other agents all read.
  • Aider conventions file: the same idea for Aider, loaded read-only with /read or the config file.
  • Cline: uses .clinerules and also detects .cursorrules and AGENTS.md, so one file can serve both.
  • Claude Code skills: packaged instructions and scripts that load on demand instead of on every request.
  • Write a spec before you vibe-code: rules hold standing conventions; a spec describes the one thing you're building now.

When to pick Cursor rules

  • Use project rules in .cursor/rules if your whole team works in Cursor and you want rules scoped to folders or file types.
  • Use AGENTS.md if you also use Codex, Jules, Claude Code or Cline and want a single file.
  • Use team rules if you're an admin who needs standards enforced across every repo.
  • Use user rules for personal preferences such as reply style that shouldn't live in the repo.

Copy this: Project rule starter (.cursor/rules/stack.mdc)

---
alwaysApply: true
---

Stack: Next.js App Router, TypeScript, Tailwind, Supabase.
- Server components by default; 'use client' only when needed.
- Data access only through lib/db/*.
- Validate all inputs with zod at API boundaries.
- Never commit secrets; read from process.env.
- After changes, run `npm run build` and fix errors.

Cursor rules questions

Why isn't my Cursor rule being applied?

Check the type: Apply Intelligently needs a description, Apply to Specific Files needs a glob that matches the files in context, and the file must end in .mdc.

Should I use .cursor/rules or AGENTS.md?

AGENTS.md for simple, plain-Markdown instructions that other agents can read too; .cursor/rules when you need glob scoping or rules that load only when relevant.

How long should a rule be?

Short. Cursor suggests under 500 lines, focused and actionable, with concrete examples or referenced files instead of copied style guides.

Can the agent write rules for me?

Yes. Use /create-rule in chat, or ask the agent to update a rule after it makes a mistake.

Related discoveries

See the newest picks →
  • ToolVibe-Coding & Prompt-to-App

    Context7: up-to-date docs for A.I. editors

    Feeds current, version-specific library docs into your coding assistant, through a CLI skill or an MCP server.

    Effort: LowPrompt#MCP#Open source

  • SetupVibe-Coding & Prompt-to-AppHot

    Write one AGENTS.md that every coding agent reads

    A short, hand-written instructions file that tells any coding agent how to build, test and work on your project.

    NewEffort: LowPrompt

Get the best new A.I. picks in your inbox

The best new agent workflows and tools we’ve vetted, with a clear verdict on each. Short, occasional, useful.

More in Vibe-Coding & Prompt-to-App →

Free. No spam. Unsubscribe anytime.