> ## Documentation Index
> Fetch the complete documentation index at: https://notes.kodekloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Environment and Configuration Management

> Guide to Claude Code environment and configuration management, covering user project and enterprise scopes, CLAUDE.md project memory, permissions, CLI commands, and best security practices

This lesson explains how Claude Code manages environment and configuration: where settings live, how scoping works (user vs project vs enterprise), how to create a project "memory" file with `CLAUDE.md`, and the CLI commands to inspect or change configuration. Follow these guidelines to keep Claude Code predictable, secure, and team-friendly.

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/Xs8Ruv7b0QCZf7iM/images/Claude-Code-for-Beginners/Getting-Started-with-Claude-Code/Environment-and-Configuration-Management/environment-configuration-management-demo-slide.jpg?fit=max&auto=format&n=Xs8Ruv7b0QCZf7iM&q=85&s=f260ecd5728f1dbe306703f313393801" alt="A presentation slide titled &#x22;Environment and Configuration Management&#x22; with the word &#x22;Demo&#x22; displayed prominently on a dark curved background. A small &#x22;© Copyright KodeKloud&#x22; appears in the bottom-left corner." width="1920" height="1080" data-path="images/Claude-Code-for-Beginners/Getting-Started-with-Claude-Code/Environment-and-Configuration-Management/environment-configuration-management-demo-slide.jpg" />
</Frame>

Overview

* Claude Code uses a combination of configuration files and CLI settings to control permissions, environment variables, telemetry, UI preferences, and other behaviors.
* Settings are applied at three scopes:
  * User-level: personal settings on a developer's machine.
  * Project-level: repository-scoped settings stored under a `.claude` folder and shared with the team.
  * Enterprise-managed: centrally applied, organization-wide managed settings.

Table: Configuration scopes at a glance

| Scope | Applies to | Typical location | Notes |
| - | - | - | - |
| User | Single developer on a machine | `~/.claude/settings.json` (macOS/Linux), `C:\ProgramData\claude-code\settings.json` (Windows) | Personal preferences and CLI defaults |
| Project | Repository and team | `.claude/settings.json` at project root | Checked into source control for team defaults |
| Project (local override) | Single developer in a repo | `.claude/settings.local.json` in `.claude` | Not checked in; Claude Code adds this to `.gitignore` |
| Enterprise | Organization-wide managed settings | system paths (see below) | Enforced by admins; overrides some local settings |

Welcome message (what you see when you start Claude Code in a repo)

```bash theme={null}
✳ Welcome to Claude Code!

/help for help, /status for your current setup

cwd: /Users/jeremy/Repos/Claude Code Course/KodeKloud-METAR-Reader

Tips for getting started:

1. Run /init to create a CLAUDE.md file with instructions for Claude
2. Use Claude to help with file analysis, editing, bash commands and git
3. Be as specific as you would with another engineer for the best results
4. ✔ Run /terminal-setup to set up terminal integration

> Try "write a test for `<filepath>`"

? for shortcuts
```

User-level settings

* Location (typical):
  * macOS / Linux: `~/.claude/settings.json`
  * Windows: `C:\ProgramData\claude-code\settings.json` (or similar under ProgramData)
* These files control your personal defaults (theme, model selection, telemetry opt-ins, etc.). If you use an editor alias (e.g., `code` for VS Code) and it’s not available, the CLI will fall back to another editor like `vim`.

Example: attempting to open the user settings in VS Code when the `code` alias is missing

```bash theme={null}
jeremy@MACSTUDIO KodeKloud-METAR-Reader % code ~/.claude/settings.json
zsh: command not found: code
jeremy@MACSTUDIO KodeKloud-METAR-Reader % vim ~/.claude/settings.json
jeremy@MACSTUDIO KodeKloud-METAR-Reader %
```

Project-level settings

* Use `.claude/settings.json` at the repository root for team-shared defaults and permissions. This file is version-controlled so the whole team receives the same base configuration.
* For per-developer preferences that should not be checked in, use `.claude/settings.local.json`. Claude Code will add this file to `.gitignore` when present.

Example: project-level `settings.json` (valid JSON)

