$ man context-wiki/claude-md
Code and Automationbeginner
CLAUDE.md
The onboarding doc your AI teammate reads before every session
What CLAUDE.md Does
The CLAUDE.md file lives in your project root. It is the first thing Claude reads when it starts a session. Think of it as the onboarding doc for your AI teammate. Before Claude reads any other file, before it processes your prompt, before it looks at your code, it reads CLAUDE.md. That makes it the highest-priority context in your entire system. Whatever you put here shapes every interaction that follows.
PATTERN
The Configuration Hierarchy
There are three layers of AI configuration, and they load in order.
CLAUDE.md loads first. Environment defaults, package management rules, code style preferences, language defaults. This is the foundation. It applies to every session regardless of what you are working on.
Skills load when invoked. When you type /deploy, the deploy skill file loads into context. When you type /tracker, the tracker skill loads. Skills are workflow-specific. They do not load unless you trigger them.
Rules load when you touch matching files. If you open a blog post, the blog formatting rule loads. If you edit a component, the component pattern rule loads. Rules are file-specific. They activate based on what you are editing.
The hierarchy matters. CLAUDE.md sets the baseline. Skills add workflow context. Rules add file-specific context. Together they give Claude a complete picture without you explaining anything.
PRO TIP
What Goes in CLAUDE.md
Keep CLAUDE.md focused on things that apply to EVERY session. Environment details: OS, shell, primary languages. Package management rules: how to install, how to handle permissions, how to verify versions. Code style defaults: TypeScript over JavaScript, formatting preferences, import conventions.
Do NOT put workflow-specific instructions in CLAUDE.md. Those belong in skill files. Do NOT put file-specific patterns in CLAUDE.md. Those belong in rules files. CLAUDE.md should be short and universal. If a rule only applies sometimes, it does not belong here.
My CLAUDE.md is a few paragraphs. Environment info. Package management rules. Language defaults. That is it. Everything else lives in skills and rules where it can load on demand instead of consuming context window space every session.
ANTI-PATTERN
Common Mistake: Overloading CLAUDE.md
I have seen people put entire workflow documentation, coding standards, style guides, and project architecture into CLAUDE.md. The file becomes 500+ lines. The problem: Claude reads all of it every session, even when 90% is irrelevant to the current task. That wastes context window space and can actually confuse the model when instructions for different workflows contradict each other.
Keep CLAUDE.md lean. Universal defaults only. Move everything else to skills (for workflows) and rules (for file patterns). This way Claude gets exactly the context it needs for the current task, not a firehose of everything you have ever documented.
knowledge guide
related entries