<?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: Ze Zhang</title>
    <description>The latest articles on DEV Community by Ze Zhang (@zezhang_dev).</description>
    <link>https://dev.to/zezhang_dev</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%2F4180975%2F6c2fd68d-876e-4ed6-8c88-d5207d005b2f.png</url>
      <title>DEV Community: Ze Zhang</title>
      <link>https://dev.to/zezhang_dev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/zezhang_dev"/>
    <language>en</language>
    <item>
      <title>The CLAUDE.md That Finally Made Claude Code Stop Guessing (Free Template)</title>
      <dc:creator>Ze Zhang</dc:creator>
      <pubDate>Tue, 13 Oct 2026 04:29:51 +0000</pubDate>
      <link>https://dev.to/zezhang_dev/the-claudemd-that-finally-made-claude-code-stop-guessing-free-template-2p27</link>
      <guid>https://dev.to/zezhang_dev/the-claudemd-that-finally-made-claude-code-stop-guessing-free-template-2p27</guid>
      <description>&lt;p&gt;Every new Claude Code session starts the same way: a capable new hire with amnesia. It doesn't know how your tests run, which files are off-limits, or that you want a three-line status update, not three paragraphs you have to dig through.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;CLAUDE.md&lt;/code&gt; is the onboarding doc it reads automatically at the start of every session. Get it right and you stop re-explaining your project, stop getting "I assumed you meant..." rework, and stop finding edits in places nobody asked it to touch. Below is what I took away from a big community thread on the topic, a real CLAUDE.md I wrote for a small production app, and a free template you can copy.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Honesty note:&lt;/strong&gt; I did &lt;strong&gt;not&lt;/strong&gt; run a controlled with/without experiment in Claude Code for this post. The CLI wasn't installed in the environment I used. The comparison section is a &lt;em&gt;static&lt;/em&gt; one: what information the agent can get from the repo with and without the file. I'll update this post with real runs later.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Where this comes from
&lt;/h2&gt;

&lt;p&gt;A thread on r/ClaudeAI asked, more or less, "What's the single most useful line in your CLAUDE.md?" It picked up roughly 1.3k upvotes and 185 comments (&lt;a href="https://www.reddit.com/comments/1wu40t8" rel="noopener noreferrer"&gt;thread&lt;/a&gt;). What follows is my own summary of the patterns that kept coming up, not a quote dump.&lt;/p&gt;

&lt;h2&gt;
  
  
  The 6 ideas that kept coming up
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Terse reporting.&lt;/strong&gt; The top idea, roughly: "be extremely concise in reports; sacrifice grammar for brevity." Status updates shrink from paragraphs to a few lines you'll actually read.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;State assumptions and separate evidence from inference.&lt;/strong&gt; Ask it to list its assumptions and to mark what it &lt;em&gt;verified&lt;/em&gt; apart from what it &lt;em&gt;inferred&lt;/em&gt;. A lot of people called this unexpectedly useful.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A stop-loss rule.&lt;/strong&gt; After two failed attempts, stop and explain where you're stuck. Don't try a third time. This keeps it from confidently refactoring itself into a dead end.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;How many questions to ask.&lt;/strong&gt; This was the most debated one. Rough consensus: at most one clarifying question for small tasks. If a mistake is expensive to undo, ask first; if it's cheap, decide and tell me. For big features, write a real spec, or have the agent interview &lt;em&gt;you&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Promote hard rules to hooks.&lt;/strong&gt; Requirements like "always re-read your diff" hold up much better as a hook than as prose.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Point to AGENTS.md.&lt;/strong&gt; Keep shared rules in &lt;code&gt;AGENTS.md&lt;/code&gt; and make CLAUDE.md a single line: &lt;code&gt;@AGENTS.md&lt;/code&gt;. Some say newer versions read AGENTS.md natively; check this against your own version.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Two honorable mentions: hand deterministic work (counting, searching, diffing) to tools instead of letting the model eyeball it, and write these files for compliance and token economy, not for human readability. The joke rules people shared (emoji on every sentence, talking like a TV character) prove the point from the other side: this file really does change behavior.&lt;/p&gt;