```json theme={null}
{
  "permissions": {
    "allow": [
      "Bash(npm run lint)",
      "Bash(npm run test:*)",
      "Read(~/.zshrc)"
    ],
    "deny": [
      "Bash(curl:*)",
      "Read(./.env)",
      "Read(./.env.*)",
      "Read(./secrets/**)"
    ]
  },
  "env": {
    "CLAUDE_CODE_ENABLE_TELEMETRY": "1",
    "OTEL_METRICS_EXPORTER": "otlp"
  }
}
```

Example: per-developer `settings.local.json` (ignored by git)

```json theme={null}
{
  "cleanupPeriodDays": 7
}
```

Enterprise-managed settings

* Organizations can enforce managed settings which are applied system-wide. These settings typically live in OS-specific paths:

| OS / Environment | Typical managed settings path |
| - | - |
| macOS | `~/Library/Application Support/claude-code/managed-settings.json` |
| Linux / WSL | `/etc/claude-code/managed-settings.json` |
| Windows | `C:\ProgramData\claude-code\managed-settings.json` |

Expanded enterprise settings example (permissions, defaultMode, additional directories)

```json theme={null}
{
  "permissions": {
    "allow": [
      "Bash(npm run lint)",
      "Bash(npm run test:*)",
      "Read(~/.zshrc)"
    ],
    "deny": [
      "Bash(curl:*)",
      "Read(./.env)",
      "Read(./.env.*)",
      "Read(./secrets/**)"
    ],
    "defaultMode": "acceptEdits",
    "additionalDirectories": ["../some-other-project"]
  },
  "env": {
    "CLAUDE_CODE_ENABLE_TELEMETRY": "1",
    "OTEL_METRICS_EXPORTER": "otlp"
  }
}
```

<Callout icon="warning" color="#FF6B6B">
  Enterprise managed settings can override local or project settings in certain areas. If you rely on specific environment variables or permission behavior, confirm with your administrator before assuming local overrides will apply.
</Callout>

Reference documentation

