๐Ÿš€ Claude Code 2.1.80

Complete CLI Reference & Environment Variables Cheatsheet

Last Updated: March 20, 2026 | Version 2.1.80

๐Ÿ“– About This Guide

This comprehensive cheatsheet covers every environment variable, CLI flag, and slash command in Claude Code v2.1.80. Verified against official Anthropic documentation and the anthropics/claude-code CHANGELOG.

Use Ctrl+F (Cmd+F on Mac) to search for any variable, flag, or command.

Quick Start Commands

๐ŸŽฏ Most Used

CommandDescriptionExample
claudeStart interactive REPL sessionclaude
claude "query"Start session with initial promptclaude "explain this function"
claude -p "query"Non-interactive print mode (query and exit)claude -p "review this code"
claude -cContinue most recent conversationclaude -c
claude --continueLong form of -cclaude --continue
claude -r "id" "query"Resume a specific session by IDclaude -r "abc123" "finish the task"
claude --resumeResume last session interactivelyclaude --resume
claude -vShow installed version numberclaude -v
cat file | claude -p "q"Process piped stdincat error.log | claude -p "diagnose"
claude updateUpdate to latest versionclaude update
claude install --forceForce reinstall (bypasses stale locks)claude install --force
claude auth loginAuthenticate with Anthropic accountclaude auth login
claude auth login --consoleAuth via API Console / billing accountclaude auth login --console
claude auth statusCheck current authentication statusclaude auth status
$ claude -p "list all TODO comments in this project" $ cat error.log | claude -p "what caused this?" $ claude --continue "complete the implementation"

CLI Flags (Launch-Time)

โš™๏ธ Configuration

Passed when launching Claude Code to customize session behavior.

๐Ÿ“‚ Working Directory & Scope

FlagDescriptionExample
--add-dirAdd additional working directories (validates paths exist)claude --add-dir ../apps ../lib
-w, --worktreeLaunch in isolated git worktree (loads skills/hooks from worktree dir)claude --worktree
--fork-sessionCreate new session ID when resuming (parallel work branches)claude --fork-session

๐Ÿค– Model & Agents

FlagDescriptionExample
--modelSet model (aliases: sonnet, opus, haiku โ€” or full model ID)claude --model claude-opus-4-6
--agentSpecify a named agent for the sessionclaude --agent general-purpose
--teammate-modeSet team display: auto | in-process | tmuxclaude --teammate-mode in-process
--agentsDefine custom subagents inline via JSON arrayclaude --agents '[{"name":"explorer"}]'
--effortSet thinking effort: low | medium | high | max | autoclaude --effort high

๐Ÿ” Permissions & Security

FlagDescriptionExample
--permission-modeStart in a specific mode (e.g., plan)claude --permission-mode plan
--dangerously-skip-permissionsSkip all permission prompts โš ๏ธ โ€” use only in devcontainer with firewallclaude --dangerously-skip-permissions
--allow-dangerously-skip-permissionsAllow the skip-permissions option without activating itclaude --permission-mode plan --allow-dangerously-skip-permissions
--toolsRestrict built-in tools (works in interactive AND -p mode)claude --tools "Bash,Edit,Read"
--allowedToolsTools that run without prompting for permissionclaude --allowedTools "Write" "Bash(git *)"
--disallowedToolsTools removed from context entirely; cannot be usedclaude --disallowedTools "Bash(rm *)"
--permission-prompt-toolMCP tool to handle permission prompts in -p (non-interactive) modeclaude -p --permission-prompt-tool mcp_auth_tool "q"

๐Ÿ’พ System Prompt Customization

FlagDescriptionExample
--system-promptReplace entire system prompt with custom textclaude --system-prompt "You are a Python expert"
--system-prompt-fileLoad system prompt replacement from file (mutually exclusive with --system-prompt)claude --system-prompt-file ./prompts/custom.txt
--append-system-promptAppend text to the default system prompt (preserves built-in capabilities)claude --append-system-prompt "Always use TypeScript"
--append-system-prompt-fileAppend file contents to the default system promptclaude --append-system-prompt-file ./style-rules.txt
๐Ÿ’ก Tip: All four system prompt flags work in both interactive and -p modes. Append flags preserve built-in capabilities โ€” prefer them over replacement flags unless you need full control.

