Claude Code settings

Settings control how Claude Code loads memory, permissions, hooks, MCP servers, models, and UI preferences. Good settings reduce repeated manual setup across sessions and teammates.

Last verified
Applies to
Claude Code 2.1.x. CLI spellings were checked on local version 2.1.198; official docs may describe newer 2.1.x behavior.
Verification method
Settings scopes, local-file location, source selection, merge behavior, and permission precedence were reviewed in official docs and local help. No real settings file was modified.
Official sources
SettingsPermissionsChangelog

Reproducible practice

Test a project setting in isolation before sharing it

Distinguish project, local, user, and command-line settings while avoiding overwrite of existing configuration.

Prerequisites

  • A unique temporary git repository.
  • jq for syntax checks.
  • One reversible setting with a documented key and expected scope.

Steps

  1. Create isolated project and local layers

    Never run the fixture over an existing `.claude` directory.

    Step 1
    SETTINGS_LAB=$(mktemp -d "${TMPDIR:-/tmp}/claude-settings.XXXXXX")
    printf '%s\n' "$SETTINGS_LAB"
    cd "$SETTINGS_LAB" && git init -q
    mkdir .claude
    printf '%s\n' '{"permissions":{"allow":["Read"]}}' > .claude/settings.json
    printf '%s\n' '{"permissions":{"deny":["Read(.env)"]}}' > .claude/settings.local.json
  2. Validate both files

    Syntax is necessary but does not prove effective merge behavior.

    Step 2
    jq -e . .claude/settings.json >/dev/null
    jq -e . .claude/settings.local.json >/dev/null
  3. Select sources explicitly

    Start an optional session with only project and local sources to exclude unrelated user settings.

    Step 3
    claude --setting-sources project,local
  4. Exercise a denial

    Request a normal file and `.env`; inspect the actual permission result without placing a secret in the fixture.

Expected result

The project allow rule and local deny rule are both attributable, `.env` remains denied, and no user setting is needed for the test.

Validation

  • Use `/status` or `/config` only to inspect effective state, not to infer undocumented merge rules.
  • Check both JSON files and git status separately.
  • Verify local settings remain untracked before using the pattern in a real repo.

Failure handling

Setting appears ignored

Check scope, repository root, supported key, and whether print mode silently ignored invalid settings.

Layers conflict

Reduce to one key and one source pair; remember deny rules retain precedence.

Cleanup or rollback

  • Exit, return to the original directory, verify SETTINGS_LAB is the printed mktemp path, and remove only it.
  • In a real project, revert shared settings by reviewed commit and preserve unrelated local settings.

Boundaries and when not to use it

  • Local settings may resolve to the repository root across worktrees in newer 2.1.x versions.
  • Managed settings and security controls can override or supplement project choices; local tests cannot prove organization policy.

Settings layers

Claude Code merges settings from multiple scopes. Managed or org policy can override user defaults; project settings refine behavior for a repository.

Common settings to configure

Most teams configure permissions, additional directories, model defaults, diff tool behavior, and theme or output preferences early in adoption.

CommandDescription
/configOpen the settings UI or set key=value pairs directly.
/permissionsConfigure allow, ask, and deny tool rules for the session.
--settingsLoad a JSON settings file for scripted or CI sessions.
--add-dirGrant access to extra working directories for the current run.
Set a value from the session
/config theme=dark
/config model=sonnet

Environment variables

Environment variables can override auth, debug logging, feature flags, and integration behavior. They are useful for CI, containers, and team-standard shells.

Auth context

Launch editors and terminals from the same environment when auth depends on inherited variables.

Read guide

Debug settings that did not load

When a setting appears ignored, inspect the active session rather than assuming the file on disk was applied.

CommandDescription
/doctorValidate settings files and report parse or precedence issues.
/contextSee what startup context consumed space, including loaded config.
/mcpVerify MCP servers after changing MCP-related settings.

Settings in your daily workflow

Settings intersect with permissions, memory, MCP, and troubleshooting. Adjust the layer that actually controls the behavior you see.

Settings checklist

Related topics