&lt;h2&gt;
  
  
  Structure: five sections are enough
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;One-line identity: what the project is and what the stack is&lt;/li&gt;
&lt;li&gt;Commands: install, run, test. This matters most.&lt;/li&gt;
&lt;li&gt;Map: only entry points and anything non-obvious&lt;/li&gt;
&lt;li&gt;Hard rules: things that break production, &lt;em&gt;with reasons&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;Workflow: questions, stop-loss, self-review, report format&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  A real example: StatementCSV
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://statementcsv.spacebit.qzz.io" rel="noopener noreferrer"&gt;StatementCSV&lt;/a&gt; is a small Flask app I run that converts bank statement PDFs to CSV/Excel. It has no database. Here's what went into its CLAUDE.md and why:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Commands:&lt;/strong&gt; "If you touch &lt;code&gt;parser.py&lt;/code&gt;, run &lt;code&gt;scripts/selfcheck.py&lt;/code&gt; and every line must say OK." Without that line the agent can't know the regression script exists. There's no &lt;code&gt;tests/&lt;/code&gt; folder, so it would guess &lt;code&gt;pytest&lt;/code&gt; and fail.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Map:&lt;/strong&gt; &lt;code&gt;parser.py&lt;/code&gt; is the core, and &lt;code&gt;app.py&lt;/code&gt; holds routes and usage counters. This keeps edits in the right file.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hard rules:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;PDFs are processed in memory only and are never written to disk or logs. That's a privacy promise on the site.&lt;/li&gt;
&lt;li&gt;Money is always &lt;code&gt;Decimal&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;If the balance check doesn't reconcile, report it. Never "tune it until it passes."&lt;/li&gt;
&lt;li&gt;Production runs multi-process gunicorn, so shared state needs a lock.&lt;/li&gt;
&lt;li&gt;New public pages must be added to the sitemap.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;None of these are visible from reading the code, and every one is a real trap.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Workflow:&lt;/strong&gt; the four most-upvoted rules from the thread: at most one question, stop after two failures, self-review the diff, terse report.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Before/after (static comparison)
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Task&lt;/th&gt;
&lt;th&gt;Without CLAUDE.md (repo only)&lt;/th&gt;
&lt;th&gt;With CLAUDE.md&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;"Add a test for date parsing"&lt;/td&gt;
&lt;td&gt;No tests dir, so it guesses a framework and likely misses &lt;code&gt;scripts/selfcheck.py&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Extends selfcheck expectations and runs until all OK&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;"Add an FAQ page"&lt;/td&gt;
&lt;td&gt;Probably adds the route only&lt;/td&gt;
&lt;td&gt;Also updates &lt;code&gt;sitemap_xml()&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;"Add logging for debugging"&lt;/td&gt;
&lt;td&gt;Might log uploaded content&lt;/td&gt;
&lt;td&gt;Hard rule forbids PDF content in logs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Reporting&lt;/td&gt;
&lt;td&gt;Long essay&lt;/td&gt;
&lt;td&gt;Three lines: changed / verified how / open issues&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;What I &lt;em&gt;did&lt;/em&gt; run: the project's self-check passes 6/6 (5 sample statements plus 1 scanned PDF correctly flagged as having no text layer). That checks the app, not the agent.&lt;/p&gt;

&lt;p&gt;To do a proper A/B yourself, run the same prompt twice with &lt;code&gt;claude -p "&amp;lt;task&amp;gt;"&lt;/code&gt;, temporarily renaming CLAUDE.md for one run, then compare the diffs and how many back-and-forth turns each took.&lt;/p&gt;

&lt;h2&gt;
  
  
  Common mistakes
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Too long.&lt;/strong&gt; Past about 100 lines the important rules get diluted. Aim for under 40 and push details into subdirectory CLAUDE.md files or &lt;code&gt;@docs/...&lt;/code&gt; imports.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Platitudes.&lt;/strong&gt; "Write clean code" does nothing. Only write what the model can't know by default.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Commands that don't run.&lt;/strong&gt; Verify every one yourself.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Rules without reasons.&lt;/strong&gt; Without the &lt;em&gt;why&lt;/em&gt;, it either over-applies a rule or lawyers around it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Never updating it.&lt;/strong&gt; Every time you correct the agent, ask: should this go in CLAUDE.md?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Secrets.&lt;/strong&gt; CLAUDE.md usually gets committed. Keep credentials out.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Free template
&lt;/h2&gt;