๐Ÿ“ค Output & Input Formats

FlagDescriptionExample
--output-formattext | json | stream-jsonclaude -p --output-format json "query"
--input-formatSet input format (e.g., stream-json for piped input)claude -p --input-format stream-json
--include-partial-messagesInclude partial streaming events in outputclaude -p --output-format stream-json --include-partial-messages "q"
--json-schemaReturn validated JSON matching a specific schemaclaude -p --json-schema '{"type":"object"}' "query"

๐Ÿ”Œ MCP & Plugins

FlagDescriptionExample
--mcp-configLoad MCP server definitions from a JSON fileclaude --mcp-config ./mcp.json
--strict-mcp-configOnly use servers from --mcp-config; ignore all othersclaude --strict-mcp-config --mcp-config ./mcp.json
--plugin-dirLoad plugins from directory for this session (flag is repeatable)claude --plugin-dir ./plugins --plugin-dir ./more

๐Ÿ”— Web, Remote & Browser

FlagDescriptionExample
--remoteCreate a new web session on claude.aiclaude --remote
--remote-controlBridge terminal session to claude.ai for browser/phone controlclaude --remote-control
--rcAlias for --remote-controlclaude --rc
--teleportResume a web/iOS running session in your local terminalclaude --teleport
--chromeEnable Claude in Chrome browser integration (claude.ai/chrome extension)claude --chrome
--no-chromeDisable Chrome integrationclaude --no-chrome
--channels NEWAllow MCP servers to push messages into your active session (research preview โ€” server must declare claude/channel capability)claude --channels

๐ŸŽ›๏ธ Debugging & Logging

FlagDescriptionExample
--debugEnable debug mode with optional category filterclaude --debug "api,mcp"
--verboseVerbose logging โ€” full turn-by-turn outputclaude --verbose
--mcp-debugDetailed MCP server error informationclaude --mcp-debug

โš™๏ธ Session & Configuration

FlagDescriptionExample
-n, --nameSet a display name for the sessionclaude -n "Feature Implementation"
--max-budget-usdSpending cap for API calls (-p mode only)claude -p --max-budget-usd 10 "query"
--max-turnsLimit agentic turns (-p mode only)claude -p --max-turns 3 "query"
--settingsLoad settings from JSON file or inline JSON stringclaude --settings ./settings.json
--setting-sourcesComma-separated sources: user, project, localclaude --setting-sources user,project
--init-onlyRun initialization hooks then exit without a sessionclaude --init-only

๐Ÿ”ง Miscellaneous CLI Flags

FlagDescriptionExample
--betasBeta headers for API requests (API key users only)claude --betas interleaved-thinking
--disable-slash-commandsDisable all slash commands / skills for this sessionclaude --disable-slash-commands
--sandbox NEWLaunch in an isolated sandbox environment with Tab key tab-switchingclaude --sandbox

Complete Environment Variables Reference

๐ŸŒ All Variables

๐Ÿ”‘ Authentication & API

VariablePurposeExample Value
ANTHROPIC_API_KEYPrimary API key; overrides subscription loginsk-ant-xxx...
ANTHROPIC_AUTH_TOKENCustom Authorization header value (Bearer prefix auto-added)your-token
ANTHROPIC_BASE_URLRoute requests via proxy or custom gatewayhttps://api.example.com
ANTHROPIC_CUSTOM_HEADERSNewline-separated custom HTTP headers (Name: Value)X-Custom: value
ANTHROPIC_FOUNDRY_API_KEYAPI key for Microsoft Azure Foundryxxx...
ANTHROPIC_FOUNDRY_BASE_URLFull base URL for Azure Foundry resourcehttps://foundry.azure.com
ANTHROPIC_FOUNDRY_RESOURCEAzure Foundry resource namemy-resource
ANTHROPIC_FOUNDRY_DEPLOYMENT NEWAzure Foundry deployment name (separate from resource name)my-deployment
CLAUDE_CODE_CLIENT_CERTPath to client certificate for mTLS/path/to/cert.pem
CLAUDE_CODE_CLIENT_KEYPath to private key for mTLS/path/to/key.pem
CLAUDE_CODE_CLIENT_KEY_PASSPHRASEPassphrase for encrypted mTLS client keyyour-passphrase
AWS_BEARER_TOKEN_BEDROCKBedrock API key / bearer token for authenticationxxx...

