<?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: Robert Walaski</title>
    <description>The latest articles on DEV Community by Robert Walaski (@robertwalaski).</description>
    <link>https://dev.to/robertwalaski</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%2F4182970%2F93ff33ed-a912-468e-a418-232c67ac40c2.jpg</url>
      <title>DEV Community: Robert Walaski</title>
      <link>https://dev.to/robertwalaski</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/robertwalaski"/>
    <language>en</language>
    <item>
      <title>The 4 rules in my CLAUDE.md that fixed most of my bad Claude Code sessions</title>
      <dc:creator>Robert Walaski</dc:creator>
      <pubDate>Tue, 13 Oct 2026 19:11:29 +0000</pubDate>
      <link>https://dev.to/robertwalaski/the-4-rules-in-my-claudemd-that-fixed-most-of-my-bad-claude-code-sessions-468i</link>
      <guid>https://dev.to/robertwalaski/the-4-rules-in-my-claudemd-that-fixed-most-of-my-bad-claude-code-sessions-468i</guid>
      <description>&lt;p&gt;Claude Code is amazing for about a week. Then it refactors a file you didn't ask it to touch, over-engineers a five-line fix, or proudly announces "done" for something that doesn't work.&lt;/p&gt;

&lt;p&gt;I use it daily on client projects, and almost every one of those moments traced back to a single idea:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The agent only knows what's in its context window right now.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Not what it "learned" yesterday. Not your team's conventions. If it isn't in the context, it doesn't exist. So the job isn't "prompting" - it's deciding what goes into the context and what stays out.&lt;/p&gt;

&lt;p&gt;The cheapest, highest-impact place to start is your global &lt;code&gt;~/.claude/CLAUDE.md&lt;/code&gt;. Here are the four rules I put there.&lt;/p&gt;

&lt;h2&gt;
  
  
  Rule 1 - Think before coding
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;No silent assumptions. State what you're assuming. Surface tradeoffs.
Ask before guessing. Push back when a simpler approach exists.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Prevents the confident wrong turn: 300 lines built on an assumption you'd have corrected in five seconds.&lt;/p&gt;

&lt;h2&gt;
  
  
  Rule 2 - Simplicity first
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Minimum code that solves the problem. No speculative features. No
abstractions for single-use code. If a senior engineer would call it
overcomplicated - simplify.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Prevents the "enterprise" reflex: interfaces with one implementation, config options nobody asked for.&lt;/p&gt;

&lt;h2&gt;
  
  
  Rule 3 - Surgical changes
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Touch only what you must. Don't "improve" adjacent code, comments, or
formatting. Don't refactor what isn't broken. Match existing style.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The one that made my reviews roughly twice as fast. The diff is finally just the task.&lt;/p&gt;

&lt;h2&gt;
  
  
  Rule 4 - Goal-driven execution
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Define success criteria. Loop until verified.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;"Write the code" becomes "make this test pass, then verify it in the browser". It stops declaring victory early.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why these work: constraints, not wishes
&lt;/h2&gt;

&lt;p&gt;Most CLAUDE.md files are full of wishes: &lt;em&gt;"Write clean, maintainable code following best practices."&lt;/em&gt; The model already thinks it does that. The sentence changes nothing.&lt;/p&gt;

&lt;p&gt;A constraint is specific and checkable - by you and by the model. Add a &lt;strong&gt;reason&lt;/strong&gt; and it becomes even stronger: the agent can apply the rule to situations you never listed, instead of dropping it under pressure.&lt;/p&gt;

&lt;h2&gt;
  
  
  Keep it short
&lt;/h2&gt;

&lt;p&gt;Every line in CLAUDE.md is paid for in every session. My budget: under ~60 lines globally, under ~150 per project. Anything that's a procedure ("to release, first do X, then Y...") belongs in a skill, which only loads when needed.&lt;/p&gt;

&lt;p&gt;And whenever the agent makes a mistake a reasonable newcomer would also make, add one line to a &lt;strong&gt;Gotchas&lt;/strong&gt; section in the project file. Over months it becomes the most valuable document in the repo.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;This is adapted from chapter 2 of my **Claude Code Field Manual&lt;/em&gt;* - 12 chapters on CLAUDE.md, permissions, skills, subagents, hooks and git flow, with every template as a copy-paste file.*&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;em&gt;Free sample (chapters 1-2): &lt;a href="https://robertwalaski.gumroad.com/l/claude-code-field-manual-free" rel="noopener noreferrer"&gt;https://robertwalaski.gumroad.com/l/claude-code-field-manual-free&lt;/a&gt;&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Full manual + templates: &lt;a href="https://robertwalaski.gumroad.com/l/claude-code-field-manual" rel="noopener noreferrer"&gt;https://robertwalaski.gumroad.com/l/claude-code-field-manual&lt;/a&gt;&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>ai</category>
      <category>productivity</category>
      <category>claude</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
