Claude Code commands

Claude Code settings.json: Which File, Which Key

3 min read

Claude Code has no single config file. It has four, and each one decides who a setting applies to. Put a key in the wrong file and it silently does nothing for your teammates.

1. The four files

2. Precedence, highest first

Managed → claude --settings → project local → shared project → user. A key set higher wins. List keys are the exception: permissions.allow and friends merge across files rather than replacing each other, so each file can add rules without deleting another’s.

3. The keys worth setting

Settings files are strict JSON — a // comment or a trailing comma is a parse error.

{
  "$schema": "https://json.schemastore.org/claude-code-settings.json",
  "model": "claude-sonnet-5",
  "permissions": {
    "defaultMode": "ask",
    "allow": ["Bash(npm run lint)", "Bash(npm run test *)"],
    "deny": ["Read(./.env)", "Read(./.env.*)"],
    "additionalDirectories": ["../shared-lib"]
  },
  "env": { "NODE_ENV": "development" }
}

What it does: pins the starting model, pre-approves your lint and test commands, blocks reads of .env files, grants access to a sibling directory, and exports an env var to every session and its subprocesses.

The $schema line gives you autocomplete and inline validation in VS Code and Cursor. hooks also lives here, but its value is a nested object of matchers — see the hooks guide rather than guessing the shape. defaultMode accepts ask, auto, plan, and bypassPermissions; the last two don’t take effect from project or local files.

4. Confirm what loaded

/status

What it does: shows a Setting sources line listing every settings file this session read. Most edits reload without a restart; model and outputStyle wait for /model or a restart. If a file was rejected, claude doctor says what it dropped.


Next: build a file visually with the settings builder, or read how permissions and allowlists work.

Open the full interactive version (with copy buttons) ↗

← All guides