โ˜๏ธ Cloud Provider Configuration

VariablePurposeValue/Notes
CLAUDE_CODE_USE_BEDROCKRoute through AWS Bedrock1 or true
CLAUDE_CODE_USE_VERTEXRoute through Google Vertex AI1 or true
CLAUDE_CODE_USE_FOUNDRYRoute through Microsoft Azure Foundry1 or true
CLAUDE_CODE_SKIP_BEDROCK_AUTHSkip AWS credential check (e.g., when using an LLM gateway)1
CLAUDE_CODE_SKIP_VERTEX_AUTHSkip Google Cloud credential check1
CLAUDE_CODE_SKIP_FOUNDRY_AUTHSkip Azure credential check1
ANTHROPIC_BEDROCK_BASE_URLProxy URL for Bedrock requests (overrides default Bedrock endpoint)https://your-proxy-url
ANTHROPIC_VERTEX_BASE_URLProxy URL for Vertex AI requestshttps://your-proxy-url
CLOUD_ML_REGIONGoogle Cloud region for Vertex AIus-east5
ANTHROPIC_VERTEX_PROJECT_IDGoogle Cloud project ID for Vertex AImy-project-id
ANTHROPIC_SMALL_FAST_MODEL_AWS_REGIONOverride AWS region for Haiku model on Bedrockus-west-2
VERTEX_REGION_CLAUDE_3_5_HAIKUOverride Vertex AI region for Haiku modelus-central1

๐Ÿค– Model Configuration

VariablePurposeValues/Examples
ANTHROPIC_MODELOverride default model for all requestsclaude-opus-4-6, claude-sonnet-4-6
ANTHROPIC_DEFAULT_SONNET_MODELFull model ID the sonnet alias resolves toclaude-sonnet-4-6
ANTHROPIC_DEFAULT_HAIKU_MODELFull model ID the haiku alias resolves toclaude-haiku-4-5-20251001
ANTHROPIC_DEFAULT_OPUS_MODELFull model ID the opus alias resolves toclaude-opus-4-6
ANTHROPIC_SMALL_FAST_MODELDEPRECATED Haiku-class model for background tasks โ€” use specific varsUse ANTHROPIC_DEFAULT_HAIKU_MODEL
CLAUDE_CODE_SUBAGENT_MODELModel used specifically for subagentsclaude-sonnet-4-6
CLAUDE_CODE_EFFORT_LEVELDefault thinking effort (Opus 4.6 and Sonnet 4.6 only). Default for Max/Team is now medium as of March 2026low | medium | high | max | auto
CLAUDE_CODE_DISABLE_ADAPTIVE_THINKINGDisable adaptive reasoning; revert to fixed MAX_THINKING_TOKENS budget1
MAX_THINKING_TOKENSOverride extended thinking token budget; 0 disables thinking10000 or 0
CLAUDE_CODE_MAX_OUTPUT_TOKENSOverride max output tokens per request (Opus 4.6 default is 64K, upper bound 128K)4096
CLAUDE_CODE_DISABLE_1M_CONTEXTDisable 1M context window; removes 1M variants from /model picker1
ANTHROPIC_CUSTOM_MODEL_OPTIONAdds custom entry at bottom of /model picker (skips ID validation)my-gateway/claude-opus-4-6
ANTHROPIC_CUSTOM_MODEL_OPTION_NAMEDisplay name for the custom model picker entry (optional)Opus via Gateway
ANTHROPIC_CUSTOM_MODEL_OPTION_DESCRIPTIONDisplay description for the custom model picker entry (optional)Custom optimized model

๐Ÿง‘โ€๐Ÿคโ€๐Ÿง‘ Agent Teams (Experimental)

๐Ÿงช Experimental Features

