[{"data":1,"prerenderedAt":28},["ShallowReactive",2],{"$fFchLzVUoCiwXMeR-YwnmY3fIB--GzqMe28u0Je8me_M":3},{"slug":4,"title":5,"description":6,"date":7,"tags":8,"draft":12,"readingMinutes":13,"html":14,"related":15},"cursor-rules","Cursor Rules: How I'd Set Up .cursor/rules for a Real Repo","Cursor rules in practice: .mdc files, the four ways a rule gets applied, globs that actually match, AGENTS.md, and what not to put in a rule. Checked November 2026.","2026-11-19",[9,10,11],"cursor","ai coding","developer tools",false,4,"\u003Cp>Cursor rules are plain text instructions the Cursor agent reads before it writes code in your project. Project rules live in \u003Ccode>.cursor/rules/\u003C/code> as \u003Ccode>.mdc\u003C/code> files and get committed with the code. That extension matters more than anything else in this post: Cursor&#39;s \u003Ca href=\"https://cursor.com/docs/context/rules\">rules documentation\u003C/a> says it outright, &quot;A plain \u003Ccode>.md\u003C/code> file in \u003Ccode>.cursor/rules\u003C/code> is ignored by the rules system.&quot; People write a lovely \u003Ccode>conventions.md\u003C/code>, drop it in the folder, and the agent never sees a word of it.\u003C/p>\n\u003Cp>Everything below is from those docs as they read on November 19, 2026. The opinions about what to write in them are mine.\u003C/p>\n\u003Ch2>The four ways a rule gets used\u003C/h2>\n\u003Cp>Each \u003Ccode>.mdc\u003C/code> file starts with a small frontmatter block with three fields: \u003Ccode>description\u003C/code>, \u003Ccode>globs\u003C/code> and \u003Ccode>alwaysApply\u003C/code>. Which ones you fill in decides when the rule reaches the agent:\u003C/p>\n\u003Cul>\n\u003Cli>\u003Ccode>alwaysApply: true\u003C/code> puts it in every chat. The other two fields are ignored.\u003C/li>\n\u003Cli>A \u003Ccode>description\u003C/code> with no \u003Ccode>globs\u003C/code> and \u003Ccode>alwaysApply: false\u003C/code> lets the agent decide if it&#39;s relevant, based on that description.\u003C/li>\n\u003Cli>\u003Ccode>globs\u003C/code> with \u003Ccode>alwaysApply: false\u003C/code> attaches the rule when a matching file is in the context.\u003C/li>\n\u003Cli>Nothing set at all means it only applies when you @-mention it, like \u003Ccode>@migrations\u003C/code>.\u003C/li>\n\u003C/ul>\n\u003Cimg src=\"/blog/cursor-rules/cursor-rule-modes.webp\" alt=\"Four .cursor/rules files with different frontmatter: always applied, agent decides, matching files, and only when @-mentioned\" width=\"1600\" height=\"720\" loading=\"lazy\">\u003Cp>The &quot;apply intelligently&quot; mode sounds clever and is the one I trust least. The agent reads a one-line description and guesses. If the description is vague (&quot;backend stuff&quot;), the guess is a coin flip. I&#39;d rather use globs for anything tied to files and keep the always-on set tiny.\u003C/p>\n\u003Ch2>Globs are where it quietly breaks\u003C/h2>\n\u003Cp>Glob patterns are comma separated, and they don&#39;t behave the way people assume. \u003Ccode>*.ts\u003C/code> only matches TypeScript files in the root of the repo. You almost always want \u003Ccode>**/*.ts\u003C/code>. In a Laravel app with a Vue frontend, a rule for components needs \u003Ccode>resources/js/**/*.vue\u003C/code>, and a rule for migrations needs \u003Ccode>database/migrations/**/*.php\u003C/code>. Write \u003Ccode>*.vue\u003C/code> and the rule sits there doing nothing, and you&#39;ll never get an error telling you so.\u003C/p>\n\u003Cp>A quick test I&#39;d do after adding any glob rule: open a file the pattern should match, start a new chat, and ask the agent which rules it has loaded. If yours isn&#39;t in the answer, the glob is wrong.\u003C/p>\n\u003Ch2>What I&#39;d actually put in a repo\u003C/h2>\n\u003Cp>For a typical client codebase (Laravel or Node API, Vue or React frontend, Postgres, maybe Supabase), I&#39;d start with four files and nothing else:\u003C/p>\n\u003Cpre>\u003Ccode>.cursor/rules/\n  core.mdc          alwaysApply: true   (stack, how to run tests, never-do list)\n  migrations.mdc    globs: database/migrations/**/*.php\n  frontend.mdc      globs: resources/js/**/*.vue\n  security.mdc      alwaysApply: true   (secrets, auth checks, RLS)\n\u003C/code>\u003C/pre>\n\u003Cp>The never-do list is the useful part. Never edit a migration that has already run, write a new one. Never put a secret in anything the browser gets (\u003Ccode>VITE_\u003C/code> and \u003Ccode>NUXT_PUBLIC_\u003C/code> variables are public). Every new Postgres table on Supabase gets row level security in the same migration. Run the tests before saying it&#39;s done. Those are mistakes an agent will make on day one, and a rule is cheap insurance against them.\u003C/p>\n\u003Cp>What I&#39;d keep out: the whole style guide (that&#39;s what ESLint, Prettier and Pint are for), commands the agent already knows, and long pasted schemas. The docs suggest keeping rules under 500 lines and referencing files rather than copying them in. I&#39;d go further and keep \u003Ccode>core.mdc\u003C/code> under a screen. One thing to know about references, though: a file you point to with \u003Ccode>@service-template.ts\u003C/code> is read when needed, not inlined, so anything that must always be in front of the agent goes in the rule body itself.\u003C/p>\n\u003Ch2>Where AGENTS.md fits\u003C/h2>\n\u003Cp>Cursor also reads \u003Ccode>AGENTS.md\u003C/code>, a plain Markdown file with no frontmatter, in the project root or in subfolders. A nested one applies when the agent works in that folder, combined with the parent ones, and the more specific file wins. Other coding agents read \u003Ccode>AGENTS.md\u003C/code> too, so if your team uses more than one tool, put the shared never-do list there and keep the Cursor-only glob rules in \u003Ccode>.cursor/rules/\u003C/code>.\u003C/p>\n\u003Cp>Precedence when they disagree: Team rules (on Team and Enterprise plans), then project rules, then your personal user rules. Earlier wins.\u003C/p>\n\u003Ch2>The rule that matters most isn&#39;t in the file\u003C/h2>\n\u003Cp>The docs have one warning I&#39;d underline twice: &quot;AI guidance should not be your only security control.&quot; A rule saying &quot;check auth on every endpoint&quot; is a suggestion. A test that fails when an endpoint has no auth check is a control. Add rules when the agent keeps making the same mistake, and add a test or a lint rule when the mistake is expensive.\u003C/p>\n\u003Cp>If you&#39;ve got a repo that an AI tool built quickly and you want someone to set up the rules, the tests and the CI around it properly, that&#39;s work I do. \u003Ca href=\"https://calendly.com/director-norsky/meeting\">Book a call\u003C/a>; the first conversation is free.\u003C/p>\n",[16,20,24],{"slug":17,"title":18,"description":19},"windsurf-vs-cursor","Windsurf vs Cursor in Late 2026: Windsurf Is Devin Desktop Now","Windsurf vs Cursor, checked November 28, 2026: Windsurf became Devin Desktop in June, Cursor's plans now start with Grok-only Plus. What each costs and which I'd pick.",{"slug":21,"title":22,"description":23},"vibe-coding-tools","Vibe Coding Tools: Sort Them by Who Can Read the Code","Vibe coding tools in November 2026, sorted the way a developer sees them: app builders vs coding agents, what each costs, and where the code ends up.",{"slug":25,"title":26,"description":27},"lovable-vs-cursor","Lovable vs Cursor After Cursor's October 2026 Price Change","Lovable vs Cursor in October 2026: Cursor's new $8 to $200 plans, Lovable's $25 credits, who each one is for, and where each one stops.",1795910047578]