<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>IDE Configuration on RockB</title><link>https://baeseokjae.github.io/tags/ide-configuration/</link><description>Recent content in IDE Configuration on RockB</description><image><title>RockB</title><url>https://baeseokjae.github.io/images/og-default.png</url><link>https://baeseokjae.github.io/images/og-default.png</link></image><generator>Hugo</generator><language>en-us</language><lastBuildDate>Sat, 18 Apr 2026 15:29:10 +0000</lastBuildDate><atom:link href="https://baeseokjae.github.io/tags/ide-configuration/index.xml" rel="self" type="application/rss+xml"/><item><title>Cursor Rules Guide 2026: How to Write .cursorrules and .mdc Files for Your Project</title><link>https://baeseokjae.github.io/posts/cursor-rules-guide-2026/</link><pubDate>Sat, 18 Apr 2026 15:29:10 +0000</pubDate><guid>https://baeseokjae.github.io/posts/cursor-rules-guide-2026/</guid><description>Complete guide to writing Cursor rules in 2026: .cursorrules vs .mdc format, four activation modes, ready-to-use templates, and token budget tips.</description><content:encoded><![CDATA[<p>Cursor rules are project-level instructions that persist across every AI conversation in your editor — write them once and every Cursor session, every team member, and every new chat starts with your coding standards already loaded. Without rules, you repeat yourself every session; with them, the AI learns your stack once.</p>
<h2 id="what-are-cursor-rules-and-why-do-they-matter-in-2026">What Are Cursor Rules and Why Do They Matter in 2026?</h2>
<p>Cursor rules are configuration files that instruct the Cursor AI coding assistant how to behave within a specific project — defining your tech stack, coding style, naming conventions, and architectural preferences so you never have to re-explain them in each chat session. Cursor surpassed 1 million total users by late 2025, with 360,000+ paying subscribers and a $29.3 billion valuation after a $2.3B Series D round. At that scale, the context persistence problem became critical: teams found that without shared rules, every developer was training the AI differently, producing inconsistent output. Rules solve this by encoding your standards into the project repository itself. According to the 2025 Stack Overflow Developer Survey, 84% of developers now use or plan to use AI coding tools — up from 76% the year before — and Cursor is used by tens of thousands of teams at Nvidia, Adobe, Uber, Shopify, Stripe, and OpenAI. The takeaway: rules aren&rsquo;t optional polish; they are the mechanism that makes AI coding consistent and collaborative at team scale.</p>
<h3 id="why-the-old-cursorrules-file-is-no-longer-enough">Why the Old .cursorrules File Is No Longer Enough</h3>
<p>The original <code>.cursorrules</code> single-file format loaded everything, every time — there was no scoping, no conditional activation, and no way to apply different instructions to frontend versus backend code. Teams ended up with one giant file that wasted tokens on irrelevant instructions. The modern <code>.cursor/rules/</code> directory with <code>.mdc</code> files solves this by letting you scope each rule to specific file patterns, activation conditions, or manual triggers.</p>
<h2 id="understanding-the-two-formats-cursorrules-vs-cursorrulesmdc">Understanding the Two Formats: .cursorrules vs .cursor/rules/*.mdc</h2>
<p>The Cursor ecosystem currently supports two configuration formats: the legacy <code>.cursorrules</code> single file and the recommended <code>.cursor/rules/</code> directory containing <code>.mdc</code> files. The legacy format is a plain text or markdown file placed at the project root — simple to write, but it loads unconditionally in every request, burning tokens regardless of context. The modern <code>.mdc</code> format is a markdown file with YAML frontmatter that controls when and how the rule activates. Each <code>.mdc</code> file handles one concern: a separate file for React components, another for API routes, another for testing conventions. This modularity means a backend-only change doesn&rsquo;t load your frontend styling rules, saving hundreds of tokens per request. The <code>.cursor/rules/</code> directory was introduced as the recommended format to give teams the scope control that the original single-file approach couldn&rsquo;t provide. If you&rsquo;re starting a new project in 2026, go straight to <code>.mdc</code> files. If you have an existing <code>.cursorrules</code> file, migrate it by splitting it into topic-based <code>.mdc</code> files with appropriate glob patterns — the migration is mechanical and pays off immediately in token efficiency.</p>
<h3 id="quick-migration-checklist">Quick Migration Checklist</h3>
<ul>
<li>Create <code>.cursor/rules/</code> directory at project root</li>
<li>Split your <code>.cursorrules</code> into themed files (e.g., <code>react-components.mdc</code>, <code>api-routes.mdc</code>, <code>testing.mdc</code>)</li>
<li>Add YAML frontmatter to each file with <code>alwaysApply: false</code> and appropriate <code>globs</code></li>
<li>Delete the old <code>.cursorrules</code> file</li>
<li>Commit <code>.cursor/rules/</code> to version control so the whole team shares the same configuration</li>
</ul>
<h2 id="the-anatomy-of-an-mdc-rule-file">The Anatomy of an .mdc Rule File</h2>
<p>An <code>.mdc</code> rule file consists of two parts: a YAML frontmatter block that controls activation, and a markdown body that contains the actual instructions. The frontmatter has three key fields: <code>description</code> (a one-sentence summary the AI uses when deciding whether to apply agent-requested rules), <code>globs</code> (file patterns that trigger Auto/Glob activation), and <code>alwaysApply</code> (a boolean that forces the rule into every request when set to <code>true</code>). The markdown body is free-form — use headings, bullet lists, code blocks, and examples. Write instructions in the imperative voice: &ldquo;Use TypeScript strict mode,&rdquo; not &ldquo;TypeScript strict mode is preferred.&rdquo; Here is a minimal example for a React project rule file named <code>.cursor/rules/react-components.mdc</code>:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-yaml" data-lang="yaml"><span style="display:flex;"><span>---
</span></span><span style="display:flex;"><span><span style="color:#f92672">description</span>: <span style="color:#ae81ff">React component conventions for this project</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">globs</span>: [<span style="color:#e6db74">&#34;src/components/**/*.tsx&#34;</span>, <span style="color:#e6db74">&#34;src/pages/**/*.tsx&#34;</span>]
</span></span><span style="display:flex;"><span><span style="color:#f92672">alwaysApply</span>: <span style="color:#66d9ef">false</span>
</span></span><span style="display:flex;"><span>---
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e">## React Component Rules</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>- <span style="color:#ae81ff">Use functional components with hooks only. NEVER use class components.</span>
</span></span><span style="display:flex;"><span>- <span style="color:#ae81ff">Export components as named exports, not default exports.</span>
</span></span><span style="display:flex;"><span>- <span style="color:#f92672">Props interface name must match component name</span>: <span style="color:#ae81ff">`ButtonProps` for `Button`.</span>
</span></span><span style="display:flex;"><span>- <span style="color:#ae81ff">Use Tailwind CSS utility classes. Do NOT write inline styles.</span>
</span></span><span style="display:flex;"><span>- <span style="color:#ae81ff">Co-locate component tests in the same directory as the component file.</span>
</span></span><span style="display:flex;"><span>- <span style="color:#f92672">Import order</span>: <span style="color:#ae81ff">React → third-party libraries → internal modules → styles.</span>
</span></span></code></pre></div><p>The rule activates automatically when the user opens or edits any file matching <code>src/components/**/*.tsx</code> or <code>src/pages/**/*.tsx</code> — and stays dormant (saving tokens) for all other file types.</p>
<h2 id="four-rule-activation-modes-explained">Four Rule Activation Modes Explained</h2>
<p>Cursor supports four distinct activation modes, each suited to a different type of coding standard. Understanding which mode to use is the single biggest factor in building an efficient, non-bloated rule configuration. The four modes are: <strong>Always Apply</strong>, <strong>Auto Attached (Glob)</strong>, <strong>Agent Requested</strong>, and <strong>Manual</strong>. Always Apply rules load in every single AI request — use this mode only for the most universal constraints like &ldquo;write all code in TypeScript&rdquo; or &ldquo;never commit secrets to source files.&rdquo; Keep Always Apply rules under 200 words; every token they contain is charged against your context window on every request, which practitioners call the &ldquo;token tax.&rdquo; Auto Attached rules trigger based on file patterns (globs) — they activate when the AI is working on a file that matches the pattern, making them ideal for framework-specific conventions like React component rules or database query patterns. Agent Requested rules include a <code>description</code> field that the AI reads to decide whether the rule is relevant to the current task — useful for specialized rules like security review checklists or performance optimization patterns. Manual rules are never applied automatically; they must be explicitly referenced with an <code>@rule-name</code> mention in the chat — ideal for infrequently used templates like a PR description format or a release checklist.</p>
<h3 id="choosing-the-right-mode">Choosing the Right Mode</h3>
<table>
  <thead>
      <tr>
          <th>Mode</th>
          <th>When It Applies</th>
          <th>Best For</th>
          <th>Token Cost</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>Always Apply</td>
          <td>Every request</td>
          <td>Universal constraints (language, secrets policy)</td>
          <td>High — minimize</td>
      </tr>
      <tr>
          <td>Auto Attached</td>
          <td>File pattern match</td>
          <td>Framework conventions, file-type rules</td>
          <td>Medium</td>
      </tr>
      <tr>
          <td>Agent Requested</td>
          <td>AI decides</td>
          <td>Optional patterns, specialized checklists</td>
          <td>Low</td>
      </tr>
      <tr>
          <td>Manual</td>
          <td>Explicit @mention</td>
          <td>Templates, one-off procedures</td>
          <td>Zero unless referenced</td>
      </tr>
  </tbody>
