Claude Code Configuration
Claude Code’s behavior is controlled by a layered configuration system: settings.json files at project and global levels, CLAUDE.md files for project-specific instructions, environment variables for runtime control, MCP server definitions for tool integrations, and permission rules for security. This page maps every configuration surface and links to detailed guides.
Configuration Hierarchy
Claude Code reads configuration from multiple sources, with specific precedence rules. Understanding the hierarchy prevents conflicts and unexpected behavior.
- Claude Code Config Hierarchy Explained – complete precedence order with examples
- Claude Code Project vs Global Settings – when to use project vs global config
- Claude Code Config File Location – where configuration files live on each OS
Precedence order (highest to lowest):
- Command-line flags (
--model,--dangerously-skip-permissions) - Environment variables (
ANTHROPIC_API_KEY,CLAUDE_MODEL) - Project settings (
.claude/settings.json) - User settings (
~/.claude/settings.json) - CLAUDE.md instructions
- Default values
settings.json Configuration
The .claude/settings.json file controls Claude Code’s operational behavior: which tools are allowed, what permissions are granted, and how the agent interacts with your system.
Project Settings
Project settings live in .claude/settings.json within your repository. They are committed to version control and shared across the team.
- Claude Code .claude/settings.json Cost Saving Configuration – cost-focused settings
- Claude Code Permission Rules in settings.json – granular permission configuration
- Configure disallowedTools in Claude Code – tool restriction lists
- Claude Code Custom Keybindings – keyboard shortcut configuration
Global Settings
Global settings live in ~/.claude/settings.json and apply to all projects. Use these for personal preferences that should not vary by project.
- Claude Code Managed Settings Enterprise – organization-managed global settings
- Claude Code Project vs Global Settings Token Impact – performance implications of each level
CLAUDE.md Configuration
Your CLAUDE.md file is not just documentation – it is active configuration that shapes how Claude Code interprets and modifies your codebase.
Core Guides
- CLAUDE.md Best Practices: Definitive Guide – comprehensive writing guide
- Claude Md File: What It Does – technical explanation of how CLAUDE.md works
- CLAUDE.md Length Optimization – keeping config within token-efficient bounds
- Fix Claude MD Too Long Context Window – handling oversized configs
- CLAUDE.md Too Long? How to Split – splitting strategies for large configs
- Pre-Loading Context via CLAUDE.md – smart context loading patterns
- Progressive Disclosure in CLAUDE.md – load-on-demand configuration sections
Generate yours: The CLAUDE.md Generator creates a production-ready configuration file in under 60 seconds.
Framework-Specific Templates
CLAUDE.md templates tuned for specific tech stacks:
- CLAUDE.md for Next.js + TypeScript – Next.js projects
- CLAUDE.md for React + Vite + TypeScript – React SPA projects
- CLAUDE.md for Node.js + Express + Prisma – Express API projects
- CLAUDE.md for Django + PostgreSQL – Python Django projects
- CLAUDE.md for FastAPI + SQLAlchemy – Python FastAPI projects
- CLAUDE.md for Go + Gin + GORM – Go web projects
- CLAUDE.md for Rust + Axum + SQLx – Rust web projects
- CLAUDE.md for Rails + Turbo + Stimulus – Ruby on Rails projects
- CLAUDE.md for Flutter + Dart + Riverpod – Flutter mobile projects
- CLAUDE.md for iOS + Swift + SwiftUI – iOS projects
Specialized Configuration
- CLAUDE.md for API Design Patterns – API conventions
- CLAUDE.md for Database Conventions – database patterns and migrations
- CLAUDE.md for Error Handling – error handling rules
- CLAUDE.md for Testing Conventions – test structure and coverage requirements
- CLAUDE.md for Security Rules – security constraints
- CLAUDE.md for Frontend Projects – frontend-specific conventions
- CLAUDE.md for Architecture Decisions – ADR integration
Environment Variables
Environment variables control Claude Code’s runtime behavior without modifying configuration files. They are essential for CI/CD, Docker, and headless deployments.
- Claude Code Environment Variables Reference – complete ENV variable list
- Environment Variables for Claude Code Cost Control – cost-related variables
- How Do I Set Environment Variables for a Claude Skill – skill-specific ENV configuration
- Container Environment Variables Management – Docker and container ENV patterns
- Claude Code Dotenv Configuration – .env file integration
Key environment variables:
| Variable | Purpose |
|---|---|
ANTHROPIC_API_KEY |
API authentication |
CLAUDE_MODEL |
Default model selection |
ANTHROPIC_BASE_URL |
Custom API endpoint (Bedrock, OpenRouter) |
HTTP_PROXY / HTTPS_PROXY |
Proxy configuration |
MCP Server Configuration
MCP (Model Context Protocol) servers extend Claude Code’s capabilities with external tools – databases, APIs, cloud services, and more.
Setup Guides
- Claude Code MCP Configuration Guide – comprehensive MCP setup
- Claude Code MCP Server Setup – step-by-step server connection
- How to Add an MCP Server to Claude Code – adding new servers
- claude_desktop_config.json Setup – desktop app MCP configuration
- Connect Claude Code to Remote MCP Servers – remote server connections
- Fix Claude Code MCP Timeout Settings – timeout tuning
Popular MCP Servers
- Best MCP Servers for Claude Code – curated server recommendations
- Top MCP Servers for Claude Code Developers – ranked by developer usage
- MCP Servers for Claude Code: Complete Setup – multi-server configuration
- Claude Code + Supabase MCP: Setup Guide – database integration
- AWS MCP Server Cloud Automation – AWS service integration
- GitHub MCP Server Advanced Workflow – GitHub integration
- Figma MCP Server: Design to Code – design tool integration
Permission Configuration
Permissions control what Claude Code can read, write, execute, and access. Proper permission configuration is critical for security.
- Claude Code Permission Modes Explained – understanding ask, auto, and custom modes
- Claude Code Permission Modes and Token Usage – how modes affect costs
- Claude Code Permission Rules in settings.json – rule syntax and examples
- Configure disallowedTools in Claude Code – blocking specific tools
- Claude –dangerously-skip-permissions – understanding the skip flag
- Why Claude Code Keeps Asking Permission – reducing permission fatigue
Provider Configuration
Claude Code can connect to different API providers beyond the default Anthropic API.
- Claude Code AWS Bedrock Setup – using Claude via AWS Bedrock
- Claude Code with OpenRouter – OpenRouter as API provider
- Claude Code + OpenRouter Pricing – cost comparison
- Configure Claude Code Proxy: HTTP_PROXY – enterprise proxy setup
- Claude Code Auto Mode Setup – configuring auto-accept mode
Frequently Asked Questions
Where does Claude Code store its configuration?
Three locations: project-level at .claude/settings.json (committed to git), user-level at ~/.claude/settings.json (not committed), and CLAUDE.md in your project root. Environment variables override file-based settings. See Config File Location.
What is the difference between settings.json and CLAUDE.md?
settings.json controls Claude Code’s operational behavior (permissions, tools, model selection). CLAUDE.md controls Claude’s understanding of your project (architecture, coding standards, build commands). Both are necessary for a well-configured project.
How do I configure MCP servers?
Add MCP server definitions to your .claude/settings.json file under the mcpServers key. Each server needs a name, transport type (stdio or HTTP), and command or URL. See MCP Configuration Guide.
Can I use Claude Code with AWS Bedrock instead of the Anthropic API?
Yes. Set ANTHROPIC_BASE_URL to your Bedrock endpoint and configure AWS credentials. This gives you data residency control and consolidated AWS billing. See AWS Bedrock Setup.
How do I restrict which files Claude Code can modify?
Use the allowedPaths and disallowedPaths rules in settings.json, and add explicit scoping instructions to your CLAUDE.md. Together, these prevent Claude from modifying sensitive files. See Permission Rules Guide.
What happens if settings.json and CLAUDE.md conflict?
settings.json always takes precedence for operational settings (permissions, tools). CLAUDE.md instructions guide Claude’s behavior within the boundaries set by settings.json. For example, settings.json can block a tool that CLAUDE.md recommends using.
How do I configure Claude Code for a CI/CD pipeline?
Use environment variables for authentication (ANTHROPIC_API_KEY), enable headless mode (--dangerously-skip-permissions), and set the model via CLAUDE_MODEL. See GitHub Actions Setup.
How do I manage settings across multiple team members?
Commit .claude/settings.json and CLAUDE.md to your repository for shared settings. Team members use ~/.claude/settings.json for personal preferences. Enterprise teams can use managed settings for organization-wide policies. See Managed Settings Enterprise.
Explore More Guides
- New to Claude Code? Start here
- Configuration best practices
- Fix configuration-related errors
- Troubleshoot config issues
- Advanced configuration patterns
Master Every Configuration Surface
This reference covers the configuration options. For battle-tested configuration patterns, CLAUDE.md templates for 15 tech stacks, and enterprise deployment playbooks, get the Claude Code Mastery Playbook ($99).