Skip to main content
This guide explains Claude Code’s configuration and environment management: where settings live, how project and personal settings differ, how to protect secrets, how to use the CLAUDE.md memory file to give the assistant project context, and how to use the claude CLI for quick configuration checks and edits. Follow the examples to secure sensitive data and make team-wide settings consistent.

Quick overview: settings types and typical uses


User-level settings

User preferences are kept in a user settings file. Examples: macOS / Linux:
Windows (roaming profile):
A minimal example:
Edit this file with your preferred editor. If code (VS Code CLI) isn’t installed on macOS you may see:
User settings are intended for machine-specific personal preferences and are normally not checked into source control.

Project-level settings (checked into source control)

To share configuration across the team, add a .cloud or .claude folder at the repository root and place a settings.json there. These project-scoped settings are typically committed to the repo so teammates receive the same permissions and environment overrides. Example project settings.json:
Key fields and what they control: For a full list of supported options, see the official docs: https://docs.anthropic.com/en/docs (search for Claude Code settings).

Local, untracked project preferences

Use settings.local.json at the project root for developer-specific overrides that must not be committed. Claude Code will add this file to .gitignore when it detects it. Example settings.local.json:
This is ideal for per-developer experiments, local tokens, or temporary flags.

Enterprise / Managed settings

For centralized administration in larger organizations, put managed-settings.json in system-wide locations:
Managed settings are enforced system-wide and are suitable to block tools, set required telemetry defaults, and enforce deny lists.

Important: protecting secrets

A core security practice is using the permissions block to prevent the assistant from reading secrets and environment files. Example deny rules:
Deny patterns are powerful. Use them to explicitly block access to environment files, a secrets directory, or other sensitive build output.
When composing deny rules:
  • Prefer explicit deny patterns for any credential or token files.
  • Deny recursive folders (e.g., secrets/**) to block subdirectories.
  • Keep project-level deny rules in the committed settings.json to ensure the whole team is protected.

The memory file: CLAUDE.md

CLAUDE.md is a project-scoped memory file that is loaded at assistant startup to provide context: setup steps, common commands, dependencies, and the project layout. This helps the assistant provide accurate, context-aware suggestions. Example CLI output when Claude Code generates CLAUDE.md:
Example CLAUDE.md contents for a Python Flask METAR reader:
Keep CLAUDE.md concise and focused on the commands and structure the assistant needs to bootstrap tasks quickly. Include setup commands, test commands, and any environment quirks.
When present, CLAUDE.md is loaded automatically at startup to prime the model with project-specific context.

CLI: viewing & setting configuration

Claude Code offers a CLI for inspecting and changing settings quickly. Common commands:
  • List all config:
Example output (minimal):
  • Get a config key:
  • Set a config key (local to the repository):
  • Set a config key globally (machine-wide):
Troubleshooting example: OpenTelemetry environment variable errors may appear if env variables in settings are incorrect:
If you see this, check env in your user, project, or managed settings and verify valid values (for example grpc, http/protobuf) per your OpenTelemetry exporter. See OpenTelemetry docs: https://opentelemetry.io/docs/.

Preferences & UX features

Claude Code supports several toggles and UX options that can be set via UI or the CLI:
  • Auto-compact
  • Use todo list (true/false)
  • Checkpointing (recommended)
  • Verbose output
  • Auto-updates
  • Theme (dark/light)
  • Editor mode
  • Model selection
  • Diff tool
  • Auto-install IDE extension
Checkpointing creates automatic rollback points when the assistant makes edits you want to revert. Consider enabling it for critical repositories.

Summary — Best practices for secure, consistent configuration

  • Use the user-level ~/.claude/settings.json for machine-specific preferences.
  • Commit project-wide settings to .cloud or .claude/settings.json so team members share rules and denies.
  • Keep settings.local.json for per-developer untracked overrides and local experiments.
  • Apply managed-settings.json in enterprise environments to centrally enforce policies.
  • Deny reading of .env, secrets/, build output, and other sensitive paths in permissions.deny.
  • Create and maintain a concise CLAUDE.md memory file with setup commands and the project structure to prime the assistant.
  • Use the claude config CLI to inspect and update settings; correct OpenTelemetry environment variables if you receive OTEL-related errors.
These practices will help you manage Claude Code configuration safely and consistently across machines, projects, and organizations.

Watch Video

Practice Lab