Enables parallel AI agent workflows. Disabled by default.

VariablePurposeValue/Notes
CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMSEnable agent teams feature1 or true
CLAUDE_CODE_TEAM_NAMEName of the agent team โ€” auto-set by Claude Code for teammatesmy-team
CLAUDE_CODE_PLAN_MODE_REQUIREDAuto-set on teammates requiring plan approval (read-only)true (auto-managed)
๐Ÿ“Œ Enable Teams:
CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 claude --teammate-mode in-process

๐Ÿ”ง Bash & Shell Behavior

VariablePurposeDefault / Examples
BASH_DEFAULT_TIMEOUT_MSDefault timeout for long-running bash commands30000 ms
BASH_MAX_TIMEOUT_MSMax timeout the model can request for a bash command300000 ms
BASH_MAX_OUTPUT_LENGTHMax characters in bash output before middle-truncation500000
CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIRReturn to original working dir after each Bash command1
CLAUDE_CODE_SHELLOverride automatic shell detectionbash | zsh | sh
CLAUDE_CODE_SHELL_PREFIXCommand prefix wrapping all bash commands (logging / auditing)time or strace
CLAUDE_ENV_FILEShell script sourced before each Bash command (activate virtualenv, load .env, etc.)venv/bin/activate
CLAUDECODEAuto-set to 1 inside Claude Code-spawned shells โ€” use to detect context in scripts1 (auto-set)

๐Ÿง  Memory, Context & Compaction

VariablePurposeValues / Defaults
CLAUDE_CODE_DISABLE_AUTO_MEMORYDisable automatic memory creation and loading1
CLAUDE_AUTOCOMPACT_PCT_OVERRIDEContext fill % at which auto-compaction triggers95 (default)
CLAUDE_CODE_AUTO_COMPACT_WINDOWToken capacity used for auto-compaction calculationsAuto-calculated
CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MDAlso load CLAUDE.md from --add-dir directories1
CLAUDE_CODE_FILE_READ_MAX_OUTPUT_TOKENSOverride default token limit for file read operationsModel default

๐Ÿ”Œ MCP (Model Context Protocol)

VariablePurposeValues / Examples
MCP_TIMEOUTTimeout (ms) for MCP server startup30000 ms
MCP_TOOL_TIMEOUTTimeout (ms) for individual MCP tool call execution60000 ms
MAX_MCP_OUTPUT_TOKENSMax tokens in MCP tool responses (warning shown above 10K by default)50000
ENABLE_CLAUDEAI_MCP_SERVERSControl claude.ai-managed MCP servers; set false to disablefalse to disable
ENABLE_TOOL_SEARCHMCP tool search mode. Auto-mode is now the default since v2.1.80; defers tools that exceed 10% of contexttrue | auto | auto:N | false
MCP_CLIENT_SECRETOAuth 2.0 client secret for MCP server auth (stored in keychain, not config file)your-secret
MCP_OAUTH_CALLBACK_PORTFixed port for OAuth callback URI (use when server has pre-registered redirect URIs)8888

๐Ÿ“‹ Tasks, Sessions & Scheduling

VariablePurposeValues
CLAUDE_CODE_ENABLE_TASKSEnable task tracking in non-interactive (-p) modetrue
CLAUDE_CODE_TASK_LIST_IDShare a task list across multiple Claude Code instancestask-id-123
CLAUDE_CODE_DISABLE_CRONDisable scheduled cron jobs and /loop immediately1
CLAUDE_CODE_DISABLE_BACKGROUND_TASKSDisable background task execution and Ctrl+B shortcut1
CLAUDE_CODE_EXIT_AFTER_STOP_DELAYAuto-exit after N ms of idle in SDK/print mode5000 ms
CLAUDE_CODE_SESSIONEND_HOOKS_TIMEOUT_MSMax time (ms) for SessionEnd hooks to complete1500 ms

๐Ÿ“ฆ Plugins & Updates

