Configuring Claude Code
Claude Code has two layers of configuration: global (applies to all projects) and workspace/project-level (applies to a specific repository).
Global settings file
~/.claude/settings.json
Example:
{
"model": "claude-opus-4-6",
"autoApprove": false,
"maxTokens": 8192,
"theme": "dark",
"notifications": true
}
Project-level settings
Inside your project root, create .claude/settings.json:
{
"model": "claude-sonnet-4-6",
"autoApprove": ["Read", "Glob", "Grep"],
"denyList": ["Bash:rm -rf"]
}
Project settings override global settings for that workspace.
Configuring via the REPL
/config
This opens an interactive editor where you can set:
- Default model
- Auto-approve rules
- Memory settings
- Theme and display options
Key configuration options
| Option | Values | Notes |
|---|---|---|
model |
claude-opus-4-6, claude-sonnet-4-6, claude-haiku-4-5-20251001 |
Opus is most capable, Haiku is fastest/cheapest |
autoApprove |
Array of tool names | Tools that run without confirmation |
denyList |
Array of tool+command patterns | Hard blocks |
maxTokens |
Integer | Max output tokens per response |
contextWindowSize |
Integer | How much history to keep before compaction |
Auto-approve: use carefully
Auto-approving Read, Glob, and Grep is safe — they're read-only operations. Auto-approving Write or Bash is a significant trust grant. Only enable for trusted, well-tested workflows.
Environment variables
You can also configure via environment variables:
export CLAUDE_MODEL="claude-sonnet-4-6"
export CLAUDE_MAX_TOKENS="4096"
Environment variables take precedence over settings files.