<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Muhammad Irsyad Aulia</title>
    <description>The latest articles on DEV Community by Muhammad Irsyad Aulia (@irsyadbuilds).</description>
    <link>https://dev.to/irsyadbuilds</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4002137%2F80c202c5-aeef-4b16-b571-7d83b0dfb952.jpg</url>
      <title>DEV Community: Muhammad Irsyad Aulia</title>
      <link>https://dev.to/irsyadbuilds</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/irsyadbuilds"/>
    <language>en</language>
    <item>
      <title>Why Your Cursor Rules Don't Work in Agent Mode (And How to Fix It)</title>
      <dc:creator>Muhammad Irsyad Aulia</dc:creator>
      <pubDate>Thu, 25 Jun 2026 10:37:24 +0000</pubDate>
      <link>https://dev.to/irsyadbuilds/why-your-cursor-rules-dont-work-in-agent-mode-and-how-to-fix-it-5eic</link>
      <guid>https://dev.to/irsyadbuilds/why-your-cursor-rules-dont-work-in-agent-mode-and-how-to-fix-it-5eic</guid>
      <description>&lt;p&gt;You added a &lt;code&gt;.cursorrules&lt;/code&gt; file to your Next.js project. You wrote detailed instructions about your stack, your conventions, your preferences.&lt;/p&gt;

&lt;p&gt;And then you opened Cursor in &lt;strong&gt;Agent Mode&lt;/strong&gt; and... Cursor ignored all of it.&lt;/p&gt;

&lt;p&gt;Sound familiar?&lt;/p&gt;

&lt;h2&gt;
  
  
  The Silent Problem Nobody Talks About
&lt;/h2&gt;

&lt;p&gt;Here's what's happening: &lt;code&gt;.cursorrules&lt;/code&gt; is a legacy format that &lt;strong&gt;Cursor stopped reading in Agent Mode&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;When you use Chat or Composer, it works (sometimes). But Agent Mode — which is now the primary way most developers use Cursor — loads a completely different context system.&lt;/p&gt;

&lt;p&gt;Your carefully written &lt;code&gt;.cursorrules&lt;/code&gt; file? Silently ignored.&lt;/p&gt;

&lt;p&gt;This means every Agent Mode session, you're starting from scratch:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;"Use Next.js App Router, not Pages Router"&lt;/li&gt;
&lt;li&gt;"We use Clerk for auth, not NextAuth"
&lt;/li&gt;
&lt;li&gt;"Always validate with Zod"&lt;/li&gt;
&lt;li&gt;"Use server components by default"&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You're not forgetting to write rules. The format you're using is just outdated.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Solution: &lt;code&gt;.mdc&lt;/code&gt; Rules
&lt;/h2&gt;

&lt;p&gt;Cursor's new rule system uses &lt;code&gt;.mdc&lt;/code&gt; files inside a &lt;code&gt;.cursor/rules/&lt;/code&gt; directory.&lt;/p&gt;

&lt;p&gt;Here's what makes &lt;code&gt;.mdc&lt;/code&gt; different:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. They work in ALL modes&lt;/strong&gt;&lt;br&gt;
Chat, Composer, and Agent Mode — your rules load consistently everywhere.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Modular scoping&lt;/strong&gt;&lt;br&gt;
Each &lt;code&gt;.mdc&lt;/code&gt; file has frontmatter that controls exactly when it activates:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="nn"&gt;---&lt;/span&gt;
&lt;span class="na"&gt;description&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Next.js App Router conventions&lt;/span&gt;
&lt;span class="na"&gt;globs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;app/**/*.tsx"&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;app/**/*.ts"&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;
&lt;span class="na"&gt;alwaysApply&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
&lt;span class="nn"&gt;---&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With &lt;code&gt;globs&lt;/code&gt;, this rule only activates when you're working in the &lt;code&gt;app/&lt;/code&gt; directory. No context bloat on unrelated files.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. &lt;code&gt;alwaysApply: true&lt;/code&gt; for critical context&lt;/strong&gt;&lt;br&gt;
Some rules should always load — like your project's core stack declaration:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="nn"&gt;---&lt;/span&gt;
&lt;span class="na"&gt;description&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Core project context and stack&lt;/span&gt;
&lt;span class="na"&gt;alwaysApply&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
&lt;span class="nn"&gt;---&lt;/span&gt;

&lt;span class="c1"&gt;# Project Context&lt;/span&gt;

&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;Framework&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Next.js 15 (App Router)&lt;/span&gt;
&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;Auth&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Clerk (NOT NextAuth)&lt;/span&gt;
&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;Database&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Supabase + Prisma&lt;/span&gt;
&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;Payments&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Stripe&lt;/span&gt;
&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;UI&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;shadcn/ui + Tailwind CSS&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This fires on every single session, in every mode.&lt;/p&gt;

&lt;h2&gt;
  
  
  Setting It Up For Next.js
&lt;/h2&gt;