VariablePurposeValues
DISABLE_AUTOUPDATERDisable automatic background updates1
FORCE_AUTOUPDATE_PLUGINSForce plugin auto-updates even when autoupdater is disabled1
CLAUDE_CODE_PLUGIN_GIT_TIMEOUT_MSTimeout (ms) for git ops during plugin install/update120000 (default)
CLAUDE_CODE_PLUGIN_SEED_DIRRead-only plugin seed directory paths for container images (: on Unix, ; on Windows)/path/to/plugins

๐Ÿšซ Disabling Features

VariablePurposeValue
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFICDisables autoupdater, feedback, error reporting, and telemetry โ€” all at once1
DISABLE_TELEMETRYOpt out of Statsig analytics/telemetry1
DISABLE_ERROR_REPORTINGOpt out of Sentry crash/error reporting1
DISABLE_FEEDBACK_COMMANDDisable the /feedback slash command1
DISABLE_BUG_COMMANDAlias for DISABLE_FEEDBACK_COMMAND1
DISABLE_COST_WARNINGSDisable cost warning messages during sessions1
DISABLE_INSTALLATION_CHECKSSuppress installation health warnings at startup1
DISABLE_PROMPT_CACHINGDisable prompt caching globally across all model tiers1
DISABLE_PROMPT_CACHING_HAIKUDisable prompt caching for Haiku tier only1
DISABLE_PROMPT_CACHING_SONNETDisable prompt caching for Sonnet tier only1
DISABLE_PROMPT_CACHING_OPUSDisable prompt caching for Opus tier only1
CLAUDE_CODE_DISABLE_FAST_MODEDisable fast mode globally1
CLAUDE_CODE_DISABLE_TERMINAL_TITLEDisable automatic terminal title/tab updates1
CLAUDE_CODE_DISABLE_GIT_INSTRUCTIONSRemove built-in git/commit instructions from system prompt1
CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETASStrip anthropic-beta headers (for proxies that reject unknown headers)1
CLAUDE_CODE_DISABLE_FEEDBACK_SURVEYDisable "How is Claude doing?" end-of-session surveys1

๐ŸŒ Network & Proxy

VariablePurposeExample Value
HTTP_PROXYHTTP proxy server URLhttp://proxy.example.com:8080
HTTPS_PROXYHTTPS proxy server URLhttps://proxy.example.com:8080
NO_PROXYComma-separated domains/IPs to bypass proxylocalhost,127.0.0.1,.internal.com
CLAUDE_CODE_PROXY_RESOLVES_HOSTSLet the proxy handle DNS resolution instead of the client1
CLAUDE_CODE_SKIP_FAST_MODE_NETWORK_ERRORSAllow fast mode even when org status check fails due to network error1

โš™๏ธ Miscellaneous / Advanced

VariablePurposeExample Value
CLAUDE_CONFIG_DIROverride default config/data directory (default: ~/.claude)~/.my-claude-config
CLAUDE_CODE_TMPDIROverride internal temp directory (Claude Code appends /claude/ to the path)/tmp/my-claude
CLAUDE_CODE_SIMPLEMinimal mode: Bash + file tools only, no MCP/hooks/CLAUDE.md loading1
CLAUDE_CODE_NEW_INITEnable interactive /init onboarding flowtrue
CLAUDE_CODE_ENABLE_PROMPT_SUGGESTIONShow/hide grayed-out prompt suggestions; set false to hidefalse
CLAUDE_CODE_ENABLE_TELEMETRYEnable OpenTelemetry data collection for enterprise monitoring1
CLAUDE_CODE_OTEL_HEADERS_HELPER_DEBOUNCE_MSInterval (ms) for refreshing dynamic OTel authentication headers1740000 (29 min)
CLAUDE_CODE_API_KEY_HELPER_TTL_MSCredentials refresh interval for apiKeyHelper scriptsAuto-managed
SLASH_COMMAND_TOOL_CHAR_BUDGETOverride character budget for slash command / skill metadata loading5000
USE_BUILTIN_RIPGREPBundled ripgrep is used by default; set 0 to use system ripgrep instead0 to use system
IS_DEMODemo mode: hides email/org, skips onboarding1
CLAUDE_CODE_HIDE_ACCOUNT_INFO NEWHide email and organization from the UI (useful for streaming/recording sessions)1
CLAUDE_CODE_ACCOUNT_UUIDSDK callers provide account UUID synchronously at startupUUID format
CLAUDE_CODE_USER_EMAILUser email for SDK / headless modeuser@example.com
CLAUDE_CODE_ORGANIZATION_UUIDOrganization UUID for SDK / headless modeUUID format
CLAUDE_CODE_ENABLE_REMOTE_CONTROL_SERVER NEWEnable remote control server for IDE/web session bridging1

