How to configure Claude Code with settings.json and environment variables: the scope system, precedence, permissions, and the settings you'll reach for most. Run /config to edit these from inside a session.
Where a configuration lives determines who it applies to and whether it is shared. When the same key appears in several scopes, the higher-priority scope wins (scalars override; arrays merge).
managed-settings.json). Highest precedence — cannot be overridden by anyone, not even CLI args.~/.claude/settings.json · not shared.claude/settings.json · shared ✔ (committed to git).claude/settings.local.json · not sharedScopes apply to many features, each with its own user / project / local location.
~/.claude/settings.json · .claude/settings.json · .claude/settings.local.json~/.claude/agents/ · .claude/agents/~/.claude.json; project servers in .mcp.json.~/.claude.json · .mcp.json~/.claude/CLAUDE.md · CLAUDE.md · CLAUDE.local.mdsettings.json.Settings apply in order of precedence, highest first. Higher scopes win for scalar values.
--settings <file-or-json>..claude/settings.local.json (personal, per-repo)..claude/settings.json (team, in source control).~/.claude/settings.json (personal global; applies when nothing else specifies the key).Scalars override, arrays merge. A scalar (like model) from a higher scope replaces the lower one; array settings like permissions.allow are concatenated and de-duplicated across scopes.
Two array exceptions: fallbackModel is an ordered chain supplied whole by the highest scope that sets it; a managed availableModels list applies as-is and can't be extended.
Reload: most keys (permissions, hooks, apiKeyHelper) reload live. model and outputStyle are read at start — use /model to switch mid-session.
permissions.defaultMode sets how Claude Code asks before acting. The --permission-mode flag overrides it for one session.
~/.claude/settings.json onlydisableBypassPermissionsMode: "disable".--dangerously-skip-permissionspermissions.allow / ask / deny hold rules in the form Tool or Tool(specifier). Rules evaluate deny → ask → allow, and the FIRST match wins regardless of specificity.
["Bash(git diff *)"]["Bash(git push *)"]["Read(./.env)", "Bash(curl *)"]["../docs/"]npm run..env file.example.com.deny, * blocks every tool and mcp__* blocks all MCP tools.A curated slice of settings.json — the keys most worth knowing. The full list lives in the official docs.
--model / ANTHROPIC_MODEL override it for one session."claude-sonnet-5"["claude-sonnet-5", "claude-haiku-4-5"]{"CLAUDE_CODE_ENABLE_TELEMETRY": "1"}X-Api-Key / Authorization: Bearer./bin/generate_temp_api_key.sh/clear."Explanatory"0 is rejected.20true).falsetrue{"type": "command", "command": "~/.claude/statusline.sh"}includeCoAuthoredBy. Empty strings hide it.{"commit": "...", "pr": ""}Co-Authored-By trailer — use attribution instead.false.mcp.json files.true.mcp.json servers by name.["memory", "github"].mcp.json servers by name.["filesystem"]claudeai, console, or gateway."claudeai""xxxxxxxx-…".aws directory (interactive SSO).aws sso login --profile myprofile/bin/generate_aws_grant.shBash sandboxing isolates commands from the filesystem and network (macOS / Linux / WSL2).
false).trueEdit/Read rules.["/tmp/build"] · ["~/.aws/credentials"]["github.com", "*.npmjs.org"]plugin-name@marketplace.{"formatter@acme-tools": true}{"acme-tools": {"source": {…}}}[{"source": "github", "repo": "acme/plugins"}]key=value (v2.1.181+)./config verbose=truemodel is read at start)..claude/settings.json (committed); keep personal per-repo tweaks in .claude/settings.local.json (gitignored).permissions.deny Read(...) rules — this replaces the deprecated ignorePatterns.permissions.defaultMode values: default/manual, acceptEdits, plan, auto (user-scope only), bypassPermissions.attribution (not the deprecated includeCoAuthoredBy) to customize or hide commit/PR credit.Summarized from the official Claude Code settings documentation (code.claude.com/docs/en/settings) for study. Always check the live docs for the newest keys and defaults.