Configuration & Settings
Tune permissions, models, and behavior with settings.json.
Claude Code's behavior is controlled by JSON settings files — you can tell it which commands to allow or deny, which model to use, and how to handle git attribution, all without touching any code.
Settings files and precedence
Claude Code reads settings from several files layered on top of each other. When the same key appears in multiple files, the higher-priority file wins. Think of it as a stack of sticky notes — lower ones only show through where higher ones don't cover them.
- 1 (lowest) — User: ~/.claude/settings.json — your personal defaults across all projects
- 2 — Project: .claude/settings.json — committed to the repo, shared with your whole team
- 3 — Local: .claude/settings.local.json — your personal overrides for this repo only (gitignored)
- 4 — Command-line arguments — one-off flags for the current session only
- 5 (highest) — Managed: enterprise IT-deployed policies — cannot be overridden by anything
Permissions
The permissions system lets you pre-approve or block specific actions so Claude doesn't have to stop and ask every time. You write rules as 'ToolName(pattern)' strings inside allow, deny, or ask arrays. Rules from all scopes are merged together — a deny in your user settings still applies even if the project settings have an allow.
- allow — Claude may run this without asking you first
- deny — Claude is blocked from running this entirely
- ask — Claude must pause and ask you before proceeding
- Patterns use prefixes and wildcards, e.g. Bash(npm run test:*) to allow a family of commands
- Examples: Bash(npm run test:*) allows any npm test script; Read(./.env) blocks reading your env file
Useful settings
Beyond permissions, a handful of settings are worth knowing early on. Most take effect immediately — Claude Code hot-reloads settings files while running. The main exception is model, read at startup; use /model to switch mid-session.
- model — set a default model, e.g. 'claude-sonnet-4-6'
- env — environment variables injected into every session and subprocess Claude spawns
- hooks — shell commands to run at lifecycle events (before/after tool use, on session end)
- disableAllHooks — boolean; set true to turn off all hooks at once
- includeCoAuthoredBy — set false to drop the 'Co-authored-by Claude' line from commits and PRs
- cleanupPeriodDays — how many days to keep session transcripts (default 30)
- $schema — add the SchemaStore URL to get IDE autocomplete on your settings file
Example settings.json
Here is a realistic project-level .claude/settings.json that pre-approves safe commands, blocks reading secrets, sets a model, and injects an environment variable.
{
"$schema": "https://json.schemastore.org/claude-code-settings.json",
"model": "claude-sonnet-4-6",
"env": {
"NODE_ENV": "development"
},
"permissions": {
"allow": [
"Bash(npm run lint)",
"Bash(npm run test:*)",
"Bash(npm run build)"
],
"deny": [
"Bash(curl:*)",
"Read(./.env)",
"Read(./.env.*)",
"Read(./secrets/**)"
]
},
"includeCoAuthoredBy": true,
"cleanupPeriodDays": 14
}