&lt;p&gt;Create this folder structure in your project root:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;your-project/
├── .cursor/
│   └── rules/
│       ├── 001-project-context.mdc    ← alwaysApply: true
│       ├── 010-typescript.mdc         ← alwaysApply: true
│       ├── 020-nextjs-app-router.mdc  ← glob: app/**
│       ├── 030-supabase.mdc           ← glob: lib/supabase/**
│       └── 040-stripe.mdc             ← glob: lib/stripe/**
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here's a starter &lt;code&gt;001-project-context.mdc&lt;/code&gt; you can copy:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="nn"&gt;---&lt;/span&gt;
&lt;span class="na"&gt;description&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Core project stack and conventions&lt;/span&gt;
&lt;span class="na"&gt;alwaysApply&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
&lt;span class="nn"&gt;---&lt;/span&gt;

&lt;span class="gh"&gt;# Project Context&lt;/span&gt;

&lt;span class="gu"&gt;## Stack&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; Framework: Next.js 15 (App Router ONLY)
&lt;span class="p"&gt;-&lt;/span&gt; Language: TypeScript strict mode
&lt;span class="p"&gt;-&lt;/span&gt; Auth: Clerk
&lt;span class="p"&gt;-&lt;/span&gt; Database: Supabase (PostgreSQL)
&lt;span class="p"&gt;-&lt;/span&gt; Payments: Stripe
&lt;span class="p"&gt;-&lt;/span&gt; UI: shadcn/ui + Tailwind CSS
&lt;span class="p"&gt;-&lt;/span&gt; AI: Vercel AI SDK

&lt;span class="gu"&gt;## Core Rules&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; ALWAYS use App Router — never Pages Router
&lt;span class="p"&gt;-&lt;/span&gt; ALWAYS default to server components
&lt;span class="p"&gt;-&lt;/span&gt; ONLY add "use client" when strictly necessary
&lt;span class="p"&gt;-&lt;/span&gt; ALWAYS validate with Zod before processing data
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Save that file, restart Cursor, open Agent Mode, and ask: &lt;strong&gt;"What stack are we using?"&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Cursor will answer correctly. No re-explaining.&lt;/p&gt;

&lt;h2&gt;
  
  
  How Many Rules Should You Have?
&lt;/h2&gt;

&lt;p&gt;For a typical Next.js SaaS project, I recommend separating rules by concern:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;File&lt;/th&gt;
&lt;th&gt;Scope&lt;/th&gt;
&lt;th&gt;Purpose&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;001-project-context.mdc&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Always&lt;/td&gt;
&lt;td&gt;Stack declaration&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;010-typescript.mdc&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Always&lt;/td&gt;
&lt;td&gt;TS standards&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;020-nextjs-app-router.mdc&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;app/**&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Routing conventions&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;030-react-components.mdc&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;components/**&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Component patterns&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;040-server-actions.mdc&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;actions/**&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Server action patterns&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;050-api-routes.mdc&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;app/api/**&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;API conventions&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;060-supabase.mdc&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;lib/supabase/**&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;DB patterns&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;070-clerk.mdc&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;middleware.ts&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Auth patterns&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;080-stripe.mdc&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;lib/stripe/**&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Payment patterns&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Each file stays focused. Cursor loads only what's relevant to the files you're editing.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Result
&lt;/h2&gt;

&lt;p&gt;After setting this up properly, your Agent Mode sessions become dramatically more consistent:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;✅ No more "use NextAuth" when you're using Clerk&lt;/li&gt;
&lt;li&gt;✅ No more &lt;code&gt;useEffect&lt;/code&gt; fetches when you should use server components&lt;/li&gt;
&lt;li&gt;✅ No more missing Zod validation&lt;/li&gt;
&lt;li&gt;✅ No more &lt;code&gt;any&lt;/code&gt; types slipping through&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Your AI pair programmer finally knows your project as well as you do.&lt;/p&gt;




&lt;p&gt;I spent the last week writing 15 battle-tested &lt;code&gt;.mdc&lt;/code&gt; rules specifically for the &lt;strong&gt;Next.js AI SaaS stack&lt;/strong&gt; (Supabase + Clerk + Stripe + Vercel AI SDK + shadcn/ui).&lt;/p&gt;

&lt;p&gt;3 of them are &lt;strong&gt;free on GitHub&lt;/strong&gt; if you want to start immediately:&lt;br&gt;
👉 &lt;a href="https://github.com/irsyad-aulia/nextjs-ai-saas-cursor-rules" rel="noopener noreferrer"&gt;github.com/irsyad-aulia/nextjs-ai-saas-cursor-rules&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The full pack of 15 rules is available for $49 if you want the complete setup:&lt;br&gt;
👉 &lt;a href="https://irsyadbuilds.lemonsqueezy.com/checkout/buy/d78f3926-96be-4be7-99b3-0c585efb4bce" rel="noopener noreferrer"&gt;Next.js AI SaaS Cursor Rules Pack&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Drop a comment if you have questions — building in public from Indonesia 🇮🇩 &lt;a class="mentioned-user" href="https://dev.to/irsyadbuilds"&gt;@irsyadbuilds&lt;/a&gt;&lt;/p&gt;

</description>
      <category>cursor</category>
      <category>nextjs</category>
      <category>typescript</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
