Features

CLAUDE.md

A project instructions file that is read every session.

CLAUDE.md is a Markdown file that Claude Code reads at the start of every session. You use it to write down things you would otherwise explain again and again: build commands, coding rules, folder layout.

From actually using it

When this site was revamped, the project already had a .claude/CLAUDE.md. It contained older rules, such as "create Korean and English routes in pairs" and blog tone rules. As the site changed direction, the new sections became Korean-only, and some of those rules no longer fit. It was a case that showed CLAUDE.md is not a write-once file. It needs to be updated when the project changes direction.

How it works

Claude Code starts each new session with an empty context. CLAUDE.md is the set of instructions that goes into that context from the start. The official docs describe the file as context, not as enforced configuration. The more specific and short the instructions, the more consistently Claude follows them.

CLAUDE.md files in the current working directory and its parent directories are all read at startup and concatenated, ordered from the filesystem root down toward the working directory. A CLAUDE.md in a subdirectory is not loaded at startup. It loads when Claude reads or edits files in that directory.

  • Project: ./CLAUDE.md or ./.claude/CLAUDE.md (shared with the team, checked into version control)
  • Personal, all projects: ~/.claude/CLAUDE.md (applies to every project)
  • Personal, one project: ./CLAUDE.local.md (the official docs say to add it to .gitignore)
  • Organization policy: a managed CLAUDE.md placed in an OS-specific admin location

What to include and what to leave out

The docs use one test: add it if you keep explaining it again. Good moments to add a line are when Claude makes the same mistake twice, when a code review points out a codebase rule Claude missed, or when you are typing the same correction you used last session.

Good candidates are build and test commands, coding rules, project structure, and "always do X" rules. For multi-step procedures, or content that applies to only part of the codebase, the docs suggest moving it to a skill or to path-specific rules (.claude/rules/).

Write sentences you can verify. Instead of "keep the code clean," write "use 2-space indentation," "run npm test before committing," or "API handlers live in src/api/handlers/."

# Build and test
- Dev server: npm run dev
- Run npm test and npm run lint before committing

# Rules
- Use 2-space indentation
- API handlers live in src/api/handlers/

# Reference
See @README.md for project overview

Length and structure

The official recommendation is to aim for under 200 lines per file. Longer files use more context and get followed less closely. Group related instructions under headings and bullets, and prune contradictory instructions regularly. The docs note that when instructions conflict, Claude may pick one arbitrarily.

You can pull in other files with the @path syntax. Relative paths resolve relative to the file that contains the import, and imported files can import others up to four levels deep. Imported files still load into context along with the rest, so imports help organization but do not reduce context use. To mention a path in plain text without importing it, wrap it in backticks.

Block-level HTML comments (<!-- note -->) are stripped before the content is passed to Claude. You can leave notes for humans without spending tokens on them.

How it relates to nearby features

  • /init: generates a CLAUDE.md draft. If one already exists, it suggests improvements instead of overwriting it.
  • /memory: opens CLAUDE.md and auto memory for editing, and turns auto memory on or off.
  • Auto memory: CLAUDE.md holds instructions you write. Auto memory holds notes Claude writes for itself from your corrections.
  • /context: check the Memory files list to see what was loaded. If a file is not listed, Claude cannot see it.
  • AGENTS.md: read by default only when there is no CLAUDE.md. To use both, import it from CLAUDE.md with @AGENTS.md.
  • After /compact: the project-root CLAUDE.md is re-injected from disk. Instructions you only gave in conversation may be lost.

Real examples

You opened a new project and Claude asks for the test command every time

Create CLAUDE.md in the project root with "# Build and test / Run npm test before committing", then run /context in a new session

The Memory files list in the /context output shows that CLAUDE.md. If it appears, it is loaded, and from the next session on you do not have to repeat the explanation.

A CLAUDE.md over 200 lines takes up context in every conversation, and some rules get ignored

Move the PR review and database migration procedures out of CLAUDE.md into skills, split the frontend rules into files under .claude/rules/, and keep only the shared rules in CLAUDE.md

Less is loaded at startup. Skills load only when invoked, and path-specific rules load only when Claude works on matching files. The remaining rules are noticeably shorter, so they are more likely to be followed.

You have personal settings, such as your local dev server address, that you do not want in the team repository

Create CLAUDE.local.md in the project root with your personal address, and add CLAUDE.local.md to .gitignore

It is read together with CLAUDE.md but never committed, so it works as instructions only you use.

Common mistakes and when not to use it

  • Trying to write everything down. The longer the file, the higher the context cost and the lower the compliance. Past roughly 200 lines, split it into skills or path-specific rules.
  • Vague sentences like "keep it clean" or "do it well." Rewrite them as things you can check.
  • Treating CLAUDE.md as enforcement. The official docs say it is context, not enforced configuration. If a behavior must be blocked, use a PreToolUse hook or permission settings.
  • Thinking @imports solve the length problem. Imported files load into context too.
  • Leaving old rules in place after the project changes direction. Claude may pick one of two conflicting instructions arbitrarily.

FAQ

Where should I create CLAUDE.md?

For project instructions shared with your team, use CLAUDE.md or .claude/CLAUDE.md in the project root. For personal instructions that apply to every project, use ~/.claude/CLAUDE.md. For personal instructions you do not want in the repository, use CLAUDE.local.md.

Is there a length limit for CLAUDE.md?

It is a recommendation, not a hard limit. The official docs say to aim for under 200 lines per file. Longer files use more context and get followed less closely.

I edited CLAUDE.md but the change does not seem to apply.

Run /context and check whether the file appears in the Memory files list. If it is not listed, Claude did not read it. You can open the file with /memory to check its location and contents.

If I have an AGENTS.md, do I still need a CLAUDE.md?

If there is no CLAUDE.md in the working directory or its parents, Claude reads AGENTS.md by default. If any CLAUDE.md exists, only CLAUDE.md is read, so to use both, import AGENTS.md from inside CLAUDE.md. This behavior is supported in relatively recent versions (v2.1.277 or later).

Checked against the official docs on 2026-10-30. Sources: Claude Code docs: How Claude remembers your project, Claude Code docs: Explore the context window, Claude Code docs: Manage costs effectively. How we write

Usage

프로젝트 루트에 CLAUDE.md 작성

When to use it

When you want to lock in coding rules and build commands.

Related

/initCreates a CLAUDE.md file for your project.Claude CodeCommands/memoryEdits CLAUDE.md, turns auto memory on or off, and shows what has been recorded.Claude CodeCommandsauto memoryClaude notes your corrections and preferences on its own and uses them in later sessions.Claude CodeFeatures

More Claude Code features

auto memoryClaude notes your corrections and preferences on its own and uses them in later sessions.FeaturesSkills (.claude/skills/name/SKILL.md)A bundle of instructions and materials that is invoked automatically when needed or with /name.FeaturesNew 2026-01Subagents (.claude/agents/*.md)Helper agents with their own context, tools and prompt.Featuresagent viewShows all sessions (running, waiting, finished) in one list and lets you send tasks in parallel.FeaturesNew 2026-05Background sessions (claude --bg)Runs a session in the background and lets you attach to it later. It has attach, logs and stop subcommands.FeaturesNew 2026-05Dynamic workflow / ultracodeCoordinates dozens to hundreds of agents in the background. Include ultracode in your prompt to start it.FeaturesNew 2026-05
All Claude Code