</table>
<h2 id="writing-your-first-cursor-rules-a-step-by-step-walkthrough">Writing Your First Cursor Rules: A Step-by-Step Walkthrough</h2>
<p>Writing effective Cursor rules follows a clear sequence: identify recurring friction, encode the fix precisely, and verify the AI applies it correctly. Start by observing where the AI makes the same mistake twice — that repetition is your signal that a rule is needed. Day one developers often write 20 rules before they&rsquo;ve used the tool; experienced teams add rules incrementally as actual problems emerge. Here is a concrete walkthrough for a Next.js project. First, create the rules directory: <code>mkdir -p .cursor/rules</code>. Second, create your always-on global rule in <code>.cursor/rules/global.mdc</code> with <code>alwaysApply: true</code> — limit this to two or three universal constraints. Third, create a framework-specific rule in <code>.cursor/rules/nextjs.mdc</code> with a glob pattern targeting <code>src/**/*.tsx</code> and <code>src/**/*.ts</code>. Fourth, test by opening a component file and asking Cursor to generate a new component — verify it follows your conventions without prompting. Fifth, commit the <code>.cursor/rules/</code> directory to git so teammates inherit the same behavior immediately.</p>
<h3 id="practical-example-catching-the-same-mistake">Practical Example: Catching the Same Mistake</h3>
<p>If Cursor keeps generating <code>console.log</code> statements in production code, add this to your global rule:</p>



<div class="goat svg-container ">
  
    <svg
      xmlns="http://www.w3.org/2000/svg"
      font-family="Menlo,Lucida Console,monospace"
      
        viewBox="0 0 728 57"
      >
      <g transform='translate(8,16)'>