โšก Slash Commands (In-Session)

๐Ÿ’ฌ Interactive Mode Only

Type / anywhere in the prompt โ€” not just at the start โ€” to trigger autocomplete. Custom commands in .claude/commands/ appear namespaced by subdirectory (e.g. /frontend:component).

/help

Show all commands including custom skills and MCP server commands

/clear

Clear conversation history and free context. Aliases: /reset, /new

/exit

Exit Claude Code. Alias: /quit

/rename [name]

Rename the current session title

/status

Show version, model, account, and connectivity status

/release-notes

View the latest release notes at any time

/model [model]

Select or change AI model. Use arrow keys to adjust effort when a supported model is active

/effort [level]

Set effort: low | medium | high | max | auto. Shows what auto currently resolves to

/fast [on|off]

Toggle fast mode (speed-optimized Opus 4.6). Note: prior context is re-billed at fast rates when toggled mid-session

/context

Visualize context usage with optimization suggestions. Skills shown as a separate category

/compact [focus]

Compact conversation, optionally retaining focus (e.g., /compact retain the error handling patterns). Use when context > ~80%

/memory

Edit CLAUDE.md, manage auto-memory, view and edit all imported memory files

/init

Initialize project with an interactive CLAUDE.md guide

/add-dir <path>

Add a new working directory to the current session

/config

Open the tabbed Settings interface. Alias: /settings

/permissions

View/update tool permissions. Press / inside to filter. Alias: /allowed-tools

/keybindings

Create or edit ~/.claude/keybindings.json. Changes take effect immediately

/vim

Enable Vim key bindings for prompt input (also configurable in /config)

/plan [description]

Enter plan mode. Pass a description to start immediately (e.g., /plan fix the auth bug)

/output-style [style]

Set output style. Built-ins: Explanatory, Learning. Custom styles in .claude/output-styles/

/loop [interval] [prompt]

Run a prompt or command on a recurring interval (e.g., /loop 5m check deploy status)

/branch [name]

Fork the current conversation to explore a different path. Alias: /fork

/export [filename]

Export the full conversation as plain text

/copy [N]

Copy last assistant response to clipboard. Press w to write to file instead (useful over SSH)

/btw <question>

Ask a side question without adding it to the main conversation context

/diff

Open the interactive diff viewer for uncommitted changes

/mcp

Manage MCP server connections and OAuth authentication

/plugin

Install, update, and remove Claude Code plugins

/doctor

Diagnose Claude Code installation; validates permission rule syntax and suggests fixes

/debug

Ask Claude to help troubleshoot the current session directly

/stats

Visualize daily usage, session history, and model preferences

/login

Sign in to your Anthropic account (subscription or API Console)

/logout

Sign out from your current account

/feedback

Submit feedback about Claude Code. Alias: /bug

/tasks

List and manage foreground and background tasks. Alias: /bashes

/hooks

View hook configurations for PreToolUse, PostToolUse, and Stop events

/ide

Manage VS Code / JetBrains integrations and show connection status

/color [color]

Set prompt bar color: red, blue, green, yellow, purple, orange, pink, cyan, default

/theme

Open theme selector to change Claude Code's terminal color theme

/remote-control NEW

Bridge terminal session to claude.ai/code โ€” control from any browser or phone

/teleport NEW

Pull a running web/iOS session into your local terminal

/remote-env NEW

Configure environment for remote sessions (claude.ai subscribers)

/desktop NEW

Hand off terminal session to the Desktop app for visual diff review

/sandbox NEW

Launch isolated sandbox environment. Tab / arrow keys switch between tabs

/voice NEW

Toggle voice mode on or off

/terminal NEW

Open an integrated terminal pane within the session

