> ## 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.

# Demo Environment and Configuration Management

> Guide to Claude Code configuration and environment management, covering settings scopes and locations, secret protection, CLAUDE.md project memory, and the claude CLI for inspecting and editing settings.

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

| Settings Type        | Scope                 | Typical Path(s)                                                                                                                                                                                 | Use Case                                                                                            |
| -------------------- | --------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
| User-level           | Single user / machine | macOS/Linux: `~/.claude/settings.json`<br />Windows: `C:\Users\<YourUser>\AppData\Roaming\ClaudeCode\settings.json`                                                                             | Personal preferences (editor, telemetry opt-in, UI flags). Not usually checked into source control. |
| Project-level        | Repository-scoped     | `<repo>/.cloud/settings.json` or `<repo>/.claude/settings.json`                                                                                                                                 | Team-shared rules, tool permissions, environment overrides. Committed to repo.                      |
| Local (untracked)    | Developer override    | `<repo>/settings.local.json` (gitignored)                                                                                                                                                       | Personal experiments, local tokens, per-developer preferences.                                      |
| Managed / Enterprise | Organization-managed  | macOS: `/Library/Application Support/ClaudeCode/managed-settings.json`<br />Linux/WSL: `/etc/claude-code/managed-settings.json`<br />Windows: `C:\ProgramData\ClaudeCode\managed-settings.json` | Centrally enforced policies for telemetry, tool access, denied paths.                               |

***

## User-level settings

User preferences are kept in a user settings file. Examples:

macOS / Linux:

```bash theme={null}
~/.claude/settings.json
```

Windows (roaming profile):

```text theme={null}
C:\Users\<YourUser>\AppData\Roaming\ClaudeCode\settings.json
```

A minimal example:

```json theme={null}
{
  "$schema": "https://json.schemastore.org/claude-code-settings.json",
  "feedbackSurveyState": {
    "lastShownTime": 1754343213656
  }
}
```

Edit this file with your preferred editor. If `code` (VS Code CLI) isn't installed on macOS you may see:

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

# fallback
jeremy@MACSTUDIO KodeKloud-METAR-Reader % vim ~/.claude/settings.json
```

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`:

```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_EXPORTER_OTLP_METRICS_PROTOCOL": "grpc"
  }
}
```

Key fields and what they control:

| Field                   | Purpose                                                                                  |
| ----------------------- | ---------------------------------------------------------------------------------------- |
| `permissions.allow`     | Controls which automatic/invoked tools or file reads the assistant can perform.          |
| `permissions.deny`      | Blocks access to sensitive files, folders and commands.                                  |
| `defaultMode`           | Controls edit behavior (for example, `acceptEdits`).                                     |
| `additionalDirectories` | Grants the assistant access to sibling repos or extra project paths.                     |
| `env`                   | Environment variables to set when running tools or the assistant in the project context. |

For a full list of supported options, see the official docs: [https://docs.anthropic.com/en/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`:

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

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:

```text theme={null}
macOS: /Library/Application Support/ClaudeCode/managed-settings.json
Linux/WSL: /etc/claude-code/managed-settings.json
Windows: C:\ProgramData\ClaudeCode\managed-settings.json
```

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:

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

<Callout icon="lightbulb" color="#1CB2FE">
  Deny patterns are powerful. Use them to explicitly block access to environment files, a secrets directory, or other sensitive build output.
</Callout>

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:

```bash theme={null}
# Example created by Claude Code
Wrote 49 lines to CLAUDE.md
```

Example `CLAUDE.md` contents for a Python Flask METAR reader:

````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
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
- pytest==7.4.3

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

<Callout icon="lightbulb" color="#1CB2FE">
  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.
</Callout>

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:

```bash theme={null}
claude config list
```

Example output (minimal):

```json theme={null}
{
  "allowedTools": [],
  "hasTrustDialogAccepted": true
}
```

* Get a config key:

```bash theme={null}
claude config get <key>
```

* Set a config key (local to the repository):

```bash theme={null}
claude config set <key> <value>
```

* Set a config key globally (machine-wide):

```bash theme={null}
claude config set -g autoUpdates true
```

Troubleshooting example: OpenTelemetry environment variable errors may appear if `env` variables in settings are incorrect:

```text theme={null}
Error: Unknown protocol set in OTEL_EXPORTER_OTLP_METRICS_PROTOCOL or OTEL_EXPORTER_OTLP_PROTOCOL env var: undefined
```

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/](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.

***

## Links and references

* Claude Code settings reference: [https://docs.anthropic.com/en/docs](https://docs.anthropic.com/en/docs)
* OpenTelemetry: [https://opentelemetry.io/docs/](https://opentelemetry.io/docs/)
* JSON Schema for settings (example): [https://json.schemastore.org/claude-code-settings.json](https://json.schemastore.org/claude-code-settings.json)

<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/7de59707-0f2a-411d-aeac-63be6d321a7c" />
</CardGroup>