<text text-anchor='middle' x='0' y='4' fill='currentColor' style='font-size:1em'>N</text>
<text text-anchor='middle' x='0' y='20' fill='currentColor' style='font-size:1em'>U</text>
<text text-anchor='middle' x='0' y='36' fill='currentColor' style='font-size:1em'>R</text>
<text text-anchor='middle' x='8' y='4' fill='currentColor' style='font-size:1em'>E</text>
<text text-anchor='middle' x='8' y='20' fill='currentColor' style='font-size:1em'>s</text>
<text text-anchor='middle' x='8' y='36' fill='currentColor' style='font-size:1em'>e</text>
<text text-anchor='middle' x='16' y='4' fill='currentColor' style='font-size:1em'>V</text>
<text text-anchor='middle' x='16' y='20' fill='currentColor' style='font-size:1em'>e</text>
<text text-anchor='middle' x='16' y='36' fill='currentColor' style='font-size:1em'>f</text>
<text text-anchor='middle' x='24' y='4' fill='currentColor' style='font-size:1em'>E</text>
<text text-anchor='middle' x='24' y='36' fill='currentColor' style='font-size:1em'>e</text>
<text text-anchor='middle' x='32' y='4' fill='currentColor' style='font-size:1em'>R</text>
<text text-anchor='middle' x='32' y='20' fill='currentColor' style='font-size:1em'>t</text>
<text text-anchor='middle' x='32' y='36' fill='currentColor' style='font-size:1em'>r</text>
<text text-anchor='middle' x='40' y='20' fill='currentColor' style='font-size:1em'>h</text>
<text text-anchor='middle' x='40' y='36' fill='currentColor' style='font-size:1em'>e</text>
<text text-anchor='middle' x='48' y='4' fill='currentColor' style='font-size:1em'>u</text>
<text text-anchor='middle' x='48' y='20' fill='currentColor' style='font-size:1em'>e</text>
<text text-anchor='middle' x='48' y='36' fill='currentColor' style='font-size:1em'>n</text>
<text text-anchor='middle' x='56' y='4' fill='currentColor' style='font-size:1em'>s</text>
<text text-anchor='middle' x='56' y='36' fill='currentColor' style='font-size:1em'>c</text>
<text text-anchor='middle' x='64' y='4' fill='currentColor' style='font-size:1em'>e</text>
<text text-anchor='middle' x='64' y='20' fill='currentColor' style='font-size:1em'>p</text>
<text text-anchor='middle' x='64' y='36' fill='currentColor' style='font-size:1em'>e</text>
<text text-anchor='middle' x='72' y='20' fill='currentColor' style='font-size:1em'>r</text>
<text text-anchor='middle' x='80' y='4' fill='currentColor' style='font-size:1em'>c</text>
<text text-anchor='middle' x='80' y='20' fill='currentColor' style='font-size:1em'>o</text>
<text text-anchor='middle' x='80' y='36' fill='currentColor' style='font-size:1em'>t</text>
<text text-anchor='middle' x='88' y='4' fill='currentColor' style='font-size:1em'>o</text>
<text text-anchor='middle' x='88' y='20' fill='currentColor' style='font-size:1em'>j</text>
<text text-anchor='middle' x='88' y='36' fill='currentColor' style='font-size:1em'>h</text>
<text text-anchor='middle' x='96' y='4' fill='currentColor' style='font-size:1em'>n</text>
<text text-anchor='middle' x='96' y='20' fill='currentColor' style='font-size:1em'>e</text>
<text text-anchor='middle' x='96' y='36' fill='currentColor' style='font-size:1em'>e</text>
<text text-anchor='middle' x='104' y='4' fill='currentColor' style='font-size:1em'>s</text>
<text text-anchor='middle' x='104' y='20' fill='currentColor' style='font-size:1em'>c</text>
<text text-anchor='middle' x='112' y='4' fill='currentColor' style='font-size:1em'>o</text>
<text text-anchor='middle' x='112' y='20' fill='currentColor' style='font-size:1em'>t</text>
<text text-anchor='middle' x='112' y='36' fill='currentColor' style='font-size:1em'>`</text>
<text text-anchor='middle' x='120' y='4' fill='currentColor' style='font-size:1em'>l</text>
<text text-anchor='middle' x='120' y='36' fill='currentColor' style='font-size:1em'>l</text>
<text text-anchor='middle' x='128' y='4' fill='currentColor' style='font-size:1em'>e</text>
<text text-anchor='middle' x='128' y='20' fill='currentColor' style='font-size:1em'>l</text>
<text text-anchor='middle' x='128' y='36' fill='currentColor' style='font-size:1em'>o</text>
<text text-anchor='middle' x='136' y='4' fill='currentColor' style='font-size:1em'>.</text>
<text text-anchor='middle' x='136' y='20' fill='currentColor' style='font-size:1em'>o</text>
<text text-anchor='middle' x='136' y='36' fill='currentColor' style='font-size:1em'>g</text>
<text text-anchor='middle' x='144' y='4' fill='currentColor' style='font-size:1em'>l</text>
<text text-anchor='middle' x='144' y='20' fill='currentColor' style='font-size:1em'>g</text>
<text text-anchor='middle' x='144' y='36' fill='currentColor' style='font-size:1em'>E</text>
<text text-anchor='middle' x='152' y='4' fill='currentColor' style='font-size:1em'>o</text>
<text text-anchor='middle' x='152' y='20' fill='currentColor' style='font-size:1em'>g</text>
<text text-anchor='middle' x='152' y='36' fill='currentColor' style='font-size:1em'>r</text>
<text text-anchor='middle' x='160' y='4' fill='currentColor' style='font-size:1em'>g</text>
<text text-anchor='middle' x='160' y='20' fill='currentColor' style='font-size:1em'>e</text>
<text text-anchor='middle' x='160' y='36' fill='currentColor' style='font-size:1em'>r</text>
<text text-anchor='middle' x='168' y='4' fill='currentColor' style='font-size:1em'>,</text>
<text text-anchor='middle' x='168' y='20' fill='currentColor' style='font-size:1em'>r</text>
<text text-anchor='middle' x='168' y='36' fill='currentColor' style='font-size:1em'>o</text>
<text text-anchor='middle' x='176' y='36' fill='currentColor' style='font-size:1em'>r</text>
<text text-anchor='middle' x='184' y='4' fill='currentColor' style='font-size:1em'>c</text>
<text text-anchor='middle' x='184' y='20' fill='currentColor' style='font-size:1em'>a</text>
<text text-anchor='middle' x='184' y='36' fill='currentColor' style='font-size:1em'>`</text>
<text text-anchor='middle' x='192' y='4' fill='currentColor' style='font-size:1em'>o</text>
<text text-anchor='middle' x='192' y='20' fill='currentColor' style='font-size:1em'>t</text>
<text text-anchor='middle' x='200' y='4' fill='currentColor' style='font-size:1em'>n</text>
<text text-anchor='middle' x='200' y='36' fill='currentColor' style='font-size:1em'>a</text>
<text text-anchor='middle' x='208' y='4' fill='currentColor' style='font-size:1em'>s</text>
<text text-anchor='middle' x='208' y='20' fill='currentColor' style='font-size:1em'>`</text>
<text text-anchor='middle' x='208' y='36' fill='currentColor' style='font-size:1em'>n</text>
<text text-anchor='middle' x='216' y='4' fill='currentColor' style='font-size:1em'>o</text>
<text text-anchor='middle' x='216' y='20' fill='currentColor' style='font-size:1em'>s</text>
<text text-anchor='middle' x='216' y='36' fill='currentColor' style='font-size:1em'>d</text>
<text text-anchor='middle' x='224' y='4' fill='currentColor' style='font-size:1em'>l</text>
<text text-anchor='middle' x='224' y='20' fill='currentColor' style='font-size:1em'>r</text>
<text text-anchor='middle' x='232' y='4' fill='currentColor' style='font-size:1em'>e</text>
<text text-anchor='middle' x='232' y='20' fill='currentColor' style='font-size:1em'>c</text>
<text text-anchor='middle' x='232' y='36' fill='currentColor' style='font-size:1em'>`</text>
<text text-anchor='middle' x='240' y='4' fill='currentColor' style='font-size:1em'>.</text>
<text text-anchor='middle' x='240' y='20' fill='currentColor' style='font-size:1em'>/</text>
<text text-anchor='middle' x='240' y='36' fill='currentColor' style='font-size:1em'>l</text>
<text text-anchor='middle' x='248' y='4' fill='currentColor' style='font-size:1em'>w</text>
<text text-anchor='middle' x='248' y='20' fill='currentColor' style='font-size:1em'>l</text>
<text text-anchor='middle' x='248' y='36' fill='currentColor' style='font-size:1em'>o</text>
<text text-anchor='middle' x='256' y='4' fill='currentColor' style='font-size:1em'>a</text>
<text text-anchor='middle' x='256' y='20' fill='currentColor' style='font-size:1em'>i</text>
<text text-anchor='middle' x='256' y='36' fill='currentColor' style='font-size:1em'>g</text>
<text text-anchor='middle' x='264' y='4' fill='currentColor' style='font-size:1em'>r</text>
<text text-anchor='middle' x='264' y='20' fill='currentColor' style='font-size:1em'>b</text>
<text text-anchor='middle' x='264' y='36' fill='currentColor' style='font-size:1em'>I</text>
<text text-anchor='middle' x='272' y='4' fill='currentColor' style='font-size:1em'>n</text>
<text text-anchor='middle' x='272' y='20' fill='currentColor' style='font-size:1em'>/</text>
<text text-anchor='middle' x='272' y='36' fill='currentColor' style='font-size:1em'>n</text>
<text text-anchor='middle' x='280' y='4' fill='currentColor' style='font-size:1em'>,</text>
<text text-anchor='middle' x='280' y='20' fill='currentColor' style='font-size:1em'>l</text>
<text text-anchor='middle' x='280' y='36' fill='currentColor' style='font-size:1em'>f</text>
<text text-anchor='middle' x='288' y='20' fill='currentColor' style='font-size:1em'>o</text>
<text text-anchor='middle' x='288' y='36' fill='currentColor' style='font-size:1em'>o</text>
<text text-anchor='middle' x='296' y='4' fill='currentColor' style='font-size:1em'>o</text>
<text text-anchor='middle' x='296' y='20' fill='currentColor' style='font-size:1em'>g</text>
<text text-anchor='middle' x='296' y='36' fill='currentColor' style='font-size:1em'>`</text>
<text text-anchor='middle' x='304' y='4' fill='currentColor' style='font-size:1em'>r</text>
<text text-anchor='middle' x='304' y='20' fill='currentColor' style='font-size:1em'>g</text>
<text text-anchor='middle' x='312' y='20' fill='currentColor' style='font-size:1em'>e</text>
<text text-anchor='middle' x='312' y='36' fill='currentColor' style='font-size:1em'>f</text>
<text text-anchor='middle' x='320' y='4' fill='currentColor' style='font-size:1em'>c</text>
<text text-anchor='middle' x='320' y='20' fill='currentColor' style='font-size:1em'>r</text>
<text text-anchor='middle' x='320' y='36' fill='currentColor' style='font-size:1em'>u</text>
<text text-anchor='middle' x='328' y='4' fill='currentColor' style='font-size:1em'>o</text>
<text text-anchor='middle' x='328' y='20' fill='currentColor' style='font-size:1em'>.</text>
<text text-anchor='middle' x='328' y='36' fill='currentColor' style='font-size:1em'>n</text>
<text text-anchor='middle' x='336' y='4' fill='currentColor' style='font-size:1em'>n</text>
<text text-anchor='middle' x='336' y='20' fill='currentColor' style='font-size:1em'>t</text>
<text text-anchor='middle' x='336' y='36' fill='currentColor' style='font-size:1em'>c</text>
<text text-anchor='middle' x='344' y='4' fill='currentColor' style='font-size:1em'>s</text>
<text text-anchor='middle' x='344' y='20' fill='currentColor' style='font-size:1em'>s</text>
<text text-anchor='middle' x='344' y='36' fill='currentColor' style='font-size:1em'>t</text>
<text text-anchor='middle' x='352' y='4' fill='currentColor' style='font-size:1em'>o</text>
<text text-anchor='middle' x='352' y='20' fill='currentColor' style='font-size:1em'>`</text>
<text text-anchor='middle' x='352' y='36' fill='currentColor' style='font-size:1em'>i</text>
<text text-anchor='middle' x='360' y='4' fill='currentColor' style='font-size:1em'>l</text>
<text text-anchor='middle' x='360' y='36' fill='currentColor' style='font-size:1em'>o</text>
<text text-anchor='middle' x='368' y='4' fill='currentColor' style='font-size:1em'>e</text>
<text text-anchor='middle' x='368' y='20' fill='currentColor' style='font-size:1em'>f</text>
<text text-anchor='middle' x='368' y='36' fill='currentColor' style='font-size:1em'>n</text>
<text text-anchor='middle' x='376' y='4' fill='currentColor' style='font-size:1em'>.</text>
<text text-anchor='middle' x='376' y='20' fill='currentColor' style='font-size:1em'>o</text>
<text text-anchor='middle' x='376' y='36' fill='currentColor' style='font-size:1em'>s</text>
<text text-anchor='middle' x='384' y='4' fill='currentColor' style='font-size:1em'>e</text>
<text text-anchor='middle' x='384' y='20' fill='currentColor' style='font-size:1em'>r</text>
<text text-anchor='middle' x='392' y='4' fill='currentColor' style='font-size:1em'>r</text>
<text text-anchor='middle' x='392' y='36' fill='currentColor' style='font-size:1em'>—</text>
<text text-anchor='middle' x='400' y='4' fill='currentColor' style='font-size:1em'>r</text>
<text text-anchor='middle' x='400' y='20' fill='currentColor' style='font-size:1em'>a</text>
<text text-anchor='middle' x='408' y='4' fill='currentColor' style='font-size:1em'>o</text>
<text text-anchor='middle' x='408' y='20' fill='currentColor' style='font-size:1em'>l</text>
<text text-anchor='middle' x='408' y='36' fill='currentColor' style='font-size:1em'>s</text>
<text text-anchor='middle' x='416' y='4' fill='currentColor' style='font-size:1em'>r</text>
<text text-anchor='middle' x='416' y='20' fill='currentColor' style='font-size:1em'>l</text>
<text text-anchor='middle' x='416' y='36' fill='currentColor' style='font-size:1em'>e</text>
<text text-anchor='middle' x='424' y='36' fill='currentColor' style='font-size:1em'>e</text>
<text text-anchor='middle' x='432' y='4' fill='currentColor' style='font-size:1em'>i</text>
<text text-anchor='middle' x='432' y='20' fill='currentColor' style='font-size:1em'>l</text>
<text text-anchor='middle' x='440' y='4' fill='currentColor' style='font-size:1em'>n</text>
<text text-anchor='middle' x='440' y='20' fill='currentColor' style='font-size:1em'>o</text>
<text text-anchor='middle' x='440' y='36' fill='currentColor' style='font-size:1em'>t</text>
<text text-anchor='middle' x='448' y='20' fill='currentColor' style='font-size:1em'>g</text>
<text text-anchor='middle' x='448' y='36' fill='currentColor' style='font-size:1em'>h</text>
<text text-anchor='middle' x='456' y='4' fill='currentColor' style='font-size:1em'>p</text>
<text text-anchor='middle' x='456' y='20' fill='currentColor' style='font-size:1em'>g</text>
<text text-anchor='middle' x='456' y='36' fill='currentColor' style='font-size:1em'>e</text>
<text text-anchor='middle' x='464' y='4' fill='currentColor' style='font-size:1em'>r</text>
<text text-anchor='middle' x='464' y='20' fill='currentColor' style='font-size:1em'>i</text>
<text text-anchor='middle' x='472' y='4' fill='currentColor' style='font-size:1em'>o</text>
<text text-anchor='middle' x='472' y='20' fill='currentColor' style='font-size:1em'>n</text>
<text text-anchor='middle' x='472' y='36' fill='currentColor' style='font-size:1em'>p</text>
<text text-anchor='middle' x='480' y='4' fill='currentColor' style='font-size:1em'>d</text>
<text text-anchor='middle' x='480' y='20' fill='currentColor' style='font-size:1em'>g</text>
<text text-anchor='middle' x='480' y='36' fill='currentColor' style='font-size:1em'>a</text>
<text text-anchor='middle' x='488' y='4' fill='currentColor' style='font-size:1em'>u</text>
<text text-anchor='middle' x='488' y='20' fill='currentColor' style='font-size:1em'>.</text>
<text text-anchor='middle' x='488' y='36' fill='currentColor' style='font-size:1em'>t</text>
<text text-anchor='middle' x='496' y='4' fill='currentColor' style='font-size:1em'>c</text>
<text text-anchor='middle' x='496' y='36' fill='currentColor' style='font-size:1em'>t</text>
<text text-anchor='middle' x='504' y='4' fill='currentColor' style='font-size:1em'>t</text>
<text text-anchor='middle' x='504' y='36' fill='currentColor' style='font-size:1em'>e</text>
<text text-anchor='middle' x='512' y='4' fill='currentColor' style='font-size:1em'>i</text>
<text text-anchor='middle' x='512' y='36' fill='currentColor' style='font-size:1em'>r</text>
<text text-anchor='middle' x='520' y='4' fill='currentColor' style='font-size:1em'>o</text>
<text text-anchor='middle' x='520' y='36' fill='currentColor' style='font-size:1em'>n</text>
<text text-anchor='middle' x='528' y='4' fill='currentColor' style='font-size:1em'>n</text>
<text text-anchor='middle' x='536' y='36' fill='currentColor' style='font-size:1em'>i</text>
<text text-anchor='middle' x='544' y='4' fill='currentColor' style='font-size:1em'>c</text>
<text text-anchor='middle' x='544' y='36' fill='currentColor' style='font-size:1em'>n</text>
<text text-anchor='middle' x='552' y='4' fill='currentColor' style='font-size:1em'>o</text>
<text text-anchor='middle' x='560' y='4' fill='currentColor' style='font-size:1em'>d</text>
<text text-anchor='middle' x='560' y='36' fill='currentColor' style='font-size:1em'>`</text>
<text text-anchor='middle' x='568' y='4' fill='currentColor' style='font-size:1em'>e</text>
<text text-anchor='middle' x='568' y='36' fill='currentColor' style='font-size:1em'>s</text>
<text text-anchor='middle' x='576' y='4' fill='currentColor' style='font-size:1em'>.</text>
<text text-anchor='middle' x='576' y='36' fill='currentColor' style='font-size:1em'>r</text>
<text text-anchor='middle' x='584' y='36' fill='currentColor' style='font-size:1em'>c</text>
<text text-anchor='middle' x='592' y='36' fill='currentColor' style='font-size:1em'>/</text>
<text text-anchor='middle' x='600' y='36' fill='currentColor' style='font-size:1em'>l</text>
<text text-anchor='middle' x='608' y='36' fill='currentColor' style='font-size:1em'>i</text>
<text text-anchor='middle' x='616' y='36' fill='currentColor' style='font-size:1em'>b</text>
<text text-anchor='middle' x='624' y='36' fill='currentColor' style='font-size:1em'>/</text>
<text text-anchor='middle' x='632' y='36' fill='currentColor' style='font-size:1em'>l</text>
<text text-anchor='middle' x='640' y='36' fill='currentColor' style='font-size:1em'>o</text>
<text text-anchor='middle' x='648' y='36' fill='currentColor' style='font-size:1em'>g</text>
<text text-anchor='middle' x='656' y='36' fill='currentColor' style='font-size:1em'>g</text>
<text text-anchor='middle' x='664' y='36' fill='currentColor' style='font-size:1em'>e</text>
<text text-anchor='middle' x='672' y='36' fill='currentColor' style='font-size:1em'>r</text>
<text text-anchor='middle' x='680' y='36' fill='currentColor' style='font-size:1em'>.</text>
<text text-anchor='middle' x='688' y='36' fill='currentColor' style='font-size:1em'>t</text>
<text text-anchor='middle' x='696' y='36' fill='currentColor' style='font-size:1em'>s</text>
<text text-anchor='middle' x='704' y='36' fill='currentColor' style='font-size:1em'>`</text>
<text text-anchor='middle' x='712' y='36' fill='currentColor' style='font-size:1em'>.</text>
</g>

    </svg>
  
