<?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: BG Kim</title>
    <description>The latest articles on DEV Community by BG Kim (@bgprogramming79).</description>
    <link>https://dev.to/bgprogramming79</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%2F4237803%2Fbf2edb7d-2b11-4416-8667-d6d7de475177.png</url>
      <title>DEV Community: BG Kim</title>
      <link>https://dev.to/bgprogramming79</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/bgprogramming79"/>
    <language>en</language>
    <item>
      <title>How to Write CLAUDE.md When Claude Code Breaks Working Code</title>
      <dc:creator>BG Kim</dc:creator>
      <pubDate>Tue, 10 Nov 2026 20:10:42 +0000</pubDate>
      <link>https://dev.to/bgprogramming79/how-to-write-claudemd-when-claude-code-breaks-working-code-117i</link>
      <guid>https://dev.to/bgprogramming79/how-to-write-claudemd-when-claude-code-breaks-working-code-117i</guid>
      <description>&lt;p&gt;Asking Claude Code to build a program is not difficult. But checking whether it built the program as requested, and managing changes so existing features do not break, are separate tasks.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;CLAUDE.md&lt;/code&gt; is a file for writing project rules that AI can refer to. Let’s look at where to put this file and how to use it, with rules from actual files as examples.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why AI can break code that was working
&lt;/h2&gt;

&lt;p&gt;When Claude Code edits existing code, the code already in the project becomes a reference. But if that code is poor quality, AI may carry its problems forward or cover up only the issues that are visible.&lt;/p&gt;

&lt;p&gt;It may also misunderstand a request and change code that was working well. In particular, it is important to structure a program so that changing one feature does not affect another. This is called &lt;strong&gt;modularization&lt;/strong&gt;. If the design is not well planned, changing one feature can also change other features or code.&lt;/p&gt;

&lt;p&gt;The impact of a problem also differs between a program someone uses alone and a service that handles money. Even when AI writes the code, people are responsible for checking the result.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbh1m02u0hhp2ivojapt2.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbh1m02u0hhp2ivojapt2.jpg" alt="A screen comparing the existing code with the modified code"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What is CLAUDE.md, and where should it go?
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;CLAUDE.md&lt;/code&gt; is a project rules file that Claude Code refers to when working in that folder. The video explains that you can think of it as a prompt or set of instructions. The project rules in this file remain in place even when you start a new conversation.&lt;/p&gt;

&lt;p&gt;You can put rules in different folders, separating rules for the whole project from rules for specific tasks. For example, you can put shared rules in the top-level folder, and put server and client rules in their respective folders. Depending on where you work, Claude Code refers to both the top-level rules and the rules in that folder.&lt;/p&gt;

&lt;p&gt;The actual Union project has this folder structure. Union consists of a Node server, a React web client, and an Android app.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CLAUDE.md                  ← Shared coding rules
server/CLAUDE.md           ← Server rules
client/web/CLAUDE.md       ← Web rules
client/android/CLAUDE.md   ← Android rules
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;CLAUDE.md&lt;/code&gt; contains shared coding rules that apply to the whole project.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;server/CLAUDE.md&lt;/code&gt; contains rules for the server.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;client/web/CLAUDE.md&lt;/code&gt; contains rules for the web client.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;client/android/CLAUDE.md&lt;/code&gt; contains rules for the Android app.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F9zjxcf96r06hmzhx7bg3.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F9zjxcf96r06hmzhx7bg3.jpg" alt="The CLAUDE.md folder structure in the Union project"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Include the reason for each rule
&lt;/h2&gt;

&lt;p&gt;It is better to explain why a rule is needed, rather than listing the rule alone. In the video, the reason for adding commas and the won symbol to prices is to make them appear in the same format as on the menu. Knowing the reason gives you a basis for applying the rule in new situations.&lt;/p&gt;

&lt;p&gt;The top-level &lt;code&gt;CLAUDE.md&lt;/code&gt; has a rule to keep the direction of comparison operators consistent when comparing numbers.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Number comparisons: Use only &lt;code&gt;&amp;lt;&lt;/code&gt; and &lt;code&gt;&amp;lt;=&lt;/code&gt; for comparison operators (&lt;code&gt;&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;gt;=&lt;/code&gt; are not allowed). Always put the smaller number on the left and the larger number on the right (min &amp;lt; max). For a range, use &lt;code&gt;min &amp;lt;= x &amp;amp;&amp;amp; x &amp;lt;= max&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The file also explains why. If the comparison operators point in different directions, you have to check the direction each time you read the code, which can lead to mistakes. Using one direction consistently can reduce the chance of errors.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbvxvnh9lhs6zwfd0h7mb.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbvxvnh9lhs6zwfd0h7mb.jpg" alt="The number comparison rule in the top-level CLAUDE.md"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  You still need to check the rules yourself
&lt;/h2&gt;

&lt;p&gt;Writing a rule in &lt;code&gt;CLAUDE.md&lt;/code&gt; does not mean AI will always follow it. You should allow for the possibility that it may ignore the rule. For areas where bugs must not occur, you can ask another AI to check the work or use a verification program.&lt;/p&gt;

&lt;p&gt;The fact that Claude Code created a file does not mean the result is what you wanted. Check the screen and behavior yourself, and ask for changes where needed. The process requires making a request, checking the result, fixing it, reverting changes, and recording rules.&lt;/p&gt;

&lt;p&gt;When you write rules in CLAUDE.md, do you also document why each rule is needed?&lt;/p&gt;




&lt;p&gt;&lt;em&gt;This article is a summary of my Korean YouTube video below, translated into English with AI and reviewed by me. #ABotWroteThis&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Previous video: &lt;a href="https://youtu.be/b2Lnz6E6lKM" rel="noopener noreferrer"&gt;Why the Same Claude Code Can Produce Different Results&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/B_EVfrK-ptk" width="710" height="399"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;

</description>
      <category>claudecode</category>
      <category>ai</category>
      <category>programming</category>
      <category>architecture</category>
    </item>
  </channel>
</rss>
