How to Configure Claude Code Settings
Claude Code settings control everything from permissions and tool access to themes and environment variables. Learn where files live, what you can configure, and how to set it up right.
Claude Code settings are configured through JSON files at three levels: global (~/.claude/settings.json), project (.claude/settings.json), and user-project (.claude/settings.local.json). They control permissions, model selection, tool access, MCP servers, themes, and more. More specific files override broader ones.
This guide maps out every settings file, where it lives, what you can configure in each, and how to set things up so Claude works the way you want without asking permission for every safe command.
What Can You Configure?
Claude Code settings control:
- Permissions: Which tools Claude can use without asking
- Model selection: Default AI model, effort levels, and model-specific settings
- Tool access: Allow, ask, or deny specific tools and commands
- Environment: Variables passed to Claude's sessions
- Display: Themes, spinner messages, status line, output style
- MCP servers: External tool integrations
- Hooks: Lifecycle event automation (PreToolUse, PostToolUse, etc.)
- Sandbox: Security restrictions for bash execution
- Plugins: Plugin marketplace and plugin management
Settings File Locations
Claude Code uses a hierarchy of settings files. More specific settings override broader ones.
| Location | Purpose | Shared? |
|---|---|---|
/etc/claude-code/ (Linux) or /Library/Application Support/ClaudeCode/ (macOS) |
Managed settings (IT-deployed, system-wide) | Yes (org-wide) |
~/.claude/settings.json |
User settings (all your projects) | No |
.claude/settings.json |
Project settings (shared with team) | Yes (git) |
.claude/settings.local.json |
Personal project settings | No (gitignored) |
~/.claude.json |
Preferences, OAuth, MCP servers | No |
.mcp.json |
Project MCP server configuration | Yes (git) |
~/.claude/keybindings.json |
Custom keyboard shortcuts | No |
Settings Precedence Order
When the same setting exists in multiple files, Claude Code applies them in this order (highest priority first):
- Managed settings (IT deployed, system-wide)
- Command line arguments
- Local project settings (
.claude/settings.local.json) - Shared project settings (
.claude/settings.json) - User settings (
~/.claude/settings.json)
Recommendation: Put team-wide defaults in .claude/settings.json (checked into git). Put your personal preferences in ~/.claude/settings.json or .claude/settings.local.json.
How to Open Settings
The quickest way to view and edit settings is with the /config command:
/config
This opens a visual interface where you can modify settings, see current values, and access different configuration sections.
You can also edit the files directly. Create them if they don't exist:
# User settings (all projects)
nano ~/.claude/settings.json
# Project settings (shared)
nano .claude/settings.json
# Project settings (personal)
nano .claude/settings.local.json
Permission Settings
This is the most important section. Permissions control which tools Claude can use and whether it needs to ask first.
Basic Permission Structure
{
"permissions": {
"allow": [
"Bash(npm run build)",
"Bash(npm run test)",
"Read(./src/**)"
],
"ask": [
"Bash(git push *)"
],
"deny": [
"Bash(curl *)",
"Read(./.env*)",
"WebFetch"
]
}
}
Rules are evaluated in order: deny first, then ask, then allow.
Permission Rule Syntax
Rules follow the format Tool or Tool(specifier):
| Rule | Meaning |
|---|---|
Bash(npm run build) |
Exact command match |
Bash(npm run *) |
Wildcard: any npm run command |
Bash(* --version) |
Wildcard: any --version command |
Read(./.env) |
Specific file |
Read(./secrets/**) |
Directory glob |
WebFetch |
Entire tool (no specifier) |
WebFetch(domain:example.com) |
Domain-specific |
Available Tools
| Tool | Description | Permission Required |
|---|---|---|
Bash |
Shell command execution | Yes |
Read |
File reading (text, images, PDFs, notebooks) | Yes |
Edit |
Targeted file edits (string replacement) | Yes |
MultiEdit |
Multiple edits to a single file in one operation | Yes |
Write |
Write new files to the filesystem | Yes |
NotebookEdit |
Edit Jupyter notebook cells | Yes |
WebFetch |
Fetch and process web content | Yes |
WebSearch |
Search the web for information | Yes |
Glob |
File pattern matching | No |
Grep |
Content searching | No |
Task |
Subagent/task execution | Yes |
MCP |
MCP server tool access | Yes |
AskUserQuestion |
Multiple-choice questions for requirements | No |
Permission Modes
Set a default permission mode for all tools:
{
"permissions": {
"defaultMode": "acceptEdits"
}
}
Options:
default— Standard prompts for everythingacceptEdits— Auto-accept file editsdontAsk— Auto-deny prompts (allowed tools still work)bypassPermissions— Skip all permission checks
Warning: Use bypassPermissions with extreme caution. It allows Claude to execute any operation without your approval.
Real Permission Example
Here's a practical setup for a web development project:
{
"permissions": {
"allow": [
"Bash(npm run *)",
"Bash(npm test *)",
"Bash(git add *)",
"Bash(git commit *)",
"Bash(git status)",
"Bash(git diff *)",
"Read(./src/**)",
"Read(./tests/**)",
"Edit(./src/**)",
"Edit(./tests/**)"
],
"ask": [
"Bash(git push *)",
"Bash(npm publish *)"
],
"deny": [
"Bash(rm -rf *)",
"Bash(curl *)",
"Read(./.env*)",
"Read(./secrets/**)",
"Edit(./.env*)",
"WebFetch"
],
"defaultMode": "acceptEdits"
}
}
Core Settings
Model Configuration
Claude Code supports model aliases (opus, sonnet, haiku, opusplan) or full model names. The latest models are Claude Opus 4.6 (claude-opus-4-6), Claude Sonnet 4.5 (claude-sonnet-4-5-20250929), and Claude Haiku 4.5 (claude-haiku-4-5-20251001).
{
"model": "opus",
"alwaysThinkingEnabled": true,
"effortLevel": "high"
}
The opusplan alias uses Opus for plan mode and Sonnet for execution, giving you the best of both models automatically.
Or use environment variables:
export ANTHROPIC_MODEL="opus"
export ANTHROPIC_DEFAULT_OPUS_MODEL="claude-opus-4-6"
export ANTHROPIC_DEFAULT_SONNET_MODEL="claude-sonnet-4-5-20250929"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="claude-haiku-4-5-20251001"
export CLAUDE_CODE_EFFORT_LEVEL="high"
export MAX_THINKING_TOKENS=31999
Effort levels control Opus 4.6's adaptive reasoning: low (faster, cheaper), medium, and high (default, deepest reasoning). Set via the effortLevel setting, the CLAUDE_CODE_EFFORT_LEVEL environment variable, or the left/right arrow keys in the /model picker.
Display and UI
{
"outputStyle": "Explanatory",
"language": "english",
"showTurnDuration": true,
"spinnerTipsEnabled": true,
"terminalProgressBarEnabled": true
}
To change the theme, run /theme in Claude Code.
Session Management
{
"cleanupPeriodDays": 30,
"autoUpdatesChannel": "stable"
}
Environment Variables
Claude Code supports many environment variables. Set them in your shell profile or in the env field of settings.
In Settings
{
"env": {
"NODE_ENV": "development",
"DEBUG": "true"
}
}
Key Environment Variables
| Variable | Purpose |
|---|---|
ANTHROPIC_API_KEY |
API key for Claude |
ANTHROPIC_MODEL |
Default model (alias or full name) |
ANTHROPIC_DEFAULT_OPUS_MODEL |
Override model for Opus alias |
ANTHROPIC_DEFAULT_SONNET_MODEL |
Override model for Sonnet alias |
ANTHROPIC_DEFAULT_HAIKU_MODEL |
Override model for Haiku alias |
CLAUDE_CODE_EFFORT_LEVEL |
Reasoning effort: low, medium, high |
CLAUDE_CODE_SUBAGENT_MODEL |
Model for subagents |
CLAUDE_CODE_MAX_OUTPUT_TOKENS |
Max response tokens (default 32,000, max 64,000) |
BASH_DEFAULT_TIMEOUT_MS |
Default bash command timeout |
BASH_MAX_TIMEOUT_MS |
Maximum bash timeout |
MAX_THINKING_TOKENS |
Extended thinking token budget |
DISABLE_TELEMETRY |
Opt out of analytics |
DISABLE_AUTOUPDATER |
Disable auto-updates |
CLAUDE_AUTOCOMPACT_PCT_OVERRIDE |
When to auto-compact context (1-100%) |
CLAUDE_CODE_DISABLE_AUTO_MEMORY |
Disable automatic memory recording |
Disabling Features
# Disable telemetry
export DISABLE_TELEMETRY=1
# Disable error reporting
export DISABLE_ERROR_REPORTING=1
# Disable background tasks
export CLAUDE_CODE_DISABLE_BACKGROUND_TASKS=1
# Disable cost warnings
export DISABLE_COST_WARNINGS=1
Sandbox Settings
The sandbox restricts what bash commands can do:
{
"sandbox": {
"enabled": true,
"autoAllowBashIfSandboxed": true,
"excludedCommands": ["git", "docker"],
"network": {
"allowedDomains": ["github.com", "*.npmjs.org"],
"allowLocalBinding": false
}
}
}
When autoAllowBashIfSandboxed is true and the sandbox is enabled, Claude can run bash commands without asking—because they're sandboxed anyway.
Hooks Configuration
Hooks let you run custom scripts automatically at key points in Claude's lifecycle. They are configured in your settings file.
{
"hooks": {
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [
{ "type": "command", "command": "~/.claude/hooks/pre-bash.sh" }
]
}
],
"PostToolUse": [
{
"matcher": "Edit",
"hooks": [
{ "type": "command", "command": "~/.claude/hooks/auto-lint.sh" }
]
}
],
"Notification": [
{
"hooks": [
{ "type": "command", "command": "~/.claude/hooks/notify.sh" }
]
}
]
}
}
Available hook events:
- PreToolUse: Fires before Claude executes a tool. Can modify tool inputs or block execution.
- PostToolUse: Fires after a tool completes. Useful for running linters, formatters, or tests automatically.
- Notification: Fires when Claude needs your attention or completes a task.
- Stop: Fires when Claude finishes its response.
- SubagentStop: Fires when a subagent finishes.
Common use case: Set up a PostToolUse hook on Edit to automatically run your linter after every file change. This ensures all code Claude writes follows your formatting rules.
MCP Server Configuration
MCP (Model Context Protocol) servers add external tools to Claude Code.
{
"enableAllProjectMcpServers": true,
"enabledMcpjsonServers": ["memory", "github"],
"disabledMcpjsonServers": ["filesystem"],
"allowedMcpServers": [
{ "serverName": "github" },
{ "serverName": "memory" }
]
}
MCP servers are typically configured in .mcp.json in your project root or in ~/.claude.json globally.
Attribution Settings
Customize how Claude Code attributes its contributions:
{
"attribution": {
"commit": "Generated with AI\n\nCo-Authored-By: Claude ",
"pr": "Generated with Claude Code"
}
}
Complete Example Configuration
Here's a comprehensive settings file you can adapt:
{
"$schema": "https://json.schemastore.org/claude-code-settings.json",
"model": "sonnet",
"effortLevel": "high",
"language": "english",
"outputStyle": "Explanatory",
"showTurnDuration": true,
"spinnerTipsEnabled": true,
"autoUpdatesChannel": "stable",
"permissions": {
"allow": [
"Bash(npm run *)",
"Bash(git status)",
"Bash(git diff *)",
"Bash(git add *)",
"Bash(git commit *)",
"Read(./src/**)",
"Edit(./src/**)",
"Write(./src/**)",
"MultiEdit(./src/**)"
],
"ask": [
"Bash(git push *)"
],
"deny": [
"Bash(curl *)",
"Read(./.env*)",
"Read(./secrets/**)",
"WebFetch"
],
"defaultMode": "acceptEdits"
},
"sandbox": {
"enabled": true,
"autoAllowBashIfSandboxed": true,
"network": {
"allowedDomains": ["github.com", "*.npmjs.org"]
}
},
"env": {
"NODE_ENV": "development"
},
"cleanupPeriodDays": 30
}
Common Mistakes
- Editing the wrong file: Changes to
~/.claude/settings.jsonapply everywhere. Changes to.claude/settings.jsononly apply to that project. Make sure you're editing the right one. - Invalid JSON: A missing comma or bracket breaks the entire file. Use a JSON validator or editor with syntax highlighting.
- Overly permissive rules:
"allow": ["Bash(**)"]is dangerous. Be specific about what you allow. - Forgetting wildcards:
Bash(npm run build)only matches that exact command. UseBash(npm run *)for all npm run commands. - Not checking settings into git: Project settings in
.claude/settings.jsonshould be version controlled so your team has consistent behavior.
FAQ
How do I reset all settings to defaults?
Delete or rename your settings files. Claude Code creates fresh defaults on next launch. Files are at ~/.claude/settings.json and ~/.claude.json.
Why isn't my setting taking effect?
Check the precedence order. A project-level setting overrides your user settings. Also verify your JSON is valid—any syntax error causes the entire file to be ignored.
Can I have different settings for different projects?
Yes. Create .claude/settings.json in each project directory. These override your user-level settings for that project only.
How do I see what settings are currently active?
Run /config to open the visual settings interface. Or check /status for key configuration info.
How do I make Claude stop asking about a specific command?
Add it to the allow list: "allow": ["Bash(your-command)"]. Use wildcards if needed: "Bash(npm run *)".
Related Guides
- How to Use CLAUDE.md Files — persistent memory for your projects
- How to Create Custom Agents — specialized AI subagents
- How to Use Slash Commands — including /config and /theme
Like Claude Code? Meet Your Chief AI Officer
Watch me build a complete website using only plain English—no coding required. Then try it yourself.
Get the Free Blueprint href="/blueprint">Watch the Free Setup Video →rarr;