Build This Now
Build This Now
What Is Claude Code?Claude Code InstallationClaude Code Native InstallerYour First Claude Code Project
speedy_devvkoen_salo
Blog/Handbook/Setup/Claude Code Configuration

Claude Code Configuration

Three files set Claude Code up per project: CLAUDE.md for context, MCP servers for tools, slash commands for workflows. One hierarchy, every session ready.

Stop configuring. Start building.

SaaS builder templates with AI orchestration.

Published Feb 14, 2026Handbook hubSetup index

Problem: Fresh Claude Code sessions hand back generic answers because they know nothing about your project.

Quick Win: Drop a CLAUDE.md into your project root and the next session reads it before you type a word.

Result: Answers stop sounding like a stock tutorial and start matching your actual stack.

Three files do most of the work. CLAUDE.md gives Claude context. MCP servers give it tools. Slash commands give it workflows. Set up once, reuse everywhere.

Create the Config Files

Two commands start you off:

touch CLAUDE.md                    # Project root - required
mkdir -p .claude/commands          # Custom workflows - optional

That's the whole skeleton. Now fill it in.

CLAUDE.md (Required)

Drop this into the project root. Claude reads it on every session start:

# [Project Name] - Development Context

## What This Project Does

[2-sentence description of your app's purpose]

## Tech Stack & Version

- Frontend: React 18.2.0 with TypeScript 5.0
- Backend: Node.js with Express or Next.js App Router
- Database: PostgreSQL 15 with Prisma ORM
- Styling: Tailwind CSS 3.4

## File Structure

src/
├── app/ # Next.js pages (App Router)
├── components/ # Reusable UI components
├── lib/ # Utilities and configurations
└── types/ # TypeScript definitions

## Current Sprint Goals
- [ ] User authentication system
- [ ] Dashboard with user data
- [ ] API endpoints for CRUD operations

## Never Touch Without Permission
- package.json dependencies (ask first)
- Database migrations (explain changes)
- Production environment variables

Success Check: Claude mentions your stack and sprint goals in its next reply, without being asked.

MCP Servers (Power Features)

MCP (Model Context Protocol) servers bolt real tools onto Claude. Put them in your global settings at ~/.claude/settings.json:

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem"],
      "env": {
        "ACCESS_DIRECTORIES": "/Users/yourname/projects"
      }
    },
    "github": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_your_token_here"
      }
    }
  }
}

What that buys you:

  • Direct file read and write
  • GitHub repository searching
  • Access to project documentation
  • Pattern recognition across your code

Success Check: Claude can now open files and hit GitHub without you pasting anything.

Slash Commands (Reusable Workflows)

Any markdown file under .claude/commands/ becomes a slash command. Name the file, get the command for free.

Debug Workflow (.claude/commands/debug.md):

# Debug Workflow

When debugging:

1. Reproduce the error in isolation
2. Check browser console and network tab
3. Add console.logs to trace execution
4. Test with minimal data
5. Check recent changes in git log
6. Ask before suggesting major architecture changes

Test Generation (.claude/commands/test.md):

# Test Generation Guidelines

For new functions:

1. Write unit tests with Jest/Vitest
2. Test happy path and edge cases
3. Mock external dependencies
4. Use descriptive test names
5. Aim for 80% coverage on critical paths

Usage: Type /debug or /test in any session and Claude runs the workflow.

Success Check: Claude follows the same documented steps every time.

Common Configuration Fixes

ErrorSolution
"MCP server not responding"Check token permissions and directory paths in settings.json
"Context window exceeded"Keep CLAUDE.md under 10KB; split into multiple files if needed
"Claude forgot my project details"Verify CLAUDE.md exists in project root (not .claude/ folder)
"Generic responses despite configuration"Run /init to regenerate CLAUDE.md or reference it explicitly

When CLAUDE.md gets heavy, split it. Keep the root file short and point to the rest:

# Main CLAUDE.md (keep short)

See also:

- .claude/database-schema.md (detailed schema)
- .claude/api-patterns.md (endpoint conventions)

