OmniscioGuidesCLAUDE.md examples
CLAUDE.md examples for four stacks
A CLAUDE.md is worth writing the first time you retype a correction you typed last week. Anthropic's own framing is that the file is where you write down what you would otherwise re-explain.
That makes it a short file with a narrow job: build commands, conventions, project layout and the rules that always apply. The four example files on this site are complete and copyable, and each one explains why a block is there so you can cut the ones that are not.
- What every good file has in common, before you pick a stack.
- The four examples, and what each one covers.
- The rules they all follow, straight from Anthropic's documentation.
- What to leave out, including the lines people add and regret.
- How to adapt one to your repository.
Checked against Anthropic's Claude Code documentation on November 25, 2026. By the Omniscio team. Updated .
The shape every one of these files shares
Strip the stack out and the four examples are the same document. They answer five questions in the order a person joining the repository would ask them, and nothing else survives the cut.
- What this is, and what runs it. One line naming the project, the language version and the package manager. It is the cheapest orientation Claude can get, and it settles which commands below are real.
- The commands. Install, run, test, and the lint or type check that has to pass. Anthropic's rule is that these are facts Claude should hold in every session.
- The layout. Only the directories whose names do not explain them. A tree of the whole repository is a common way a file passes 200 lines without adding anything.
- The rules that always apply. The conventions a reviewer would flag: where errors are raised, how dependencies arrive, what never appears in a commit.
- The traps. The generated file nobody should edit, the migration that cannot be rewritten, the test that has to use a real database. This section is the one that pays for the file.
The length follows from that list rather than the other way round. Anthropic's target is under 200 lines, grouped under Markdown headers and bullets rather than written as prose, because organized sections are easier for Claude to follow.
The four example files
Each page carries one complete file, the reasoning for each block, and the traps that are specific to that stack. Pick the one closest to your repository; the differences between them are smaller than the structure they share.
- CLAUDE.md for Python covers a service built with uv, ruff, mypy and pytest: the
srclayout, async boundaries, where exceptions are raised, and whyuv.lockis never hand-edited. - CLAUDE.md for Java covers a Spring Boot service on Gradle: constructor injection, records as DTOs, where
@Transactionalbelongs, and Flyway migrations that are append-only. - CLAUDE.md for TypeScript covers a Next.js App Router project: server components by default, where
"use client"goes, strict typing with noany, and route handlers that return a real response. - CLAUDE.md for Go covers a service on the standard library:
cmd/andinternal/, error wrapping with%w, context as the first parameter, and goroutines that always have an owner.
Each file is between 52 and 56 lines, inside Anthropic's 200-line target with room to spare.
Each one also keeps its rules to things a reviewer could check in a diff, which is the shape Anthropic asks for.
Why these four stacks
They cover the four shapes a repository usually takes: a Python service, a JVM service, a TypeScript web app, and a Go service. The same skeleton works for a Django app, a .NET solution, a Vue project or a Rust workspace, and each page has an adaptation section naming the lines to change rather than asking you to start from an empty file.
The rules the examples follow, and where they come from
Anthropic is direct about what a CLAUDE.md is: your instruction file arrives as a user message after the system prompt, Claude reads it and tries to follow it, and there is no guarantee of strict compliance. Everything below follows from that one sentence.
Concrete beats correct
The documentation asks for instructions concrete enough to verify, and gives the pairs to compare: "Use 2-space indentation" rather than "Format code properly", and "Run npm test before committing" rather than "Test your changes". A rule you cannot check in a diff is a wish, and wishes are the part of a CLAUDE.md that gets skipped.
One fact, one place
If two files give different guidance for the same behaviour, Anthropic says Claude may pick one arbitrarily. That is why none of these examples repeats a rule that already lives in another file, and why a stale copy of a rule is the one kind of duplication that actively misleads.
The must-hold rules do not live here
A rule that has to run at a fixed point, such as before every commit or after each file edit, belongs in a hook. Hooks execute as shell commands at fixed lifecycle events and apply regardless of what Claude decides to do, which is the opposite of a sentence in a file.
The other place for the long, narrow rules is a path-scoped rule: a Markdown file under .claude/rules/ with paths frontmatter, which loads only when Claude works with matching files. It costs nothing on a session that never touches those files.
Both mechanisms have their own guides: Claude Code hooks for the enforcement, and where CLAUDE.md lives and what loads for the scopes and the size limits behind this page.
What to leave out
Most poor CLAUDE.md files are not badly written. In our experience they contain things that belong somewhere else, and you pay for them in context on every session.
- Anything Claude can read for itself. The full directory tree, the dependency list, the framework's own conventions. Anthropic's guidance is to keep the file to what Claude should hold in every session, not to what it can discover.
- A multi-step procedure. A release checklist or a migration runbook is a skill, invoked when it is needed, rather than context paid for on every turn.
- Rules that matter to one part of the codebase. Those go in a path-scoped rule, which loads only when Claude touches a matching file.
- Your personal setup. Sandbox URLs and test accounts belong in
CLAUDE.local.md, which you add to.gitignore, so a teammate does not inherit a hostname that only resolves on your machine. - Encouragement. "Be careful", "think hard", "write clean code". None of it is checkable, and all of it spends context.
Adapting an example to your repo
Copying a file is the easy part. These five steps turn a template into a file that is true of your repository.
- Open the example closest to your stack and copy the block into
./CLAUDE.mdor./.claude/CLAUDE.md. Either path works, and the project file is committed with the code. - Replace the command block with the four commands you actually run, copied out of your README or your CI file rather than remembered.
- Delete every directory line your repository does not have, and add the one or two that surprise newcomers.
- Keep only the rules a reviewer has already asked for in a pull request. A rule nobody has ever enforced is a guess.
- Run
/context allin a session from your project root and check the file is listed under Memory files. If it is missing there, Claude cannot see it, and no amount of editing the text will help.
When a second person joins, the file gets its second test: ask them to follow it without asking you anything. Every question they have to ask is a line that is missing.
How this page was written
Everything here about what belongs in a CLAUDE.md, how long it should be and how Claude treats it was read from Anthropic's Claude Code memory documentation on November 25, 2026, quoted from the documentation as it reads today. The guidance on hooks and on path-scoped rules comes from that same page, and the Sources below name it.
The four example files were written for this site. Their line counts were measured on the source files on the same day, and each stack page's own ledger records the tool documentation its claims rest on.
Each stack page keeps Anthropic's guidance apart from the tool's own documentation, and each one says plainly that its example file was not run against a live repository. We did not measure whether one of these files improves a particular repository's output, and the pages do not claim it.
Sources
- Anthropic's How Claude remembers your project, for what belongs in a CLAUDE.md, the 200-line target, the "concrete enough to verify" examples, the conflict rule and the hooks guidance, read November 25, 2026.
- Anthropic's guide to rules and path-scoped rules, for how a rule with
pathsfrontmatter loads, read November 25, 2026. - The four example pages on this site, for the files themselves: Python, Java, TypeScript and Go.
Common questions
What should a CLAUDE.md contain?
The things Claude cannot work out from the code: the build and test commands, the layout that is not obvious, the conventions your team enforces, and the traps that have already cost somebody a day. Anthropic's guidance is to treat the file as the place you write down what you would otherwise re-explain, and to keep it to facts Claude should hold in every session.
How long should a CLAUDE.md be?
Anthropic's target is under 200 lines, because longer files consume more context and reduce adherence. When a file grows past that, the fix is not a shorter file but a smaller one: move instructions that matter for only part of the codebase into a path-scoped rule, which loads only when Claude works with matching files.
Can I copy one of these files as it is?
Start from one, then delete every line that is not true of your repository today. In our experience a copied file that describes a layout you do not have does more harm than no file: the commands fail and the paths lead nowhere. Every command in the file should be one you can run from your project root right now.
Where does the file go?
A project file lives at ./CLAUDE.md or ./.claude/CLAUDE.md and is committed, so everyone on the team reads the same instructions. Anything personal, such as your sandbox URL or a test account, belongs in ./CLAUDE.local.md, which you add to .gitignore. The user-level file at ~/.claude/CLAUDE.md applies to every project you open.
Is there an example for my stack?
There are four here: Python, Java with Spring Boot, TypeScript with Next.js, and Go. The structure transfers to any stack, because it follows the same five questions: what it is, how to run it, where the code lives, what every change must obey, and what has bitten us before.
Does Claude always follow a CLAUDE.md?
No. Anthropic delivers the file as a user message after the system prompt, and Claude reads it and tries to follow it, with no guarantee of strict compliance, especially for vague or conflicting instructions. A rule that must hold every time belongs in a hook, which runs as a shell command at a fixed lifecycle event regardless of what Claude decides.
One instructions file, every agent that reads one
Omniscio keeps your canonical CLAUDE.md or AGENTS.md mirrored to the filenames Codex, Gemini, Cursor and Copilot look for, with drift detection and a conflict resolver. Any model, any harness.
The features page covers what else it does, pricing covers the plans, and you can download it for Windows, macOS or Linux.