&lt;p&gt;Save this as &lt;code&gt;CLAUDE.md&lt;/code&gt; in your repo root and replace the &lt;code&gt;&amp;lt;...&amp;gt;&lt;/code&gt; parts.&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="gh"&gt;# &amp;lt;Project name&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;One&lt;/span&gt; &lt;span class="na"&gt;line:&lt;/span&gt; &lt;span class="na"&gt;what&lt;/span&gt; &lt;span class="na"&gt;it&lt;/span&gt; &lt;span class="na"&gt;is&lt;/span&gt;&lt;span class="err"&gt;,&lt;/span&gt; &lt;span class="na"&gt;the&lt;/span&gt; &lt;span class="na"&gt;stack&lt;/span&gt;&lt;span class="err"&gt;,&lt;/span&gt; &lt;span class="na"&gt;who&lt;/span&gt; &lt;span class="na"&gt;it&lt;/span&gt;&lt;span class="err"&gt;'&lt;/span&gt;&lt;span class="na"&gt;s&lt;/span&gt; &lt;span class="na"&gt;for&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;

&lt;span class="gu"&gt;## Commands&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; Install: &lt;span class="sb"&gt;`&amp;lt;cmd&amp;gt;`&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; Run: &lt;span class="sb"&gt;`&amp;lt;cmd&amp;gt;`&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; Test (run after every change): &lt;span class="sb"&gt;`&amp;lt;cmd&amp;gt;`&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; Lint/format: &lt;span class="sb"&gt;`&amp;lt;cmd&amp;gt;`&lt;/span&gt;

&lt;span class="gu"&gt;## Structure&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="sb"&gt;`&amp;lt;dir&amp;gt;/`&lt;/span&gt;: &lt;span class="nt"&gt;&amp;lt;what&lt;/span&gt; &lt;span class="na"&gt;lives&lt;/span&gt; &lt;span class="na"&gt;here&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="sb"&gt;`&amp;lt;file&amp;gt;`&lt;/span&gt;: &lt;span class="nt"&gt;&amp;lt;core&lt;/span&gt; &lt;span class="na"&gt;logic&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;

&lt;span class="gu"&gt;## Hard rules (breaking these causes real damage)&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="nt"&gt;&amp;lt;e.g.&lt;/span&gt; &lt;span class="na"&gt;never&lt;/span&gt; &lt;span class="na"&gt;write&lt;/span&gt; &lt;span class="na"&gt;user&lt;/span&gt; &lt;span class="na"&gt;data&lt;/span&gt; &lt;span class="na"&gt;to&lt;/span&gt; &lt;span class="na"&gt;disk&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="nt"&gt;&amp;lt;e.g.&lt;/span&gt; &lt;span class="na"&gt;money&lt;/span&gt; &lt;span class="na"&gt;is&lt;/span&gt; &lt;span class="na"&gt;always&lt;/span&gt; &lt;span class="na"&gt;Decimal&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; Unless explicitly asked: no push, no deploy, don't touch &lt;span class="sb"&gt;`.env`&lt;/span&gt;

&lt;span class="gu"&gt;## Workflow&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; If something is ambiguous, ask at most 1 question; if it's cheap to undo, just do it and tell me
&lt;span class="p"&gt;-&lt;/span&gt; After two failed attempts, stop and explain where you're stuck; don't try a third time
&lt;span class="p"&gt;-&lt;/span&gt; Re-read your own diff before reporting
&lt;span class="p"&gt;-&lt;/span&gt; Report tersely: what changed / how you verified / what's left
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What's the one line in &lt;em&gt;your&lt;/em&gt; CLAUDE.md that earns its keep? I'd like to hear it in the comments.&lt;/p&gt;

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