The settings.json Scope System

Past CLAUDE.md, Claude Code uses settings.json files for permissions, env vars, default models, and tool behavior. Four scopes stack, and the narrower one wins:

ScopeLocationWho It AffectsShared?
ManagedSystem-level managed-settings.jsonAll users on the machineYes (deployed by IT)
User~/.claude/settings.jsonYou, across all projectsNo
Project.claude/settings.jsonAll collaborators on the repoYes (committed to git)
Local.claude/settings.local.jsonYou, in this repo onlyNo (gitignored)

Precedence, top to bottom: Managed > Command line args > Local > Project > User. Managed settings always win, so company policy stays enforced.

Add $schema at the top of your settings.json and VS Code, Cursor, or any JSON-schema editor will autocomplete and validate as you type:

{
  "$schema": "https://json.schemastore.org/claude-code-settings.json",
  "permissions": {
    "allow": ["Bash(npm run lint)", "Bash(npm run test *)"],
    "deny": ["Read(./.env)", "Read(./.env.*)", "Read(./secrets/**)"]
  },
  "env": {
    "CLAUDE_CODE_ENABLE_TELEMETRY": "1"
  }
}

Claude Code also timestamps every settings edit and keeps the five most recent backups, so a bad save doesn't cost you anything.

Key Settings Categories

Each category has its own dedicated guide. Short version:

  • Permissions. Gate which tools Claude uses, which files it reads, which commands it runs. Rules go under allow, deny, and ask.
  • Sandbox. Box bash commands away from your filesystem and network, enforced at the OS level. Flip it on with /sandbox or sandbox.enabled.
  • Attribution. Keep or kill the Co-Authored-By trailer on commits and PRs. Commits and PRs configure separately.
  • Plugins. Pull in skills, agents, hooks, and MCP servers from marketplaces. Controlled by enabledPlugins and extraKnownMarketplaces.
  • Model. Pin a default via the model key instead of passing --model every time.
  • Status Line. Put live context usage, git branch, model name, or cost into a persistent bar.
  • Keybindings. Rebind keys with /keybindings, which writes to ~/.claude/keybindings.json.

Essential Environment Variables

Env vars give you the finest control over Claude Code. Set them in your shell profile, pass them inline, or tuck them inside the env key in settings.json. The ones worth knowing:

VariableWhat It Does
ANTHROPIC_MODELSet the default model (e.g., claude-sonnet-4-20250514)
CLAUDE_CODE_MAX_OUTPUT_TOKENSMax output tokens per response. Default: 32,000. Max: 64,000
MAX_THINKING_TOKENSControl the extended thinking budget. Default: 31,999. Set to 0 to disable
CLAUDE_AUTOCOMPACT_PCT_OVERRIDETrigger auto-compaction at a specific context % (1-100)
CLAUDE_CODE_SUBAGENT_MODELSet the model for sub-agents separately from your main model
BASH_DEFAULT_TIMEOUT_MSDefault timeout for long-running bash commands
BASH_MAX_OUTPUT_LENGTHMax characters in bash output before truncation
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFICDisable auto-updates, telemetry, error reporting, and bug reports in one variable
DISABLE_AUTOUPDATERDisable automatic updates only (set to 1)
CLAUDE_CODE_ENABLE_TASKSSet to false to revert to the previous TODO list system
MAX_MCP_OUTPUT_TOKENSMax tokens in MCP tool responses (default: 25,000)
MCP_TIMEOUTTimeout in ms for MCP server startup
CLAUDE_CODE_SHELLOverride automatic shell detection
CLAUDE_CONFIG_DIRStore configuration and data files in a custom directory
HTTP_PROXY / HTTPS_PROXYRoute connections through a proxy server

Three ways to apply them. Inline for a one-off session:

ANTHROPIC_MODEL=claude-sonnet-4-20250514 claude

Persistent, by adding to ~/.bashrc or ~/.zshrc:

export CLAUDE_AUTOCOMPACT_PCT_OVERRIDE=80
export MAX_THINKING_TOKENS=10000