๐ŸŽฏ Quick Reference Matrix

๐Ÿ“Š Common Patterns

TaskCommand / Flag / Variable
Start interactive sessionclaude
Continue previous conversationclaude -c or claude --continue
Quick non-interactive queryclaude -p "query"
Change model to Opusclaude --model claude-opus-4-6
Set effort levelclaude --effort high or CLAUDE_CODE_EFFORT_LEVEL=high
Enable experimental agent teamsCLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1
Use AWS BedrockCLAUDE_CODE_USE_BEDROCK=1 + AWS_REGION=us-east-1
Use Google Vertex AICLAUDE_CODE_USE_VERTEX=1 + CLOUD_ML_REGION=us-east5 + ANTHROPIC_VERTEX_PROJECT_ID=my-proj
Skip permission prompts (devcontainer only)claude --dangerously-skip-permissions
Enter plan mode at launchclaude --permission-mode plan
Add multiple directoriesclaude --add-dir ../apps ../lib
Append to system promptclaude --append-system-prompt "Always use TypeScript"
JSON output in -p modeclaude -p --output-format json "query"
Restrict tools to safe setclaude --tools "Bash,Read,Grep,Edit"
Disable all non-essential trafficCLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1
Load MCP serversclaude --mcp-config ./mcp.json
Enable MCP push channelsclaude --channels
Corporate HTTPS proxyHTTPS_PROXY=http://proxy:8080 claude
Custom shellCLAUDE_CODE_SHELL=zsh claude
Auto-activate virtualenvCLAUDE_ENV_FILE=.venv/bin/activate claude
Fork session for parallel workclaude --fork-session
Isolated git worktreeclaude --worktree
Disable extended thinkingMAX_THINKING_TOKENS=0
Disable 1M context windowCLAUDE_CODE_DISABLE_1M_CONTEXT=1
Bridge session to browser/phoneclaude --remote-control or in-session /remote-control
Pull web session to terminalIn-session: /teleport
Launch sandbox environmentclaude --sandbox
Run recurring check every 5 minIn-session: /loop 5m check deploy status
Hide account info from UICLAUDE_CODE_HIDE_ACCOUNT_INFO=1
Use system ripgrepUSE_BUILTIN_RIPGREP=0
Debug MCP issuesclaude --mcp-debug --verbose

๐Ÿ“ฅ Installation & Setup

๐Ÿš€ Getting Started

โš ๏ธ npm install is deprecated. npm install -g @anthropic-ai/claude-code is no longer the recommended method. Use native installers below. Native installs auto-update in the background.

macOS & Linux โ€” Install Script (Recommended)

# Latest version curl -fsSL https://claude.ai/install.sh | bash # Specific version curl -fsSL https://claude.ai/install.sh | bash -s 2.1.80

macOS โ€” Homebrew

brew install --cask claude-code # Note: Homebrew does NOT auto-update. Run periodically: brew upgrade claude-code

Windows โ€” WinGet (Recommended for Windows)

# Requires Git for Windows installed first winget install Anthropic.ClaudeCode # Note: WinGet does NOT auto-update. Run periodically: winget upgrade Anthropic.ClaudeCode

Windows โ€” PowerShell Script

# Latest irm https://claude.ai/install.ps1 | iex # Specific version & ([scriptblock]::Create((irm https://claude.ai/install.ps1))) 2.1.80

Authentication

# Login with claude.ai subscription claude auth login # Login via Anthropic Console / API billing account claude auth login --console # Or set API key directly export ANTHROPIC_API_KEY=sk-ant-xxx... # Check auth status claude auth status # Logout claude auth logout

Update

# Manual update (native installs also update automatically) claude update # Force reinstall (bypasses stale lock files) claude install --force

npm โ€” Legacy / CI Fallback

# โš ๏ธ DEPRECATED โ€” use native installers above npm install -g @anthropic-ai/claude-code@2.1.80

๐Ÿ’ก Tips & Best Practices

โœจ Pro Tips