</div>
<p>Notice three things: the <code>NEVER</code> keyword (strong language outperforms &ldquo;prefer&rdquo;), the reference to an actual file instead of copied code, and the function names so the AI knows exactly what to use.</p>
<h2 id="framework-specific-rule-templates">Framework-Specific Rule Templates</h2>
<p>Ready-to-use rule templates save hours of trial-and-error and can be adapted to match your project&rsquo;s conventions within minutes. The most effective templates are scoped precisely by file pattern, kept under 60 lines per rule file, and reference actual files in the codebase rather than embedding large code blocks. Below are battle-tested starting points for three common stacks.</p>
<h3 id="react--nextjs-template">React / Next.js Template</h3>
<p>Save as <code>.cursor/rules/react-nextjs.mdc</code>:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-yaml" data-lang="yaml"><span style="display:flex;"><span>---
</span></span><span style="display:flex;"><span><span style="color:#f92672">description</span>: <span style="color:#ae81ff">React and Next.js coding conventions</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">globs</span>: [<span style="color:#e6db74">&#34;src/**/*.tsx&#34;</span>, <span style="color:#e6db74">&#34;src/**/*.ts&#34;</span>, <span style="color:#e6db74">&#34;app/**/*.tsx&#34;</span>, <span style="color:#e6db74">&#34;app/**/*.ts&#34;</span>]
</span></span><span style="display:flex;"><span><span style="color:#f92672">alwaysApply</span>: <span style="color:#66d9ef">false</span>
</span></span><span style="display:flex;"><span>---
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e">## React / Next.js Rules</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>- <span style="color:#ae81ff">App Router only. NEVER use Pages Router patterns.</span>
</span></span><span style="display:flex;"><span>- <span style="color:#ae81ff">Server Components by default. Add &#39;use client&#39; only when you need browser APIs or event handlers.</span>
</span></span><span style="display:flex;"><span>- <span style="color:#ae81ff">Data fetching in Server Components using async/await — no useEffect for data fetching.</span>
</span></span><span style="display:flex;"><span>- <span style="color:#ae81ff">Use `next/image` for all images. NEVER use raw `&lt;img&gt;` tags.</span>
</span></span><span style="display:flex;"><span>- <span style="color:#ae81ff">Tailwind CSS for styling. No CSS modules, no styled-components.</span>
</span></span><span style="display:flex;"><span>- <span style="color:#ae81ff">TypeScript strict mode. No `any` types without an explicit comment explaining why.</span>
</span></span><span style="display:flex;"><span>- <span style="color:#ae81ff">Error boundaries with `error.tsx` files, loading states with `loading.tsx`.</span>
</span></span><span style="display:flex;"><span>- <span style="color:#ae81ff">Use `zod` for all runtime validation — define schemas in `src/lib/schemas/`.</span>
</span></span></code></pre></div><h3 id="python--fastapi-template">Python / FastAPI Template</h3>
<p>Save as <code>.cursor/rules/python-fastapi.mdc</code>:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-yaml" data-lang="yaml"><span style="display:flex;"><span>---
</span></span><span style="display:flex;"><span><span style="color:#f92672">description</span>: <span style="color:#ae81ff">Python and FastAPI conventions for backend services</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">globs</span>: [<span style="color:#e6db74">&#34;**/*.py&#34;</span>]
</span></span><span style="display:flex;"><span><span style="color:#f92672">alwaysApply</span>: <span style="color:#66d9ef">false</span>
</span></span><span style="display:flex;"><span>---
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e">## Python / FastAPI Rules</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>- <span style="color:#ae81ff">Python 3.12+. Use `match` statements over complex if/elif chains.</span>
</span></span><span style="display:flex;"><span>- <span style="color:#ae81ff">Pydantic v2 models for all request/response schemas. No dict returns from endpoints.</span>
</span></span><span style="display:flex;"><span>- <span style="color:#ae81ff">Async endpoints with `async def` everywhere. NEVER mix sync and async handlers.</span>
</span></span><span style="display:flex;"><span>- <span style="color:#ae81ff">Dependency injection via FastAPI `Depends()` — see patterns in `src/dependencies.py`.</span>
</span></span><span style="display:flex;"><span>- <span style="color:#ae81ff">Use `ruff` formatting rules (line length 88). NEVER use bare `except:` clauses.</span>
</span></span><span style="display:flex;"><span>- <span style="color:#ae81ff">SQLAlchemy 2.0 ORM with `AsyncSession`. Transactions scoped to request lifecycle.</span>
</span></span><span style="display:flex;"><span>- <span style="color:#ae81ff">All environment variables via `pydantic-settings` BaseSettings — see `src/config.py`.</span>
</span></span><span style="display:flex;"><span>- <span style="color:#ae81ff">Type hints required on all function signatures and return types.</span>
</span></span></code></pre></div><h3 id="full-stack-nextjs--supabase-template">Full-Stack (Next.js + Supabase) Template</h3>
<p>Save as <code>.cursor/rules/supabase.mdc</code>:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-yaml" data-lang="yaml"><span style="display:flex;"><span>---
</span></span><span style="display:flex;"><span><span style="color:#f92672">description</span>: <span style="color:#ae81ff">Supabase database and auth patterns</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">globs</span>: [<span style="color:#e6db74">&#34;src/lib/supabase/**&#34;</span>, <span style="color:#e6db74">&#34;src/app/api/**&#34;</span>, <span style="color:#e6db74">&#34;src/**/*supabase*&#34;</span>]
</span></span><span style="display:flex;"><span><span style="color:#f92672">alwaysApply</span>: <span style="color:#66d9ef">false</span>
</span></span><span style="display:flex;"><span>---
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e">## Supabase Rules</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>- <span style="color:#ae81ff">Use the server-side Supabase client from `src/lib/supabase/server.ts` in Server Components.</span>
</span></span><span style="display:flex;"><span>- <span style="color:#ae81ff">Use the browser client from `src/lib/supabase/client.ts` in Client Components only.</span>
</span></span><span style="display:flex;"><span>- <span style="color:#ae81ff">NEVER expose the service role key client-side. All admin operations go through API routes.</span>
</span></span><span style="display:flex;"><span>- <span style="color:#ae81ff">Row Level Security is enabled — test queries with the authenticated user context, not the service role.</span>
</span></span><span style="display:flex;"><span>- <span style="color:#ae81ff">Use `supabase.from(&#39;table&#39;).select()` with explicit column lists. NEVER use `select(&#39;*&#39;)` in production.</span>
</span></span></code></pre></div><h2 id="advanced-organizing-rules-for-large-projects">Advanced: Organizing Rules for Large Projects</h2>
<p>Large projects with multiple distinct layers — frontend, backend, infrastructure, testing — need a hierarchical rule organization strategy to avoid token bloat and rule conflicts. The recommended approach is to create one rule file per concern, scope each file tightly with glob patterns, and use a single short <code>global.mdc</code> with <code>alwaysApply: true</code> for the handful of truly universal constraints. A well-organized <code>.cursor/rules/</code> directory for a mid-size full-stack application might look like this: <code>global.mdc</code> (always on, under 150 words), <code>react-components.mdc</code> (glob: <code>src/components/**</code>), <code>api-routes.mdc</code> (glob: <code>src/app/api/**</code>), <code>database.mdc</code> (glob: <code>src/lib/db/**</code>, <code>prisma/**</code>), <code>testing.mdc</code> (glob: <code>**/*.test.ts</code>, <code>**/*.spec.ts</code>), <code>security.mdc</code> (agent-requested, triggered by security-sensitive tasks). This structure means that when the AI is writing a React component, it loads <code>global.mdc</code> and <code>react-components.mdc</code> — and nothing else. When writing API routes, it loads <code>global.mdc</code> and <code>api-routes.mdc</code>. The testing conventions never pollute a component generation task.</p>
<h3 id="team-conventions-for-version-controlled-rules">Team Conventions for Version-Controlled Rules</h3>
<p>Commit <code>.cursor/rules/</code> to your main branch and treat rule files like any other code — require review for changes, use descriptive commit messages, and document breaking changes in the PR description. When a rule is added to fix a recurring AI mistake, reference the rule file in your PR description so future reviewers understand why the constraint exists.</p>
<h2 id="the-token-budget-why-rule-length-matters-and-how-to-optimize">The Token Budget: Why Rule Length Matters and How to Optimize</h2>
<p>Every token in a Cursor rule file is loaded into the context window before your prompt — which means long rules directly reduce the number of tokens available for your actual code and conversation. A 1,000-line rule file consumes 2,000+ tokens before the model reads a single word of your request. For Always Apply rules, the cost is paid on every single request; for Auto Attached rules, the cost is paid every time a matching file is open. The recommended ceiling is 200 words for Always Apply rules and 500 lines total per rule file. Practical token optimization follows three principles. First, reference files instead of copying code: &ldquo;Follow the pattern in <code>src/components/Button.tsx</code>&rdquo; costs 12 tokens; copying the Button component into the rule file might cost 400. Second, write directives, not explanations: &ldquo;Use named exports&rdquo; (4 tokens) is better than a paragraph explaining why named exports are preferable (40+ tokens). Third, delete rules that no longer apply — outdated rules are both token-wasteful and actively harmful if the AI follows a deprecated pattern.</p>
<h3 id="token-cost-comparison">Token Cost Comparison</h3>
<table>
  <thead>
      <tr>
          <th>Rule Length</th>
          <th>Token Cost</th>
          <th>Context Window Impact</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>50 words (Always Apply)</td>
          <td>~75 tokens</td>
          <td>Negligible</td>
      </tr>
      <tr>
          <td>200 words (Always Apply)</td>
          <td>~300 tokens</td>
          <td>Acceptable ceiling</td>
      </tr>
      <tr>
          <td>1,000 lines (Always Apply)</td>
          <td>2,000+ tokens</td>
          <td>Severely degrades performance</td>
      </tr>
      <tr>
          <td>500 lines (Auto Attached)</td>
          <td>~1,000 tokens</td>
          <td>Acceptable for scoped rules</td>
      </tr>
  </tbody>
</table>
<h2 id="common-mistakes-that-make-cursor-rules-fail">Common Mistakes That Make Cursor Rules Fail</h2>
<p>The most common Cursor rule mistakes share a pattern: they&rsquo;re vague where they should be precise, they load everything when they should scope carefully, and they embed code that belongs in source files. Understanding these failure modes helps you write rules that actually change AI behavior rather than rules that get ignored or cause worse output. The six most damaging mistakes are: using weak language (&ldquo;prefer,&rdquo; &ldquo;consider,&rdquo; &ldquo;try to&rdquo;), missing library version specificity (the AI mixes Next.js 13 and 14 syntax without a version anchor), copying code blocks instead of referencing files (stale code in rules is worse than no code), writing Always Apply rules that exceed 200 words (token tax compounds across every request), writing vague scope that applies rules to unrelated files (a React rule that also loads for Python files), and writing rules before observing actual AI mistakes (premature rules add noise without solving real problems). The fix for each failure is mechanical: replace &ldquo;prefer&rdquo; with &ldquo;NEVER&rdquo; or &ldquo;ALWAYS,&rdquo; add version numbers explicitly, replace code blocks with file references, trim Always Apply rules to under 200 words, tighten glob patterns, and delete rules that were written speculatively rather than in response to observed behavior.</p>
<h3 id="before-vs-after-fixing-a-weak-rule">Before vs. After: Fixing a Weak Rule</h3>
<p><strong>Weak (will often be ignored):</strong></p>



<div class="goat svg-container ">
  
    <svg
      xmlns="http://www.w3.org/2000/svg"
      font-family="Menlo,Lucida Console,monospace"
      
        viewBox="0 0 632 25"
      >
      <g transform='translate(8,16)'>
<text text-anchor='middle' x='0' y='4' fill='currentColor' style='font-size:1em'>T</text>
<text text-anchor='middle' x='8' y='4' fill='currentColor' style='font-size:1em'>r</text>
<text text-anchor='middle' x='16' y='4' fill='currentColor' style='font-size:1em'>y</text>
<text text-anchor='middle' x='32' y='4' fill='currentColor' style='font-size:1em'>t</text>
<text text-anchor='middle' x='40' y='4' fill='currentColor' style='font-size:1em'>o</text>
<text text-anchor='middle' x='56' y='4' fill='currentColor' style='font-size:1em'>u</text>
<text text-anchor='middle' x='64' y='4' fill='currentColor' style='font-size:1em'>s</text>
<text text-anchor='middle' x='72' y='4' fill='currentColor' style='font-size:1em'>e</text>
<text text-anchor='middle' x='88' y='4' fill='currentColor' style='font-size:1em'>T</text>
<text text-anchor='middle' x='96' y='4' fill='currentColor' style='font-size:1em'>y</text>
<text text-anchor='middle' x='104' y='4' fill='currentColor' style='font-size:1em'>p</text>
<text text-anchor='middle' x='112' y='4' fill='currentColor' style='font-size:1em'>e</text>
<text text-anchor='middle' x='120' y='4' fill='currentColor' style='font-size:1em'>S</text>
<text text-anchor='middle' x='128' y='4' fill='currentColor' style='font-size:1em'>c</text>
<text text-anchor='middle' x='136' y='4' fill='currentColor' style='font-size:1em'>r</text>
<text text-anchor='middle' x='144' y='4' fill='currentColor' style='font-size:1em'>i</text>
<text text-anchor='middle' x='152' y='4' fill='currentColor' style='font-size:1em'>p</text>
<text text-anchor='middle' x='160' y='4' fill='currentColor' style='font-size:1em'>t</text>
<text text-anchor='middle' x='176' y='4' fill='currentColor' style='font-size:1em'>w</text>
<text text-anchor='middle' x='184' y='4' fill='currentColor' style='font-size:1em'>h</text>
<text text-anchor='middle' x='192' y='4' fill='currentColor' style='font-size:1em'>e</text>
<text text-anchor='middle' x='200' y='4' fill='currentColor' style='font-size:1em'>r</text>
<text text-anchor='middle' x='208' y='4' fill='currentColor' style='font-size:1em'>e</text>
<text text-anchor='middle' x='224' y='4' fill='currentColor' style='font-size:1em'>p</text>
<text text-anchor='middle' x='232' y='4' fill='currentColor' style='font-size:1em'>o</text>
<text text-anchor='middle' x='240' y='4' fill='currentColor' style='font-size:1em'>s</text>
<text text-anchor='middle' x='248' y='4' fill='currentColor' style='font-size:1em'>s</text>
<text text-anchor='middle' x='256' y='4' fill='currentColor' style='font-size:1em'>i</text>
<text text-anchor='middle' x='264' y='4' fill='currentColor' style='font-size:1em'>b</text>
<text text-anchor='middle' x='272' y='4' fill='currentColor' style='font-size:1em'>l</text>
<text text-anchor='middle' x='280' y='4' fill='currentColor' style='font-size:1em'>e</text>
<text text-anchor='middle' x='296' y='4' fill='currentColor' style='font-size:1em'>a</text>
<text text-anchor='middle' x='304' y='4' fill='currentColor' style='font-size:1em'>n</text>
<text text-anchor='middle' x='312' y='4' fill='currentColor' style='font-size:1em'>d</text>
<text text-anchor='middle' x='328' y='4' fill='currentColor' style='font-size:1em'>c</text>
<text text-anchor='middle' x='336' y='4' fill='currentColor' style='font-size:1em'>o</text>
<text text-anchor='middle' x='344' y='4' fill='currentColor' style='font-size:1em'>n</text>
<text text-anchor='middle' x='352' y='4' fill='currentColor' style='font-size:1em'>s</text>
<text text-anchor='middle' x='360' y='4' fill='currentColor' style='font-size:1em'>i</text>
<text text-anchor='middle' x='368' y='4' fill='currentColor' style='font-size:1em'>d</text>
<text text-anchor='middle' x='376' y='4' fill='currentColor' style='font-size:1em'>e</text>
<text text-anchor='middle' x='384' y='4' fill='currentColor' style='font-size:1em'>r</text>
<text text-anchor='middle' x='400' y='4' fill='currentColor' style='font-size:1em'>u</text>
<text text-anchor='middle' x='408' y='4' fill='currentColor' style='font-size:1em'>s</text>
<text text-anchor='middle' x='416' y='4' fill='currentColor' style='font-size:1em'>i</text>
<text text-anchor='middle' x='424' y='4' fill='currentColor' style='font-size:1em'>n</text>
<text text-anchor='middle' x='432' y='4' fill='currentColor' style='font-size:1em'>g</text>
<text text-anchor='middle' x='448' y='4' fill='currentColor' style='font-size:1em'>f</text>
<text text-anchor='middle' x='456' y='4' fill='currentColor' style='font-size:1em'>u</text>
<text text-anchor='middle' x='464' y='4' fill='currentColor' style='font-size:1em'>n</text>
<text text-anchor='middle' x='472' y='4' fill='currentColor' style='font-size:1em'>c</text>
<text text-anchor='middle' x='480' y='4' fill='currentColor' style='font-size:1em'>t</text>
<text text-anchor='middle' x='488' y='4' fill='currentColor' style='font-size:1em'>i</text>
<text text-anchor='middle' x='496' y='4' fill='currentColor' style='font-size:1em'>o</text>
<text text-anchor='middle' x='504' y='4' fill='currentColor' style='font-size:1em'>n</text>
<text text-anchor='middle' x='512' y='4' fill='currentColor' style='font-size:1em'>a</text>
<text text-anchor='middle' x='520' y='4' fill='currentColor' style='font-size:1em'>l</text>
<text text-anchor='middle' x='536' y='4' fill='currentColor' style='font-size:1em'>c</text>
<text text-anchor='middle' x='544' y='4' fill='currentColor' style='font-size:1em'>o</text>
<text text-anchor='middle' x='552' y='4' fill='currentColor' style='font-size:1em'>m</text>
<text text-anchor='middle' x='560' y='4' fill='currentColor' style='font-size:1em'>p</text>
<text text-anchor='middle' x='568' y='4' fill='currentColor' style='font-size:1em'>o</text>
<text text-anchor='middle' x='576' y='4' fill='currentColor' style='font-size:1em'>n</text>
<text text-anchor='middle' x='584' y='4' fill='currentColor' style='font-size:1em'>e</text>
<text text-anchor='middle' x='592' y='4' fill='currentColor' style='font-size:1em'>n</text>
<text text-anchor='middle' x='600' y='4' fill='currentColor' style='font-size:1em'>t</text>
<text text-anchor='middle' x='608' y='4' fill='currentColor' style='font-size:1em'>s</text>
<text text-anchor='middle' x='616' y='4' fill='currentColor' style='font-size:1em'>.</text>
</g>

    </svg>
  
</div>
<p><strong>Strong (reliably applied):</strong></p>



<div class="goat svg-container ">
  
    <svg
      xmlns="http://www.w3.org/2000/svg"
      font-family="Menlo,Lucida Console,monospace"
      
        viewBox="0 0 664 41"
      >
      <g transform='translate(8,16)'>
<text text-anchor='middle' x='0' y='4' fill='currentColor' style='font-size:1em'>A</text>
<text text-anchor='middle' x='0' y='20' fill='currentColor' style='font-size:1em'>N</text>
<text text-anchor='middle' x='8' y='4' fill='currentColor' style='font-size:1em'>L</text>
<text text-anchor='middle' x='8' y='20' fill='currentColor' style='font-size:1em'>E</text>
<text text-anchor='middle' x='16' y='4' fill='currentColor' style='font-size:1em'>W</text>
<text text-anchor='middle' x='16' y='20' fill='currentColor' style='font-size:1em'>V</text>
<text text-anchor='middle' x='24' y='4' fill='currentColor' style='font-size:1em'>A</text>
<text text-anchor='middle' x='24' y='20' fill='currentColor' style='font-size:1em'>E</text>
<text text-anchor='middle' x='32' y='4' fill='currentColor' style='font-size:1em'>Y</text>
<text text-anchor='middle' x='32' y='20' fill='currentColor' style='font-size:1em'>R</text>
<text text-anchor='middle' x='40' y='4' fill='currentColor' style='font-size:1em'>S</text>
<text text-anchor='middle' x='48' y='20' fill='currentColor' style='font-size:1em'>u</text>
<text text-anchor='middle' x='56' y='4' fill='currentColor' style='font-size:1em'>u</text>
<text text-anchor='middle' x='56' y='20' fill='currentColor' style='font-size:1em'>s</text>
<text text-anchor='middle' x='64' y='4' fill='currentColor' style='font-size:1em'>s</text>
<text text-anchor='middle' x='64' y='20' fill='currentColor' style='font-size:1em'>e</text>
<text text-anchor='middle' x='72' y='4' fill='currentColor' style='font-size:1em'>e</text>
<text text-anchor='middle' x='80' y='20' fill='currentColor' style='font-size:1em'>c</text>
<text text-anchor='middle' x='88' y='4' fill='currentColor' style='font-size:1em'>T</text>
<text text-anchor='middle' x='88' y='20' fill='currentColor' style='font-size:1em'>l</text>
<text text-anchor='middle' x='96' y='4' fill='currentColor' style='font-size:1em'>y</text>
<text text-anchor='middle' x='96' y='20' fill='currentColor' style='font-size:1em'>a</text>
<text text-anchor='middle' x='104' y='4' fill='currentColor' style='font-size:1em'>p</text>
<text text-anchor='middle' x='104' y='20' fill='currentColor' style='font-size:1em'>s</text>
<text text-anchor='middle' x='112' y='4' fill='currentColor' style='font-size:1em'>e</text>
<text text-anchor='middle' x='112' y='20' fill='currentColor' style='font-size:1em'>s</text>
<text text-anchor='middle' x='120' y='4' fill='currentColor' style='font-size:1em'>S</text>
<text text-anchor='middle' x='128' y='4' fill='currentColor' style='font-size:1em'>c</text>
<text text-anchor='middle' x='128' y='20' fill='currentColor' style='font-size:1em'>c</text>
<text text-anchor='middle' x='136' y='4' fill='currentColor' style='font-size:1em'>r</text>
<text text-anchor='middle' x='136' y='20' fill='currentColor' style='font-size:1em'>o</text>
<text text-anchor='middle' x='144' y='4' fill='currentColor' style='font-size:1em'>i</text>
<text text-anchor='middle' x='144' y='20' fill='currentColor' style='font-size:1em'>m</text>
<text text-anchor='middle' x='152' y='4' fill='currentColor' style='font-size:1em'>p</text>
<text text-anchor='middle' x='152' y='20' fill='currentColor' style='font-size:1em'>p</text>
<text text-anchor='middle' x='160' y='4' fill='currentColor' style='font-size:1em'>t</text>
<text text-anchor='middle' x='160' y='20' fill='currentColor' style='font-size:1em'>o</text>
<text text-anchor='middle' x='168' y='4' fill='currentColor' style='font-size:1em'>.</text>
<text text-anchor='middle' x='168' y='20' fill='currentColor' style='font-size:1em'>n</text>
<text text-anchor='middle' x='176' y='20' fill='currentColor' style='font-size:1em'>e</text>
<text text-anchor='middle' x='184' y='4' fill='currentColor' style='font-size:1em'>N</text>
<text text-anchor='middle' x='184' y='20' fill='currentColor' style='font-size:1em'>n</text>
<text text-anchor='middle' x='192' y='4' fill='currentColor' style='font-size:1em'>E</text>
<text text-anchor='middle' x='192' y='20' fill='currentColor' style='font-size:1em'>t</text>
<text text-anchor='middle' x='200' y='4' fill='currentColor' style='font-size:1em'>V</text>
<text text-anchor='middle' x='200' y='20' fill='currentColor' style='font-size:1em'>s</text>
<text text-anchor='middle' x='208' y='4' fill='currentColor' style='font-size:1em'>E</text>
<text text-anchor='middle' x='208' y='20' fill='currentColor' style='font-size:1em'>.</text>
<text text-anchor='middle' x='216' y='4' fill='currentColor' style='font-size:1em'>R</text>
<text text-anchor='middle' x='224' y='20' fill='currentColor' style='font-size:1em'>U</text>
<text text-anchor='middle' x='232' y='4' fill='currentColor' style='font-size:1em'>u</text>
<text text-anchor='middle' x='232' y='20' fill='currentColor' style='font-size:1em'>s</text>
<text text-anchor='middle' x='240' y='4' fill='currentColor' style='font-size:1em'>s</text>
<text text-anchor='middle' x='240' y='20' fill='currentColor' style='font-size:1em'>e</text>
<text text-anchor='middle' x='248' y='4' fill='currentColor' style='font-size:1em'>e</text>
<text text-anchor='middle' x='256' y='20' fill='currentColor' style='font-size:1em'>f</text>
<text text-anchor='middle' x='264' y='4' fill='currentColor' style='font-size:1em'>J</text>
<text text-anchor='middle' x='264' y='20' fill='currentColor' style='font-size:1em'>u</text>
<text text-anchor='middle' x='272' y='4' fill='currentColor' style='font-size:1em'>a</text>
<text text-anchor='middle' x='272' y='20' fill='currentColor' style='font-size:1em'>n</text>
<text text-anchor='middle' x='280' y='4' fill='currentColor' style='font-size:1em'>v</text>
<text text-anchor='middle' x='280' y='20' fill='currentColor' style='font-size:1em'>c</text>
<text text-anchor='middle' x='288' y='4' fill='currentColor' style='font-size:1em'>a</text>
<text text-anchor='middle' x='288' y='20' fill='currentColor' style='font-size:1em'>t</text>
<text text-anchor='middle' x='296' y='4' fill='currentColor' style='font-size:1em'>S</text>
<text text-anchor='middle' x='296' y='20' fill='currentColor' style='font-size:1em'>i</text>
<text text-anchor='middle' x='304' y='4' fill='currentColor' style='font-size:1em'>c</text>
<text text-anchor='middle' x='304' y='20' fill='currentColor' style='font-size:1em'>o</text>
<text text-anchor='middle' x='312' y='4' fill='currentColor' style='font-size:1em'>r</text>
<text text-anchor='middle' x='312' y='20' fill='currentColor' style='font-size:1em'>n</text>
<text text-anchor='middle' x='320' y='4' fill='currentColor' style='font-size:1em'>i</text>
<text text-anchor='middle' x='320' y='20' fill='currentColor' style='font-size:1em'>a</text>
<text text-anchor='middle' x='328' y='4' fill='currentColor' style='font-size:1em'>p</text>
<text text-anchor='middle' x='328' y='20' fill='currentColor' style='font-size:1em'>l</text>
<text text-anchor='middle' x='336' y='4' fill='currentColor' style='font-size:1em'>t</text>
<text text-anchor='middle' x='344' y='20' fill='currentColor' style='font-size:1em'>c</text>
<text text-anchor='middle' x='352' y='4' fill='currentColor' style='font-size:1em'>f</text>
<text text-anchor='middle' x='352' y='20' fill='currentColor' style='font-size:1em'>o</text>
<text text-anchor='middle' x='360' y='4' fill='currentColor' style='font-size:1em'>i</text>
<text text-anchor='middle' x='360' y='20' fill='currentColor' style='font-size:1em'>m</text>
<text text-anchor='middle' x='368' y='4' fill='currentColor' style='font-size:1em'>l</text>
<text text-anchor='middle' x='368' y='20' fill='currentColor' style='font-size:1em'>p</text>
<text text-anchor='middle' x='376' y='4' fill='currentColor' style='font-size:1em'>e</text>
<text text-anchor='middle' x='376' y='20' fill='currentColor' style='font-size:1em'>o</text>
<text text-anchor='middle' x='384' y='4' fill='currentColor' style='font-size:1em'>s</text>
<text text-anchor='middle' x='384' y='20' fill='currentColor' style='font-size:1em'>n</text>
<text text-anchor='middle' x='392' y='20' fill='currentColor' style='font-size:1em'>e</text>
<text text-anchor='middle' x='400' y='20' fill='currentColor' style='font-size:1em'>n</text>
<text text-anchor='middle' x='408' y='4' fill='currentColor' style='font-size:1em'>.</text>
<text text-anchor='middle' x='408' y='20' fill='currentColor' style='font-size:1em'>t</text>
<text text-anchor='middle' x='416' y='4' fill='currentColor' style='font-size:1em'>j</text>
<text text-anchor='middle' x='416' y='20' fill='currentColor' style='font-size:1em'>s</text>
<text text-anchor='middle' x='424' y='4' fill='currentColor' style='font-size:1em'>s</text>
<text text-anchor='middle' x='432' y='4' fill='currentColor' style='font-size:1em'>)</text>
<text text-anchor='middle' x='432' y='20' fill='currentColor' style='font-size:1em'>w</text>
<text text-anchor='middle' x='440' y='20' fill='currentColor' style='font-size:1em'>i</text>
<text text-anchor='middle' x='448' y='4' fill='currentColor' style='font-size:1em'>—</text>
<text text-anchor='middle' x='448' y='20' fill='currentColor' style='font-size:1em'>t</text>
<text text-anchor='middle' x='456' y='20' fill='currentColor' style='font-size:1em'>h</text>
<text text-anchor='middle' x='464' y='4' fill='currentColor' style='font-size:1em'>c</text>
<text text-anchor='middle' x='472' y='4' fill='currentColor' style='font-size:1em'>r</text>
<text text-anchor='middle' x='472' y='20' fill='currentColor' style='font-size:1em'>h</text>
<text text-anchor='middle' x='480' y='4' fill='currentColor' style='font-size:1em'>e</text>
<text text-anchor='middle' x='480' y='20' fill='currentColor' style='font-size:1em'>o</text>
<text text-anchor='middle' x='488' y='4' fill='currentColor' style='font-size:1em'>a</text>
<text text-anchor='middle' x='488' y='20' fill='currentColor' style='font-size:1em'>o</text>
<text text-anchor='middle' x='496' y='4' fill='currentColor' style='font-size:1em'>t</text>
<text text-anchor='middle' x='496' y='20' fill='currentColor' style='font-size:1em'>k</text>
<text text-anchor='middle' x='504' y='4' fill='currentColor' style='font-size:1em'>e</text>
<text text-anchor='middle' x='504' y='20' fill='currentColor' style='font-size:1em'>s</text>
<text text-anchor='middle' x='520' y='4' fill='currentColor' style='font-size:1em'>.</text>
<text text-anchor='middle' x='520' y='20' fill='currentColor' style='font-size:1em'>e</text>
<text text-anchor='middle' x='528' y='4' fill='currentColor' style='font-size:1em'>t</text>
<text text-anchor='middle' x='528' y='20' fill='currentColor' style='font-size:1em'>x</text>
<text text-anchor='middle' x='536' y='4' fill='currentColor' style='font-size:1em'>s</text>
<text text-anchor='middle' x='536' y='20' fill='currentColor' style='font-size:1em'>c</text>
<text text-anchor='middle' x='544' y='20' fill='currentColor' style='font-size:1em'>l</text>
<text text-anchor='middle' x='552' y='4' fill='currentColor' style='font-size:1em'>o</text>
<text text-anchor='middle' x='552' y='20' fill='currentColor' style='font-size:1em'>u</text>
<text text-anchor='middle' x='560' y='4' fill='currentColor' style='font-size:1em'>r</text>
<text text-anchor='middle' x='560' y='20' fill='currentColor' style='font-size:1em'>s</text>
<text text-anchor='middle' x='568' y='20' fill='currentColor' style='font-size:1em'>i</text>
<text text-anchor='middle' x='576' y='4' fill='currentColor' style='font-size:1em'>.</text>
<text text-anchor='middle' x='576' y='20' fill='currentColor' style='font-size:1em'>v</text>
<text text-anchor='middle' x='584' y='4' fill='currentColor' style='font-size:1em'>t</text>
<text text-anchor='middle' x='584' y='20' fill='currentColor' style='font-size:1em'>e</text>
<text text-anchor='middle' x='592' y='4' fill='currentColor' style='font-size:1em'>s</text>
<text text-anchor='middle' x='592' y='20' fill='currentColor' style='font-size:1em'>l</text>
<text text-anchor='middle' x='600' y='4' fill='currentColor' style='font-size:1em'>x</text>
<text text-anchor='middle' x='600' y='20' fill='currentColor' style='font-size:1em'>y</text>
<text text-anchor='middle' x='608' y='20' fill='currentColor' style='font-size:1em'>.</text>
<text text-anchor='middle' x='616' y='4' fill='currentColor' style='font-size:1em'>o</text>
<text text-anchor='middle' x='624' y='4' fill='currentColor' style='font-size:1em'>n</text>
<text text-anchor='middle' x='632' y='4' fill='currentColor' style='font-size:1em'>l</text>
<text text-anchor='middle' x='640' y='4' fill='currentColor' style='font-size:1em'>y</text>
<text text-anchor='middle' x='648' y='4' fill='currentColor' style='font-size:1em'>.</text>
</g>

    </svg>
  
</div>
<h2 id="cursor-rules-vs-other-ai-config-files">Cursor Rules vs Other AI Config Files</h2>
<p>Understanding where Cursor rules fit among other AI configuration formats helps teams working across multiple tools avoid duplication and conflicting instructions. The four main formats in 2026 are: <code>.cursor/rules/*.mdc</code> (Cursor-specific, project-scoped), <code>CLAUDE.md</code> (Claude Code-specific, directory-aware), <code>copilot-instructions.md</code> (GitHub Copilot, repository-scoped), and <code>.windsurfrules</code> (Windsurf IDE). Cursor rules and CLAUDE.md serve similar purposes but are read by different tools — Cursor ignores CLAUDE.md and Claude Code ignores <code>.cursor/rules/</code>. Teams using both tools maintain separate files, though the content often overlaps substantially. The key difference is activation mechanism: Cursor rules have four modes (Always Apply, Glob, Agent Requested, Manual), while CLAUDE.md is always loaded for the directory where it&rsquo;s placed. Copilot instructions (<code>github/copilot-instructions.md</code>) apply repository-wide with no scoping mechanism — a single file for all contexts. <code>.windsurfrules</code> follows the legacy single-file pattern similar to the old <code>.cursorrules</code>. For teams standardizing on Cursor, <code>.mdc</code> files offer the most granular control of any format in the current ecosystem.</p>
<table>
  <thead>
      <tr>
          <th>File</th>
          <th>Tool</th>
          <th>Scope Control</th>
          <th>Activation Modes</th>
          <th>Version Control</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td><code>.cursor/rules/*.mdc</code></td>
          <td>Cursor</td>
          <td>Per-file glob</td>
          <td>4 modes</td>
          <td>Yes</td>
      </tr>
      <tr>
          <td><code>CLAUDE.md</code></td>
          <td>Claude Code</td>
          <td>Directory-aware</td>
          <td>Always loaded</td>
          <td>Yes</td>
      </tr>
      <tr>
          <td><code>copilot-instructions.md</code></td>
          <td>GitHub Copilot</td>
          <td>Repo-wide only</td>
          <td>Single mode</td>
          <td>Yes</td>
      </tr>
      <tr>
          <td><code>.windsurfrules</code></td>
          <td>Windsurf</td>
          <td>Project-wide</td>
          <td>Single mode</td>
          <td>Yes</td>
      </tr>
      <tr>
          <td><code>.cursorrules</code> (legacy)</td>
          <td>Cursor</td>
          <td>Project-wide</td>
          <td>Always loaded</td>
          <td>Yes</td>
      </tr>
  </tbody>
</table>
<h2 id="best-practices-summary">Best Practices Summary</h2>
<p>Effective Cursor rules follow a consistent set of principles that experienced teams converge on after trial and error. Write rules reactively, not speculatively: add a rule only when the AI repeats the same mistake twice. Use strong imperative language: &ldquo;NEVER,&rdquo; &ldquo;ALWAYS,&rdquo; and &ldquo;MUST&rdquo; outperform &ldquo;prefer,&rdquo; &ldquo;consider,&rdquo; and &ldquo;try to.&rdquo; Reference files, don&rsquo;t embed code: <code>&quot;Follow the pattern in src/components/Button.tsx&quot;</code> is more maintainable than copying the component into the rule. Keep Always Apply rules under 200 words to control the token tax. Scope Auto Attached rules tightly with precise glob patterns. Commit <code>.cursor/rules/</code> to version control so the entire team shares identical AI behavior — treat rule changes like code changes, with review and clear commit messages. Delete outdated rules promptly; a stale rule is worse than no rule because the AI will follow deprecated patterns. Finally, test each rule by asking Cursor to generate code that the rule should influence, and verify the output matches your expectations before shipping the rule to the team.</p>
<hr>
<h2 id="faq">FAQ</h2>
<p><strong>What is the difference between .cursorrules and .mdc files?</strong></p>
<p><code>.cursorrules</code> is the legacy single-file format that loads unconditionally in every request — it has no scoping, no activation modes, and consumes tokens even when irrelevant to the current task. <code>.mdc</code> files in the <code>.cursor/rules/</code> directory are the modern format, supporting YAML frontmatter that controls whether the rule always loads, loads for specific file patterns, loads when the AI deems it relevant, or loads only when manually referenced. For any project started in 2026, use <code>.mdc</code> files exclusively.</p>
<p><strong>How long should my Cursor rules be?</strong></p>
<p>Always Apply rules should stay under 200 words — every word costs tokens on every single request. Auto Attached rules (triggered by file patterns) can be up to 500 lines, since they only load when relevant files are open. Agent Requested and Manual rules have less strict limits but should still be under 300 lines for readability and response quality. If a rule file is getting long, split it into multiple topic-specific files with tighter glob scopes.</p>
<p><strong>Should I commit .cursor/rules/ to version control?</strong></p>
<p>Yes, always. The <code>.cursor/rules/</code> directory should be committed to your main branch and treated like any other code. Version-controlling your rules means new team members get the same AI behavior immediately, rule changes go through code review, and you can track when and why rules were added or removed. Add a note to your project&rsquo;s README or onboarding docs explaining that Cursor rules live in <code>.cursor/rules/</code>.</p>
<p><strong>How do I know when to add a new Cursor rule?</strong></p>
<p>Add a rule when the AI makes the same mistake twice in the same project context. One occurrence might be a prompt issue; two occurrences signals a missing rule. Avoid writing rules speculatively on day one — teams that write 20 rules before using the tool create token bloat without solving real problems. Start with a minimal <code>global.mdc</code> (2-3 constraints, under 150 words) and add rules as you observe friction.</p>
<p><strong>Can I use Cursor rules with Claude Code or GitHub Copilot?</strong></p>
<p>No. Cursor rules (<code>.cursor/rules/*.mdc</code> and the legacy <code>.cursorrules</code>) are read only by Cursor. Claude Code reads <code>CLAUDE.md</code> files, and GitHub Copilot reads <code>github/copilot-instructions.md</code>. If your team uses multiple AI tools, you&rsquo;ll need to maintain separate configuration files for each — though the content often overlaps, so you can write one set of standards and adapt the format for each tool.</p>
]]></content:encoded></item></channel></rss>