Or bake them into settings.json so they apply every run:

{
  "env": {
    "CLAUDE_AUTOCOMPACT_PCT_OVERRIDE": "80",
    "MAX_THINKING_TOKENS": "10000"
  }
}

Around 70 env vars exist. The settings reference has the full list, and the terminal setup guide covers line breaks and notifications.

Global vs Project Configuration

Global Settings (~/.claude/settings.json):

  • MCP server configurations
  • Personal preferences and model defaults
  • Universal coding standards

Project Settings (project root):

  • CLAUDE.md. Project context and rules.
  • .claude/commands/. Custom slash commands.
  • .claude/settings.json. Team-shared permissions, hooks, and MCP servers.
  • .claude/settings.local.json. Your personal overrides for this project (gitignored).

Priority again, briefly: Managed > Local > Project > User. Run /init and Claude writes a starter CLAUDE.md for you.

Working in a monorepo or sharing standards across repos? The --add-dir flag lets Claude load CLAUDE.md files from extra directories.

Next Steps

Claude Code is now configured. From here:

  • Build your first project on top of the configured setup
  • Pick up terminal control techniques
  • Dig into context management strategies
  • Add more MCP servers from the popular list
  • Hit the troubleshooting guide if anything snags

Pro Tip: Keep CLAUDE.md fresh. Stack changes, priorities shift, sprint goals rotate. Update the file when they do. Claude is only as sharp as the context you feed it.

Continue in Setup

  • Claude Code Sandboxing
    Claude Code sandboxing enforces filesystem and network limits at the kernel. Setup for macOS Seatbelt, Linux and WSL2 bubblewrap, and proxy allowlists.
  • Claude Code Settings Reference
    Every key in settings.json, the full environment variable list, and the five-scope precedence chain that decides which config wins when managed and user clash.
  • Claude Code Terminal Setup Guide
    Match themes, enable Shift+Enter, set notifications, fix long-paste truncation, and turn on vim mode across iTerm2, WezTerm, Ghostty, Kitty, and more terminals.
  • Le sandboxing de Claude Code
    Le sandboxing de Claude Code applique des restrictions sur le système de fichiers et le réseau au niveau du noyau. Configuration pour macOS Seatbelt, Linux, WSL2 bubblewrap et les listes blanches de proxy.
  • Référence des paramètres de Claude Code
    Chaque clé dans settings.json, la liste complète des variables d'environnement, et la chaîne de priorité à cinq niveaux qui décide quelle config gagne quand managed et user s'affrontent.
  • Guide de configuration du terminal pour Claude Code
    Adapte les thèmes, active Shift+Entrée, configure les notifications, corrige la troncature des longs collages, et active le mode vim dans iTerm2, WezTerm, Ghostty, Kitty et d'autres terminaux.

More from Handbook

  • Agent Fundamentals
    Five ways to build specialist agents in Claude Code: Task sub-agents, .claude/agents YAML, custom slash commands, CLAUDE.md personas, and perspective prompts.
  • Agent Harness Engineering
    The harness is every layer around your AI agent except the model itself. Learn the five control levers, the constraint paradox, and why harness design determines agent performance more than the model does.
  • Agent Patterns
    Orchestrator, fan-out, validation chain, specialist routing, progressive refinement, and watchdog. Six orchestration shapes to wire Claude Code sub-agents with.
  • Agent Teams Best Practices
    Battle-tested patterns for Claude Code Agent Teams. Context-rich spawn prompts, right-sized tasks, file ownership, delegate mode, and v2.1.33-v2.1.45 fixes.

Stop configuring. Start building.

SaaS builder templates with AI orchestration.

On this page

Create the Config Files
CLAUDE.md (Required)
MCP Servers (Power Features)
Slash Commands (Reusable Workflows)
Common Configuration Fixes
The settings.json Scope System
Key Settings Categories
Essential Environment Variables
Global vs Project Configuration
Next Steps

Stop configuring. Start building.

SaaS builder templates with AI orchestration.