๐Ÿ” Search: Ctrl+F (Cmd+F on Mac) to find any variable, flag, or command on this page.
โš™๏ธ Environment Variables: Set temporarily by prefixing your command, or permanently in your shell profile. Can also be set under env in ~/.claude/settings.json for team-wide rollout.
๐Ÿงช Experimental Features: Agent teams and some v2.1.80 features are experimental โ€” avoid in production without testing.
๐Ÿ“ Context Management: Use /compact when context > ~80% (instant since v2.0.64). Use /clear when switching to an unrelated task entirely.
๐Ÿ” Security: --dangerously-skip-permissions bypasses all safety checks. Use only in a devcontainer with a firewall configured โ€” never on your main machine.
๐Ÿ’ฐ Cost: Enabling fast mode mid-session re-bills the entire prior context at fast rates. Use --max-budget-usd to cap spending in -p mode.
๐ŸŽฏ Model Choice: Opus 4.6 (1M context, 64K output) for complex reasoning; Sonnet 4.6 for daily work; Haiku for subagents and cheap searches. Default effort for Max/Team Opus subscribers changed to medium in March 2026.
๐Ÿ†• v2.1.80 Highlights: --channels for MCP push messages, --sandbox for isolation, /remote-control + /teleport + /desktop for cross-surface workflows, /loop for recurring tasks, /voice / /terminal, MCP tool-search auto mode on by default, CLAUDE_CODE_HIDE_ACCOUNT_INFO, npm install deprecated.

๐ŸŽ“ Real-World Examples

Example 1: Agent Teams (Experimental)

export CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 claude --teammate-mode in-process --permission-mode plan

Example 2: High-Effort Analysis on Opus

claude --model claude-opus-4-6 --effort high \ --append-system-prompt "Focus on security and performance implications"

Example 3: Privacy / Air-Gap Setup

export CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1 export ANTHROPIC_API_KEY=sk-ant-xxx... claude

Example 4: Enterprise Bedrock with Proxy & Pinned Models

export HTTPS_PROXY=http://corporate-proxy:8080 export CLAUDE_CODE_USE_BEDROCK=1 export AWS_REGION=us-east-1 # Pin exact model versions to prevent breakage on Anthropic updates export ANTHROPIC_DEFAULT_OPUS_MODEL='us.anthropic.claude-opus-4-6-v1' export ANTHROPIC_DEFAULT_SONNET_MODEL='us.anthropic.claude-sonnet-4-6' export ANTHROPIC_DEFAULT_HAIKU_MODEL='us.anthropic.claude-haiku-4-5-20251001-v1:0' export CLAUDE_CODE_SHELL_PREFIX="time" # Audit command timings claude

Example 5: CI/CD Integration (Fully Automated)

# Best run inside a devcontainer with firewall claude -p \ --output-format json \ --max-turns 10 \ --max-budget-usd 5 \ --dangerously-skip-permissions \ --tools "Bash,Read,Grep,Edit,Write" \ "Analyze this PR for security vulnerabilities and output findings" \ > analysis.json

Example 6: Strict MCP-Only Environment

claude \ --mcp-config ./mcp-servers.json \ --strict-mcp-config \ --plugin-dir ./plugins \ --append-system-prompt "Use MCP tools for all external data"

Example 7: Python Virtual Environment Auto-Activation

export CLAUDE_ENV_FILE=.venv/bin/activate export CLAUDE_CODE_SHELL=bash claude --add-dir ./backend ./frontend

Example 8: Debug MCP & API Issues

claude --verbose --mcp-debug --debug "api,mcp,hooks" \ --append-system-prompt "Include diagnostic details in responses"

Example 9: Remote Control & MCP Channels (v2.1.80)

# Bridge terminal to browser or phone claude --remote-control # Or enable MCP push channels (server must declare claude/channel capability) claude --channels --mcp-config ./mcp-servers.json # Or start a session then bridge mid-session claude # then type: /remote-control

Example 10: Recurring Monitor with /loop

claude # then type: /loop 10m check test suite status and summarize any failures

Example 11: Cross-Surface Workflow

# Start long-running task on claude.ai web # Later, pull it into your terminal: claude # then type: /teleport # Or hand a terminal session off to the Desktop app for visual diff: # type: /desktop