CertSafari
    Anthropic Claude Certified Architect – Professional (CCAR-P)· Lessons

    Domain 6 · Lesson 34/38

    CLAUDE.md as implementation guidance

    Document architectures and provide implementation guidance

    8 min read
    2.8% of exam
    5 sources
    Published 19 Oct 2026
    Docs as of 14 Oct 2026

    What you will be able to do

    • Decide what belongs in a CLAUDE.md and what to leave out
    • Place guidance at the right scope: managed, user, project, local, subdirectory or path-scoped rule
    • Keep CLAUDE.md accurate as the code, conventions and models change

    1.What CLAUDE.md should contain

    CLAUDE.md is the implementation guidance Claude Code reads for itself. It is a plain markdown file that Claude reads automatically at the start of every session in that directory. You never attach it or mention it in a prompt. Think of it as the briefing you would give a capable new teammate on their first morning: how the team works, what to avoid, and where the important pieces live.

    The test for every line is whether Claude could work it out from the code alone. Bash commands it can't guess, style rules that differ from the defaults, and architectural decisions specific to the project all earn a place. File-by-file descriptions and standard conventions do not. Instructions should also be concrete enough to check. "Use 2-space indentation" can be followed, and "Format code properly" cannot.

    What to include in CLAUDE.md and what to leave out
    IncludeLeave out
    Bash commands Claude can't guessAnything Claude can figure out by reading code
    Code style rules that differ from defaultsStandard language conventions Claude already knows
    Testing instructions and preferred test runnersDetailed API documentation (link to docs instead)
    Architectural decisions specific to your projectInformation that changes frequently
    Developer environment quirks (required env vars)File-by-file descriptions of the codebase
    Common gotchas or behaviors that aren't self-evidentSelf-evident practices like "write clean code"
    A compact CLAUDE.md: related instructions grouped under headersmarkdown
    # Code style
    - Use ES modules (import/export) syntax, not CommonJS (require)
    - Destructure imports when possible (eg. import { foo } from 'bar')
    
    # Workflow
    - Be sure to typecheck when you're done making a series of code changes
    - Prefer running single tests, and not the whole test suite, for performance

    Two more items are easy to get wrong. Hard constraints, such as never writing to the production database from tests, belong in the file. Aspirational rules the team does not actually follow do not, because Claude will follow them even though the team doesn't.

    Checkpoint 1 of 3· Check yourself

    A team is drafting the project CLAUDE.md for a new repository. Which of these candidate lines belongs in the file?

    Sources123

    2.Choosing the scope for each instruction

    CLAUDE.md files exist at several scopes, and Claude merges them from broad to specific. Put each instruction at the narrowest scope that still reaches everyone who needs it. Team conventions go in the project file, committed to source control. Personal habits go in the user file, and sandbox URLs go in CLAUDE.local.md.

    CLAUDE.md scopes and what each is for
    ScopeLocationUse forShared with
    Managed policy/etc/claude-code/CLAUDE.md (Linux and WSL)Company coding standards, security policies, compliance requirementsAll users in organization
    User instructions~/.claude/CLAUDE.mdCode styling preferences, personal tooling shortcutsOnly you (all projects)
    Project instructions./CLAUDE.md or ./.claude/CLAUDE.mdProject architecture, coding standards, common workflowsTeam members via source control
    Local instructions./CLAUDE.local.mdYour sandbox URLs, preferred test dataOnly you (current project)

    Timing matters as much as location. Files at and above the working directory load when the session starts. A subdirectory's CLAUDE.md loads only later, when Claude reads files in that subdirectory. In a monorepo, that makes the root file the place for rules that apply everywhere, such as commit conventions, and each package's own file the place for its stack.

    Conventions for one area can live in two places. A per-directory CLAUDE.md sits next to the code, so its owners maintain it and it is versioned with that code. A path-scoped rule lives in .claude/rules/ at the root, with a paths: glob, and loads only when Claude works with a matching file. It is the better choice when you want every convention in one place, or when one rule covers many scattered paths. To keep another team's files out of a session, use claudeMdExcludes.

    Excluding one package's CLAUDE.md and rules from loadingjson
    {
      "claudeMdExcludes": [
        "**/packages/web/**"
      ]
    }

    A CLAUDE.md can also import other files. Writing @ followed by a path, as in - git workflow @docs/git-instructions.md, makes Claude load that file at launch along with the main one. Imports are a way to split a long file into pieces, which raises the question of whether the pieces cost less.

    Checkpoint 2 of 3· Match them up

    An architect is deciding where each of these instructions should live. Match each CLAUDE.md location to the instruction that belongs there.

    Tap a term, then the definition that fits it.

    Sources4135

    3.Keeping CLAUDE.md accurate

    A stale CLAUDE.md does more harm than having none, because Claude follows it with confidence. Running /init gives you a first draft: Claude explores the codebase and writes up build commands, test commands, a structure overview and the conventions it detects. Someone still has to review that draft, delete anything inaccurate and commit it. Keep the file under about 200 lines. Longer files use more context and Claude follows them less reliably.

    Several triggers should prompt an edit:

    • Claude gets the same thing wrong twice, which means a rule is missing, so add one line.
    • Conventions change, for example a new framework, test runner or set of lint rules.
    • A major model release lands, because rules that worked around an older model's limitation may now be overhead.
    • A quarterly skim turns up stale lines, which should be deleted.

    Contradictions are the quiet failure. When two instructions conflict, Claude may pick either one, so periodically review the root file, nested CLAUDE.md files and .claude/rules/ together. Treat CLAUDE.md edits like any other documentation change and review them in pull requests, so conventions keep up with the code. A Stop hook receives the session transcript path when Claude finishes responding, so a script can propose updates while the gap is still fresh.

    An edit made mid-session does not take effect straight away. Claude doesn't re-read the file from disk each turn, so a change is picked up only after /compact, after opening the file through /memory, or in the next session.

    Checkpoint 3 of 3· Check yourself

    Partway through a Claude Code session, a developer adds the line "Never edit a migration after it has merged" to the project CLAUDE.md and saves the file. On the next turn, Claude edits a merged migration anyway. What explains this, and what will make the new rule apply?

    Sources314

    Practise it for real

    Create a reviewed project CLAUDE.md and scope one area's conventions so they load only where needed.

    1. 1.In a repository, run /init.

      Why: Claude explores the codebase and drafts build commands, test commands, a structure overview and the conventions it detects.

      You should see: A draft CLAUDE.md at the project root.

    2. 2.Review the draft. Delete anything Claude could infer from the code, any file-by-file descriptions, and anything inaccurate.

      Why: Every line costs context, and inaccurate or obvious lines lower adherence.

      You should see: A file well under 200 lines, grouped under markdown headers.

    3. 3.Move instructions that only apply to one area (for example API handlers) into a file under .claude/rules/ with a paths: glob.

      Why: Path-scoped rules load only when Claude works with matching files.

      You should see: The root file gets shorter, and the rule applies only when Claude touches files that match the glob.

    4. 4.Commit CLAUDE.md and .claude/rules/ so changes go through pull-request review.

      Why: Reviewing edits like any other documentation keeps conventions in step with the code.

      You should see: Teammates who clone the repository get the same guidance.

    Stuck? Get a nudge

    If Claude ignores an edit you just made, run /compact or open the file through /memory. Mid-session edits aren't picked up until you do.

    Sources

    (5)

    Every claim above is drawn from one of these pages, quoted as it was written on the date shown.

    1. 1.
      “Think of it as the briefing you would give a capable new teammate on their first morning”
      ↩︎ What CLAUDE.md should contain
      “Aspirational rules the team does not actually follow.”
      ↩︎ What CLAUDE.md should contain
      “Subdirectory CLAUDE.md files are loaded on demand later, when Claude reads files in that subdirectory.”
      ↩︎ Choosing the scope for each instruction
      “When Claude gets something wrong twice — that is the signal a rule is missing.”
      ↩︎ Keeping CLAUDE.md accurate
      “Quarterly skim — delete anything stale, since outdated instructions are worse than none.”
      ↩︎ Keeping CLAUDE.md accurate
      “If you edit the file mid-session, the change is picked up the next time you run /compact or open it via /memory”
      ↩︎ Keeping CLAUDE.md accurate
      “Subdirectory CLAUDE.md files are loaded on demand later, when Claude reads files in that subdirectory.”
      ↩︎ Exam trap 2
      “If you edit the file mid-session, the change is picked up the next time you run /compact or open it via /memory”
      ↩︎ Exam trap 3
    2. 2.
      “Architectural decisions specific to your project”
      ↩︎ What CLAUDE.md should contain
      “Developer environment quirks (required env vars)”
      ↩︎ Checkpoint
    3. 3.
      ““Use 2-space indentation” instead of “Format code properly””
      ↩︎ What CLAUDE.md should contain
      “Move instructions that matter for only part of the codebase into path-scoped rules, which load only when Claude works with matching files.”
      ↩︎ Choosing the scope for each instruction
      “Longer files consume more context and reduce adherence.”
      ↩︎ Keeping CLAUDE.md accurate
      “Consistency: if two instructions contradict each other, Claude may pick one arbitrarily.”
      ↩︎ Keeping CLAUDE.md accurate
      “Imports help you organize a long file but don’t reduce its context cost, because imported files also load at launch.”
      ↩︎ Exam trap 1
      “Imports help you organize a long file but don’t reduce its context cost, because imported files also load at launch.”
      ↩︎ Prediction
      “Personal project-specific preferences; add to .gitignore | Your sandbox URLs, preferred test data | Only you (current project)”
      ↩︎ Checkpoint
    4. 4.
      “Directory owners maintain their own conventions; instructions are versioned with the code”
      ↩︎ Choosing the scope for each instruction
      “You want all conventions in one place, or the same rule applies to many scattered paths”
      ↩︎ Choosing the scope for each instruction
      “instructions that worked around an older model’s limitation may become overhead once a newer model handles the case on its own”
      ↩︎ Keeping CLAUDE.md accurate
      “Review in pull requests: treat CLAUDE.md edits like any other documentation change so conventions track the code”
      ↩︎ Keeping CLAUDE.md accurate
      “a Stop hook receives the path to the session transcript when Claude finishes responding”
      ↩︎ Keeping CLAUDE.md accurate
    5. 5.
      “CLAUDE.md files can now import other files. Add @path/to/file.md to ./CLAUDE.md to load additional files on launch”
      ↩︎ Choosing the scope for each instruction

    Ready to test yourself?

    Practise the 12 questions on this subdomain.

    Spotted a mistake, or was something unclear? Tell us.