<?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: ShipStack</title>
    <description>The latest articles on DEV Community by ShipStack (@ship_stack).</description>
    <link>https://dev.to/ship_stack</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%2F4228124%2F57bdbf95-2f29-4704-a7b6-dfeabded5163.png</url>
      <title>DEV Community: ShipStack</title>
      <link>https://dev.to/ship_stack</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ship_stack"/>
    <language>en</language>
    <item>
      <title>Stop Cursor from rewriting your whole file: a 10-line project rule that keeps diffs small</title>
      <dc:creator>ShipStack</dc:creator>
      <pubDate>Thu, 05 Nov 2026 09:26:59 +0000</pubDate>
      <link>https://dev.to/ship_stack/stop-cursor-from-rewriting-your-whole-file-a-10-line-project-rule-that-keeps-diffs-small-3lbd</link>
      <guid>https://dev.to/ship_stack/stop-cursor-from-rewriting-your-whole-file-a-10-line-project-rule-that-keeps-diffs-small-3lbd</guid>
      <description>&lt;p&gt;If you use Cursor's agent on a real codebase, you've probably seen it: you ask for a one-line fix and get back a diff that reformats imports, renames variables, and "improves" three functions you didn't touch.&lt;/p&gt;

&lt;p&gt;The fix that's worked best for me isn't a better prompt — it's a &lt;strong&gt;project rule&lt;/strong&gt; that's always applied.&lt;/p&gt;

&lt;h2&gt;
  
  
  The rule
&lt;/h2&gt;

&lt;p&gt;Create &lt;code&gt;.cursor/rules/small-diffs.mdc&lt;/code&gt;:&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="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Keep&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;changes&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;minimal&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;and&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;scoped"&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="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;Change only the lines required for the task. Do not reformat, reorder imports, or rename unrelated code.&lt;/span&gt;
&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;Before editing, state in one sentence which files and functions you will touch.&lt;/span&gt;
&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;If a fix needs changes outside that scope, stop and ask first.&lt;/span&gt;
&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;Match the existing style of the file, even if you'd write it differently.&lt;/span&gt;
&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;Never delete comments or tests unless asked.&lt;/span&gt;
&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;Prefer editing existing functions over adding new abstractions.&lt;/span&gt;
&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;After editing, list every file changed and why.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Why it works
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;"State the scope first"&lt;/strong&gt; makes the agent commit to a plan you can reject before any edit happens.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;"Stop and ask"&lt;/strong&gt; turns silent scope creep into a question.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;"Match existing style"&lt;/strong&gt; kills the reformat-everything diffs that make review painful.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;"List every file changed"&lt;/strong&gt; gives you a free checklist for review.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Tips
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Keep always-on rules short. Long rules get diluted; put specialised guidance in rules scoped with &lt;code&gt;globs&lt;/code&gt; (e.g. &lt;code&gt;**/*.test.ts&lt;/code&gt;) instead.&lt;/li&gt;
&lt;li&gt;One concern per rule file. Easier to toggle when debugging odd behaviour.&lt;/li&gt;
&lt;li&gt;Commit &lt;code&gt;.cursor/rules/&lt;/code&gt; so your whole team gets the same behaviour.&lt;/li&gt;
&lt;li&gt;When the agent misbehaves, add one line to a rule rather than repeating yourself in chat.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;

&lt;p&gt;Drop the file in, ask for a small fix, and compare the diff to what you got before. I'd be curious whether it helps on your codebase — tell me in the comments what rule you'd add.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Disclosure: I'm the author of ShipStack's Cursor Rules + Skills Pack, a paid collection of rules like this one (testing, refactors, PR review, etc.). If this one helped, the rest are here: &lt;a href="https://shipstack.sognia.workers.dev/cursor-pack" rel="noopener noreferrer"&gt;https://shipstack.sognia.workers.dev/cursor-pack&lt;/a&gt; — but the rule above is free to use however you like.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>cursor</category>
      <category>ai</category>
      <category>productivity</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