* Full list of settings, permission patterns, and examples: [https://docs.anthropic.com/en/docs/claude-code/settings](https://docs.anthropic.com/en/docs/claude-code/settings)

The CLAUDE.md "memory" file

* `CLAUDE.md` is a per-project file that Claude Code loads into memory at startup. Use it to provide context, development commands, testing instructions, linting/formatting guidance, and anything that helps the assistant act like a project-aware collaborator.
* You can create `CLAUDE.md` with the `/init` command or author it manually.

Example `CLAUDE.md` for a Python Flask application (this is the file content — you can create it with `/init` or ask Claude to generate it):

````markdown theme={null}
This is a Flask web application that decodes METAR aviation weather reports.

## Development Commands

### Environment Setup
```bash
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
pip install -r requirements.txt
```text

### Running the Application
```bash
python app.py
```text

### Testing
```bash
pytest test_app.py -v
```text

### Code Quality
```bash
# Install development dependencies if needed
pip install flake8 black mypy

# Linting
flake8 app.py test_app.py

# Code formatting
black app.py test_app.py
```text

## Dependencies
- requests==2.31.0  — HTTP library for API calls
- pytest==7.4.3     — Testing framework

## Project Structure
`app.py` -- Main Flask application with METAR decoder  
`test_app.py` -- Unit tests  
`templates/` -- HTML templates  
`static/` -- CSS and static files  
`requirements.txt` -- Python dependencies
````

<Callout icon="lightbulb" color="#1CB2FE">
  Keep `CLAUDE.md` concise and focused: include the commands you want Claude to run, important file locations, test instructions, and any known quirks. This improves the assistant's relevance and reduces noisy suggestions.
</Callout>

Notes about CLAUDE.md

* Claude loads `CLAUDE.md` for every session, so include things that help the assistant act immediately (build steps, test commands, primary entry points).
* Avoid embedding secrets in `CLAUDE.md`. Use it for developer-friendly context and commands only.

Common configuration options and UI preferences

* Common toggles and preferences you may find in user or project settings:
  * to-do list visibility
  * checkpointing (useful for reverting assistant-proposed edits)
  * verbose output / logging
  * model selection and safety settings
  * theme (dark/light) and Vim mode
  * diff tool preference and auto-install IDE extension
* Checkpointing is particularly useful when Claude proposes multi-file edits—if a proposed change breaks the build, you can quickly revert to a previous state.

Protecting sensitive files

* Use deny patterns to prevent Claude Code from reading secrets, build artifacts, or any directory you want protected. For example:

```json theme={null}
"permissions": {
  "deny": ["Read(./secrets/**)", "Read(./.env)", "Read(./.env.*)"]
}
```

<Callout icon="warning" color="#FF6B6B">
  Explicitly deny access to any files containing secrets or credentials. Do not rely solely on `.gitignore`—deny patterns prevent the assistant from reading files even if they exist in the repo.
</Callout>

Using the claude CLI

* The `claude` CLI lists, gets, and sets configuration at local or global levels. It's useful for scripting or quick inspection of current settings.

Example: a runtime error when OpenTelemetry environment variables are misconfigured

```console theme={null}
Error: Unknown protocol set in OTEL_EXPORTER_OTLP_METRICS_PROTOCOL or OTEL_EXPORTER_OTLP_PROTOCOL env var: undefined
    at WN6 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:811:354)
    ...
Node.js v24.5.0
```

If the CLI is functional, `claude config list` returns a JSON object with current config:

```bash theme={null}
jeremy@MACSTUDIO KodeKloud-METAR-Reader % claude config list
{
  "allowedTools": [],
  "hasTrustDialogAccepted": true
}
```

Set and get config values

* Set a global config (affects all projects on the machine):

```bash theme={null}
# Set global auto-updates to true
claude config set -g autoUpdates true
```

* Read a specific key:

```bash theme={null}
claude config get allowedTools
# or
claude config get CLAUDE_CODE_ENABLE_TELEMETRY
```

Tip: If you run `claude config set` without a value, the CLI will prompt you. To avoid prompts, always provide the key and value on the command line, for example:

```bash theme={null}
claude config set CLAUDE_CODE_ENABLE_TELEMETRY 0
```

Putting it together — typical project config and workflow

* Recommended workflow:
  1. Create `.claude/settings.json` with team defaults and permission rules.
  2. Add `.claude/settings.local.json` per-developer for local preferences; do not check this in.
  3. Author `CLAUDE.md` with project context, dev commands, and test instructions.
  4. Use `claude config` to inspect or adjust local/global CLI behavior as needed.

Example final checklist for a Python project (commands you can add to `CLAUDE.md` or run locally):

```bash theme={null}
# Environment
python -m venv venv
source venv/bin/activate  # Windows: venv\Scripts\activate
pip install -r requirements.txt

# Run
python app.py

# Test
pytest test_app.py -v

# Lint & format
pip install flake8 black mypy
flake8 app.py test_app.py
black app.py test_app.py
```

This configuration pattern helps Claude Code operate safely and predictably across different machines and teams while preserving developer autonomy for local preferences.

Links and references

* Claude Code settings: [https://docs.anthropic.com/en/docs/claude-code/settings](https://docs.anthropic.com/en/docs/claude-code/settings)
* Kubernetes docs (general reference): [https://kubernetes.io/docs/concepts/overview/what-is-kubernetes/](https://kubernetes.io/docs/concepts/overview/what-is-kubernetes/)
* Docker Hub: [https://hub.docker.com/](https://hub.docker.com/)
* Terraform Registry: [https://registry.terraform.io/](https://registry.terraform.io/)

<CardGroup>
  <Card title="Watch Video" icon="video" cta="Learn more" href="https://learn.kodekloud.com/user/courses/claude-code-for-beginners/module/e36fd287-dee2-4916-a919-953391788143/lesson/1addb4eb-910a-4738-bfbd-60cf54d03be8" />

  <Card title="Practice Lab" icon="flask-conical" cta="Learn more" href="https://learn.kodekloud.com/user/courses/claude-code-for-beginners/module/e36fd287-dee2-4916-a919-953391788143/lesson/81b0c3d8-4e3b-423f-b0cc-b1b2ec4b8ba7" />
</CardGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.