CertSafari
    Anthropic Claude Certified Developer – Foundations (CCDV-F) - December 7 onwards· Lessons

    Domain 3 · Lesson 8/24

    CLAUDE.md hierarchy, settings precedence and permission modes

    Claude Code Operation

    14 min read
    4% of exam
    5 sources
    Published 18 Nov 2026
    Docs as of 18 Nov 2026

    What you will be able to do

    • Choose the right CLAUDE.md scope for team, personal, and organization-wide instructions
    • Predict when a nested CLAUDE.md file enters Claude's context
    • Place a settings key in the scope that wins, including rules developers must not weaken
    • Pick a permission mode for a task and know where each mode can be set

    Key concept

    Scope decides reach and authority — Every CLAUDE.md file and settings file in Claude Code belongs to a scope: managed, user, project, or local. The scope controls who the file affects and whether a different file can override it. Most configuration mistakes come from putting the right content in the wrong scope.

    1.Four places a CLAUDE.md can live

    A CLAUDE.md file holds standing instructions that Claude Code loads into every session, so you don't have to repeat a correction you already made last week. You write it in plain markdown, and where you save it decides who it reaches. There are four scopes. The managed policy file is installed by IT and applies to everyone in the organization. ~/.claude/CLAUDE.md holds your personal preferences for all your projects. ./CLAUDE.md or ./.claude/CLAUDE.md holds project instructions that the team shares through source control. ./CLAUDE.local.md holds your personal notes for one project. Running /init generates a starter project file.

    CLAUDE.md scopes and who each one reaches
    ScopeLocationShared with
    Managed policy/etc/claude-code/CLAUDE.md (Linux and WSL); /Library/Application Support/ClaudeCode/CLAUDE.md (macOS)All users in organization
    User instructions~/.claude/CLAUDE.mdOnly you (all projects)
    Project instructions./CLAUDE.md or ./.claude/CLAUDE.mdTeam members via source control
    Local instructions./CLAUDE.local.mdOnly you (current project)

    The local file fits personal sandbox URLs and preferred test data. It lives at the repository root, applies only to that repository, and is meant to be listed in .gitignore so it never reaches a teammate. The other places people try have problems. A heading in the shared CLAUDE.md is still committed and still loaded for everyone. ~/.claude/CLAUDE.md follows you into every project. The env block of a committed .claude/settings.json sets environment variables for the whole team, and it is not where instructions go.

    Writing a CLAUDE.md well is mostly about being specific and short. "Run npm test before committing" is better than "Test your changes". Keep each file under about 200 lines, because longer files cost more context and Claude follows them less reliably. Splitting a file with @path imports makes it easier to organize, but it doesn't make it cheaper: an imported file loads together with the file that imports it. Imports, path-scoped .claude/rules/, and AGENTS.md handling are covered in customizing Claude Code. Use /memory to open and edit the CLAUDE.md files a session is using.

    Checkpoint 1 of 8· Match them up

    Match each CLAUDE.md location to who its instructions reach.

    Tap a term, then the definition that fits it.

    Checkpoint 2 of 8· Exam question

    A developer wants their personal sandbox URLs and local test preferences applied by Claude Code in one repository only. The notes must not be committed and must not affect teammates. Where should they go?

    Sources12

    2.When each CLAUDE.md file enters the context

    CLAUDE.md files load at two different times. At session start, Claude Code reads every CLAUDE.md in the working directory and in each directory above it. A CLAUDE.md lower in the tree is not scanned at launch. It loads the first time Claude reads a file in that folder. In the monorepo example, a session spent fixing a CSV export in packages/ingest never pays for the billing conventions unless Claude opens a billing file. Relaunching from the subdirectory isn't needed to get those conventions either, because touching the folder is enough. /memory is an editor for these files, not a way to load them.

    Because files from several scopes and directories end up in one context, a contradiction between them is a real failure. Claude doesn't apply a precedence rule between conflicting sentences. It may simply follow one of them. Reviewing root, nested, and rules files together and deleting outdated lines is the only way to fix this.

    Checkpoint 3 of 8· Check yourself

    In a monorepo, the root CLAUDE.md says "use 4-space indentation". An older line in packages/billing/CLAUDE.md says "use 2-space indentation". Claude is now editing billing files, so both files are in context. What happens, and what is the right fix?

    Checkpoint 4 of 8· Exam question

    A monorepo has a root CLAUDE.md plus packages/billing/CLAUDE.md with billing-specific conventions. A developer starts Claude Code at the repo root and asks about a CSV export bug in packages/ingest. Which statement describes how the billing file is treated?

    Sources31

    3.settings.json scopes and which value wins

    CLAUDE.md shapes what Claude does. settings.json configures Claude Code itself: permission rules, default model, hooks, environment variables, and plugins. Settings use the same four scopes as CLAUDE.md, but a key that appears in several files resolves by a strict order. Managed settings come first. Next is JSON passed with --settings for one session. Then come .claude/settings.local.json, the shared .claude/settings.json, and finally ~/.claude/settings.json.

    Settings scopes, highest precedence first
    ScopeFileUse it for
    Managedmanaged-settings.json, MDM policy, or server-managed settingsSecurity policy and compliance requirements
    Command line--settings <file-or-json>One session only
    Project local./.claude/settings.local.jsonPersonal overrides for one project, and testing before you share
    Shared project./.claude/settings.jsonTeam permissions, hooks, plugins, and environment variables
    User~/.claude/settings.jsonTheme, editor mode, default model, your own permission rules
    A shared project settings file that allows lint and test commands and denies reading .env filesjson
    {
      "$schema": "https://json.schemastore.org/claude-code-settings.json",
      "permissions": {
        "allow": [
          "Bash(npm run lint)",
          "Bash(npm run test *)"
        ],
        "deny": [
          "Read(./.env)",
          "Read(./.env.*)"
        ]
      }
    }

    Claude Code writes the local file on its own. When you answer a Bash permission prompt with "Yes, and don't ask again", it saves that approval to .claude/settings.local.json as an allow rule. The first time it writes that file in a git repository, it adds the file to your global git excludes so you don't commit it by accident. If you create the file by hand, add it to .gitignore yourself. Settings errors are handled per file. A file with invalid JSON triggers a Settings Error dialog at startup. A single malformed permission rule is skipped with a warning, and the rest of the file stays in effect.

    For a rule that no developer may weaken, only one scope works. User, project, and local files are files that developers can edit themselves. A committed .claude/settings.json protected by branch review still sits below the local file in the stack, and a configuration-management job that resets ~/.claude/settings.json is still guarding a file the developer owns. A managed permissions.deny entry, such as one blocking Bash(curl:*), is placed in a system directory through device management, and no file a developer controls can override it. Organizations use managed CLAUDE.md for behavioral guidance. Managed settings are where tool blocking actually gets enforced. Broader least-privilege design is covered in deterministic guardrails.

    Which managed mechanism carries which organizational concern
    ConcernConfigure in
    Block specific tools, commands, or file pathsManaged settings: permissions.deny
    Enforce sandbox isolationManaged settings: sandbox.enabled
    Code style and quality guidelinesManaged CLAUDE.md
    Behavioral instructions for ClaudeManaged CLAUDE.md

    Checkpoint 5 of 8· Check yourself

    Your security team says no developer may be able to let Claude Code run curl, even by editing their own configuration. Which setup meets that requirement?

    Checkpoint 6 of 8· Exam question

    A security team wants a rule denying Bash(curl:*) that no developer can weaken, including through a personal .claude/settings.local.json in their own checkout. Where should the rule be defined?

    Sources41

    4.Permission modes and where to set them

    A permission mode sets how much Claude may do before it stops to ask you. There are six modes, ordered here from most cautious to least. default (shown as Manual) runs only reads without asking. acceptEdits adds file edits and common filesystem commands such as mkdir and mv. plan lets Claude explore but blocks edits until you approve a plan. auto runs everything, with a classifier doing background safety checks. dontAsk denies anything that would prompt, apart from pre-approved tools. bypassPermissions runs everything and is meant only for isolated containers and VMs.

    Permission modes compared
    ModeRuns without askingBest for
    defaultReads onlyReviewing every action yourself, sensitive work
    acceptEditsReads, file edits, and common filesystem commandsIterating on code you're reviewing
    planReads; edits wait for an approved planExploring a codebase before changing it
    autoEverything, with background safety checksLong tasks, reducing prompt fatigue
    dontAskReads in working directories and pre-approved tools; the rest is deniedLocked-down CI and scripts
    bypassPermissionsEverythingIsolated containers and VMs only

    The starting mode is resolved in a fixed order. The --permission-mode flag (or --dangerously-skip-permissions) comes first, then permissions.defaultMode from a settings file, then the built-in default. The built-in default depends on how you run Claude Code. Terminal and VS Code sessions start in auto on v2.1.283 and later, while claude -p and the Agent SDK start in default. Project files get one restriction: auto or bypassPermissions written into .claude/settings.json or .claude/settings.local.json doesn't take effect. Without that restriction, a cloned repository could switch on hands-off mode for whoever opens it. Administrators can go further. Setting permissions.disableAutoMode or permissions.disableBypassPermissionsMode to "disable" in managed settings removes the mode for everyone.

    During a session, you switch modes with Shift+Tab in the CLI, or with the mode control in VS Code or Desktop. /plan enters plan mode directly and can take a task, for example /plan fix the auth bug. Some calls prompt in every mode. Tools matched by an explicit ask rule are one example, and AskUserQuestion is another. Writing allow, ask, and deny rules is covered in customizing Claude Code, and /permissions opens a dialog for viewing those rules by scope.

    Checkpoint 7 of 8· Match them up

    Match each permission mode to the situation it is built for.

    Tap a term, then the definition that fits it.

    Checkpoint 8 of 8· Check yourself

    A teammate commits "defaultMode": "bypassPermissions" under permissions in the repository's .claude/settings.json. You clone the repository and start Claude Code in a terminal without a --permission-mode flag. Which mode does the session start in?

    Sources5

    Sources

    (5)

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

    1. 1.
      “Personal project-specific preferences; add to .gitignore”
      ↩︎ Four places a CLAUDE.md can live
      “Imports help you organize a long file but don’t reduce its context cost”
      ↩︎ Four places a CLAUDE.md can live
      “if two instructions contradict each other, Claude may pick one arbitrarily”
      ↩︎ When each CLAUDE.md file enters the context
      “Block specific tools, commands, or file paths | Managed settings: permissions.deny”
      ↩︎ settings.json scopes and which value wins
      “Local instructions | ./CLAUDE.local.md | Personal project-specific preferences; add to .gitignore | Your sandbox URLs, preferred test data | Only you (current project)”
      ↩︎ Checkpoint
      “Consistency: if two instructions contradict each other, Claude may pick one arbitrarily.”
      ↩︎ Checkpoint
    2. 2.
      “Edit CLAUDE.md files, enable or disable auto memory, and view auto memory entries”
      ↩︎ Four places a CLAUDE.md can live
    3. 3.
      “loaded on demand when Claude reads files in that directory, not at session start”
      ↩︎ When each CLAUDE.md file enters the context
      “The files at and above your working directory are read at session start”
      ↩︎ Exam trap 2
    4. 4.
      “Claude Code applies it above your user, project, and local files and below managed settings.”
      ↩︎ settings.json scopes and which value wins
      “Claude Code saves that permission approval here as an allow rule.”
      ↩︎ settings.json scopes and which value wins
      “Nothing in your own settings files or --settings overrides a managed key”
      ↩︎ Key concept
      “Nothing in your own settings files or --settings overrides a managed key”
      ↩︎ Exam trap 1
      “Nothing in your own settings files or --settings overrides a managed key”
      ↩︎ Checkpoint
    5. 5.
      “Switch permission modes with Shift+Tab in the CLI, the mode indicator in VS Code, or the mode selector in Desktop.”
      ↩︎ Permission modes and where to set them
      “dontAsk: never appears in the cycle; set it with --permission-mode dontAsk”
      ↩︎ Permission modes and where to set them
      “Claude Code blocks edits until you approve a plan”
      ↩︎ Permission modes and where to set them
      “it doesn’t take effect either, and the session starts in Manual mode”
      ↩︎ Exam trap 3
      “bypassPermissions | Everything | Isolated containers and VMs only”
      ↩︎ Checkpoint
      “If you set "bypassPermissions" in those two files, it doesn’t take effect either, and the session starts in Manual mode.”
      ↩︎ Checkpoint

    Continue to part 2 of 2

    Claude Code surfaces, sessions and headless mode

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