Skip to content
gentic.news — AI News Intelligence Platform
Connecting to the Living Graph…

Listen to today's AI briefing

Daily podcast — 5 min, AI-narrated summary of top stories

A developer staring at a laptop screen showing a CLAUDE.md file with vague rules crossed out, replaced by specific…
Open SourceScore: 100

Stop Writing Wish Lists: How to Write CLAUDE.md Rules That Survive

Most CLAUDE.md files are wish lists. After a year running a 4000-product store on Claude Code, production rules share three properties: scars, mechanical specificity, and enforcement. Stop writing advice; start writing law.

·1d ago·5 min read··20 views·AI-Generated·Report error
Share:
Source: dev.tovia devto_claudecode, hn_claude_code, reddit_claude, gn_agentic_coding, reddit_claudecodeWidely Reported
How do I write CLAUDE.md rules that Claude Code actually follows in production?

Write CLAUDE.md rules with three properties: every rule has a scar (a dated incident), every rule is mechanically specific (names exact files and numbers), and critical rules are enforced by hooks, not Markdown.

TL;DR

CLAUDE.md rules survive only when they have scars, mechanical specificity, and machine enforcement.

Key Takeaways

  • Most CLAUDE.md files are wish lists.
  • After a year running a 4000-product store on Claude Code, production rules share three properties: scars, mechanical specificity, and enforcement.
  • Stop writing advice; start writing law.

The Uncomfortable Truth About Your CLAUDE.md

Your CLAUDE.md is probably a wish list. "Write clean code." "Always add tests." "Be careful with payments." The model reads them, nods politely, and the third time context gets tight, the wish list loses to whatever the immediate task wants.

After a year of operating a 4,000-product store end-to-end on Claude Code, one developer's instruction files stopped being wishes and became law. The difference isn't better prose. It's three properties.

Property 1: Every Rule Has a Scar

Compare two versions of the same rule:

Version A: "Be careful with bulk posting to social media."

Version B: "NEVER post more than 20–30 times per day to ANY social platform. Mastodon suspended our account after 190 posts in 15 minutes — the API allowed it; the moderators flagged it as spam. API rate limits and moderation policy are different systems."

Version B works. Version A doesn't. The incident supplies the boundary conditions. A model reading Version B knows the number (20–30), the failure mode (moderation, not rate limiting), and why the obvious objection ("but the API allowed it") is wrong. Version A leaves all three to judgment — and judgment under a long context window is exactly what you're trying not to rely on.

Your move: Take your last real incident. Write it as one dated rule with a number in it. Put it where every session reads it. The date matters — it converts an instruction into a precedent.

Property 2: Mechanical Specificity

A rule a model can obey without interpretation looks different from advice. Compare:

  • "No new Date() in sitemap lastmod."
  • "Blog 301s go in blog-redirects.ts, never directly in next.config.ts."
  • "Repo-root scripts/ never deploys; storefront/scripts/ does."

Each names an exact file, an exact function, an exact prohibition. When a rule needs the phrase "use good judgment," it's not finished — keep asking "what exactly went wrong last time?" until the answer names a path and a behavior.

This applies to positive procedure too. One team's definition of done is eight numbered lines. The first three are commands with expected outputs: lint clean, typecheck clean, tests green. Line eight changed behavior most: "Report honestly: failures quoted verbatim, skipped steps named. 'Done' without evidence is a lie."

Blunt language survives context pressure better than polite language. That's an observed fact about long sessions, not a style preference.

Your move: Audit your CLAUDE.md. Find every instance of "be careful," "use good judgment," or "prefer." Replace each with a number, a file path, or a specific prohibition.

Property 3: Enforcement Beats Instruction

The rules that matter most are not really in the Markdown at all — the Markdown documents them, but machinery enforces them. Any commit touching payment, auth, or webhook paths is blocked by a commit-msg hook unless the message carries an explicit acknowledgment that the security checklist was run. The pre-push hook runs a full production build; it cannot be argued with. Marketplace automation has its drip cap and halt-file circuit breaker in the code, so a confused agent cannot spam a platform even if it wants to.

The hierarchy: hooks and fail-closed code > auto-loaded rule files > session memory > logs. Prefer the strongest level that fits. A rule a hook enforces cannot be forgotten, and cannot be rationalized around at 2 a.m. by an agent that is very sure this one time is different.

Your move: Identify your three most critical rules. Add a git hook or CI check that enforces each one. The Markdown documents the rule; the hook enforces it.

The Structure That Emerged

Nobody designs this up front; it accretes. But after a year, a repeatable shape emerged:

  • CLAUDE.md — the operating system: model tiering, decision engine (when to plan, when to spawn a verifier, when to stop and ask), failure laws, definition of done.
  • AGENTS.md — the hard rules with their scars.
  • Path-scoped rule files — load only when relevant paths are touched, keeping token cost sane. The SEO checklist loads for public pages, the trust-boundary gate for payment code.

One habit binds it together: every incident becomes a rule within the hour, at the strongest enforcement level that fits. The incidents that recur are precisely the ones where this loop didn't run.

Try It Now

Start smaller than any of that. Take your last real incident — the deploy that broke checkout, the noindex that erased your traffic, the currency switch that silently dropped payments. Write it as one dated rule with a number in it. Put it in your CLAUDE.md where every session reads it.

That single habit, compounded for a year, is the whole system.


Source: dev.to

Source: gentic.news · · author= · citation.json

AI-assisted reporting. Generated by gentic.news from multiple verified sources, fact-checked against the Living Graph of 4,300+ entities. Edited by Ala SMITH.

Following this story?

Get a weekly digest with AI predictions, trends, and analysis — free.

AI Analysis

**What Claude Code users should do differently:** First, stop treating CLAUDE.md as a style guide. Every rule must answer: "What exactly went wrong last time?" and "What is the exact number, file, or command that prevents it?" Audit your current CLAUDE.md and delete any line that doesn't name a specific path, function, or numerical threshold. Replace vague directives with dated incident descriptions — the date converts an instruction into a precedent that survives context pressure. Second, implement enforcement at the hook level for your top 3-5 rules. Use a pre-commit hook to block commits that touch payment code without a security checklist acknowledgment. Add a pre-push hook that runs a full production build. The goal: make the most critical rules impossible to violate, even by a confident agent at 2 a.m. The Markdown documents the rule; the hook enforces it. Third, adopt the "every incident becomes a rule within the hour" habit. After any production issue, immediately write a dated, mechanically specific rule at the strongest enforcement level that fits. This compounds over time — a year of this habit produces a CLAUDE.md that is law, not a wish list.
This story is part of
Claude Code's Campus Conquest Flips Anthropic's Talent Pipeline, Leaving Google's Academic Edge in Doubt
Viral adoption at MIT and Stanford transforms Claude Code from product into recruiting funnel, threatening Google's long-held research talent dominance

Mentioned in this article

Enjoyed this article?
Share:

AI Toolslive

Five one-click lenses on this article. Cached for 24h.

Pick a tool above to generate an instant lens on this article.

Related Articles

From the lab

The framework underneath this story

Every article on this site sits on top of one engine and one framework — both built by the lab.

More in Open Source

View all