CLAUDE.md Files

CLAUDE.md Files

CLAUDE.md files are files that you write which will be loaded into every new context at the system prompt level. Claude files are scoped at different levels:

Load order:

Running /init will have Claude scan your project and create a CLAUDE.md file for you — it searches for patterns, reads files, and once it has enough context, writes the CLAUDE.md file (opening it as a diff you can accept/reject: Yes / Yes, allow all edits during this session (shift+tab) / No).

Claude files are context and not enforced configuration. How you write your instructions determines how reliably Claude follows them.

claudeMdExcludes is used to prevent specific CLAUDE.md files from being loaded. In large monorepos you want to use this setting to ignore legacy or useless Claude files (in .claude/settings.local.json):

{
  "claudeMdExcludes": [
    "**/monorepo/CLAUDE.md",
    "/home/user/monorepo/other-team/.claude/rules/**"
  ]
}

You can break up your CLAUDE.md into import files:

Example:

# My Project
A full-stack SaaS application built with Next.js, Postgres, and TypeScript.

## Structure
@.claude/architecture.md
@.claude/conventions.md

## Frontend
@src/components/CLAUDE.md
@src/app/CLAUDE.md

## Backend
@src/api/CLAUDE.md
@src/db/CLAUDE.md

## Tooling & Workflow
@.claude/testing.md
@.claude/git-conventions.md
@.claude/deployment.md

## Third-Party Integrations
@.claude/integrations/stripe.md
@.claude/integrations/resend.md
@.claude/integrations/sentry.md

Related: Persistent Context, Claude Rules, Top Level CLAUDE.md, Auto Memory, Settings