# #18: Settings Files and Precedence ⚙️

> How Claude Code settings files work: where they live, who they affect, and which one wins when two of them disagree.

Published 2026-11-18 by Jake Marsh on Little Cups of Claude. Canonical: https://littlecupsofclaude.com/18
Topics: [Claude Code CLI](https://littlecupsofclaude.com/topics/claude-code-cli)

Today we'll look at how **Claude Code** settings files work: where they live, who they affect, and which one wins when two of them disagree.

Settings are the **JSON** keys behind things like our default model, our permission rules, and our hooks. There are a few different files, and knowing which is which saves a lot of head-scratching. Let's get started.

## The Four Files

**Claude Code** reads settings from four places, each with its own reach:

```bash
# User: us, in every project on this machine
~/.claude/settings.json

# Shared project: everyone, once it's committed
.claude/settings.json

# Project local: us, in this one project
.claude/settings.local.json

# Managed: whatever our organization deploys
managed-settings.json
```

There's also `~/.claude.json`, which **Claude Code** writes for itself (account details, **MCP** configs, trust decisions). We don't need to edit that one.

## Who Wins

When the same key shows up in more than one place, the highest level wins. From the top:

1. **Managed** settings
2. The `--settings` flag on the command line
3. Project local (`.claude/settings.local.json`)
4. Shared project (`.claude/settings.json`)
5. User (`~/.claude/settings.json`)

So if our team's file turns spinner tips on and we'd rather not see them, we don't argue in a PR. We override it just for ourselves:

```settings.local.json
{
  "spinnerTipsEnabled": false
}
```

## Lists Merge

Lists work differently. A key like `permissions.allow` gets combined across files instead of replaced, so each file can add rules without wiping out the others:

```settings.json
{
  "$schema": "https://json.schemastore.org/claude-code-settings.json",
  "permissions": {
    "allow": ["Bash(bun run lint)", "Bash(bun test *)"],
    "deny": ["Read(./.env)", "Read(./.env.*)"]
  }
}
```

That `$schema` line is worth adding. It gives us autocomplete and inline validation in editors that support **JSON** schema.

## Just For One Session

To try a value without saving it anywhere, we pass it when we start:

```bash
claude --settings '{"model": "opus"}'
```

`--settings` takes inline **JSON** or a path to a file, and it lasts for that one session. Some keys also have their own flag (`--model`, `--effort`) or environment variable (`ANTHROPIC_MODEL`).

## The Local File Fills Itself

We often don't create `.claude/settings.local.json` ourselves. When we pick "Yes, and don't ask again" on a permission prompt, **Claude Code** saves that approval there as an `allow` rule.

The first time it writes the file in a git repo, it also adds it to our global git excludes, so it stays out of our commits. If we create the file by hand, we add it to `.gitignore` ourselves. Neat!

## Watch Out

Settings files are strict **JSON**. A `//` comment or a trailing comma is a syntax error, and **Claude Code** flags it as a **Settings Error** the next time it starts.

Most edits apply to a running session right away, including `permissions` and `hooks`. A few keys like `model` are only read at startup, which is what `/model` is for.

When something isn't applying, `/status` shows a `Setting sources` line listing which files actually loaded. A couple of keys also refuse to work from a project file at all, like setting `defaultMode` to `bypassPermissions`, which only takes effect from user or managed settings.

More info about **settings** can be found at [the Claude Code docs](https://code.claude.com/docs/en/settings).
