Skip to content

Essential Configuration

Claude Code’s flexibility comes from its extensive configuration options. This guide covers essential settings to optimize your development workflow, from permission management to model selection strategies.

  1. Enterprise policies - /Library/Application Support/ClaudeCode/managed-settings.json (macOS)
  2. Command line arguments - Flags passed when launching Claude Code
  3. Local project settings - .claude/settings.local.json (not in source control)
  4. Shared project settings - .claude/settings.json (checked into source control)
  5. User settings - ~/.claude/settings.json (applies to all projects)

Settings are applied in order of precedence, with enterprise policies overriding all others.

Terminal window
# Launch configuration menu
/config
# View current settings
claude config list
# Set a specific option
claude config set model claude-sonnet-4

Claude Code offers several permission modes to balance safety and productivity:

ModeDescriptionUse Case
defaultPrompts for each new tool useGeneral development
acceptEditsAuto-accepts file edits for sessionActive coding sessions
planRead-only analysis modeCode review, architecture planning
bypassPermissionsSkip all permission promptsTrusted environments only
Terminal window
# Launch with permissions bypassed
claude --dangerously-skip-permissions
# Equivalent to setting in config
claude --permission-mode bypassPermissions

This mode eliminates interruptions from permission prompts, significantly improving workflow speed for experienced users.

Claude Code defaults to intelligent model switching, but you can optimize for your use case:

ModelBest ForCostSpeed
Claude Opus 4Complex reasoning, architecture5xSlower
Claude Sonnet 4General coding, implementation1xFast
OpenAI o3Debugging complex issuesVariesMedium
Gemini 2.5 ProLarge context scenarios2xFast
Terminal window
# Switch models mid-session
/model opus # For complex planning
/model sonnet # For implementation
# Set default model
claude config set model claude-sonnet-4
# Override per session
claude --model claude-opus-4
{
"model": "claude-sonnet-4",
"permissions": {
"defaultMode": "acceptEdits"
},
"env": {
"DISABLE_NON_ESSENTIAL_MODEL_CALLS": "1",
"DISABLE_COST_WARNINGS": "0"
}
}

Create .claude/settings.json for team-shared settings:

{
"permissions": {
"allow": [
"Edit(src/**)",
"Bash(npm run:*)",
"Bash(git diff:*)",
"mcp__github__*"
],
"deny": [
"Edit(*.env)",
"Bash(rm -rf:*)"
],
"additionalDirectories": ["../shared-lib"]
},
"env": {
"NODE_ENV": "development"
},
"hooks": {
"PostToolUse": {
"Edit": "prettier --write $CLAUDE_FILE_PATHS"
}
}
}
.vscode/settings.json
{
"claude-code.autoLaunch": true,
"claude-code.defaultMode": "acceptEdits",
"claude-code.theme": "dark"
}

Optimize your terminal for Claude Code:

  1. Run /terminal-setup to configure key bindings
  2. Enable Shift+Enter for multiline input
  3. Configure notification preferences:
    Terminal window
    claude config set -g preferredNotifChannel iterm2_with_bell

Configure persistent memory across sessions:

CLAUDE.md
## Build Commands
- npm run build: Production build
- npm run dev: Development server
- npm test: Run test suite
- npm run typecheck: TypeScript validation
## Code Style
- Use functional components with TypeScript
- Prefer composition over inheritance
- Always handle error cases explicitly
## Architecture
- Frontend: Next.js with App Router
- API: tRPC with Zod validation
- Database: PostgreSQL with Drizzle ORM
# Project-specific settings
@docs/conventions.md
@~/.claude/personal-preferences.md
# Team member preferences (not in git)
@~/.claude/team-configs.md

Enable powerful integrations through MCP:

.claude/mcp.json
{
"mcpServers": {
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {
"GITHUB_TOKEN": "${GITHUB_TOKEN}"
}
},
"postgres": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-postgres",
"postgresql://localhost/mydb"
]
}
}
}

Enable MCP servers:

Terminal window
# Interactive setup
claude mcp add
# Allow specific servers
claude config set enabledMcpjsonServers '["github", "postgres"]'

Automate workflows with hooks:

{
"hooks": {
"PreToolUse": {
"Edit": {
"type": "command",
"command": "echo 'Editing: $CLAUDE_FILE_PATHS'"
}
},
"PostToolUse": {
"Edit": {
"type": "command",
"command": "npm run lint --fix $CLAUDE_FILE_PATHS"
},
"Bash": {
"type": "command",
"command": "[[ \"$CLAUDE_TOOL_INPUT\" =~ test ]] && echo 'Tests complete!'"
}
}
}
}

Key environment variables for fine-tuning:

Terminal window
# Model configuration
export ANTHROPIC_MODEL='claude-opus-4'
export ANTHROPIC_SMALL_FAST_MODEL='claude-3-5-haiku'
# Performance tuning
export CLAUDE_CODE_MAX_OUTPUT_TOKENS=8192
export MAX_THINKING_TOKENS=50000
# Cost optimization
export DISABLE_NON_ESSENTIAL_MODEL_CALLS=1
# Security
export CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1

Create reusable workflows:

.claude/commands/optimize.md
Analyze this code for performance bottlenecks:
- Profile execution time
- Identify N+1 queries
- Check for unnecessary re-renders
- Suggest optimizations
Target: $ARGUMENTS

Usage:

Terminal window
/optimize src/components/Dashboard.tsx

Enterprise Security Settings

/etc/claude-code/managed-settings.json
{
"permissions": {
"disableBypassPermissionsMode": "disable",
"deny": [
"Bash(curl:*)",
"Bash(wget:*)",
"WebFetch"
]
},
"forceLoginMethod": "console"
}

Token Usage

  • Use /clear frequently
  • Enable auto-compact
  • Focus queries on specific modules

Model Selection

  • Sonnet 4 for routine tasks
  • Opus 4 for complex reasoning
  • Monitor with /cost command
Terminal window
/config # Configuration menu
/permissions # Manage allowed tools
/model # Switch models
/clear # Clear context
/cost # Check token usage

High-Speed Development:

Terminal window
claude --dangerously-skip-permissions --model sonnet

Secure Review Mode:

Terminal window
claude --permission-mode plan --model opus

Cost-Conscious Setup:

{
"model": "claude-sonnet-4",
"env": {
"DISABLE_NON_ESSENTIAL_MODEL_CALLS": "1"
}
}