MCP Server / claude code guide
claude code guide
Claude Code Guide - Setup, Commands, workflows, agents, skills & tips-n-tricks go from beginner to power user!
Installation
claude mcp add claude-code-guide -- npx -y claude
npx -y claude
npm: claude
Transport
Tools (7)
Section
Status
light
light-daltonized
iterm2_with_bell
terminal_bell
Location
Purpose
Command
Purpose
Description
Example
light
light-daltonized
Dokumentation
For updates and contributions, visit the official Claude Code documentation
| Section | Status | Other Resources | | ------------------------------------------------- | ------ |------ | | Getting Started |✅| Claude-Code Changelogs | | Configuration & Environment Variables |✅|Claude-Code via Discord | | Commands & Usage |✅|Security Agents SKILL.md | | Interface & Input |✅|Let Agent Create SKILL.md | | Advanced Features |✅|954+ Agent Skills | | Automation & Integration |✅|No cost ai resources | | Help & Troubleshooting |✅|250+ Mermaid templates | | Third-Party Integrations |✅|Discord Communication MCP |
Quick links: Install · Commands · Shortcuts · MCP · Troubleshoot
-
- Thinking Mode
- Plan Mode
- Fast Mode
- Background Tasks
- Claude in Chrome
- Sandbox Mode
- LSP Tool
- Remote Sessions
- Sub Agents
- Agent Teams
- Skills
- Plugin System
- Worktree Isolation
- MCP Integration
- Hooks System
- Native Installer
- Authentication CLI
- Agent Management CLI
- Remote Control
- Managed Settings
- Model Updates
- Insights
Enable sound alerts when claude completes the task:
claude config set --global preferredNotifChannel terminal_bell
[!TIP] Send claude or npx claude in terminal to start the interface
Go to Help & Troubleshooting to fix issues...
# Native Installer (preferred — no Node.js required) ⭐️
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
# Windows
/* Via CMD (native) */ curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd
/* Via Powershell */ irm https://claude.ai/install.ps1 | iex
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
# macOS / Linux / WSL
/* Via Terminal */ curl -fsSL https://claude.ai/install.sh | bash
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
# Arch
/* Via Terminal */ yay -S claude-code*/
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
# Alternative (npm) — deprecated in favor of native installer
# Requires Node.js 18+
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
# Windows
/* Via CMD (npm) */ npm install -g @anthropic-ai/claude-code
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
# macOS
/* Via Terminal */ brew install node && npm install -g @anthropic-ai/claude-code
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
# Linux
/* Via Terminal */ sudo apt update && sudo apt install -y nodejs npm
/* Via Terminal */ npm install -g @anthropic-ai/claude-code
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
# WSL/GIT
/* Via Terminal */ npm install -g @anthropic-ai/claude-code
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
# Docker
/* Windows (CMD) */ docker run -it --rm -v "%cd%:/workspace" -e ANTHROPIC_API_KEY="sk-your-key" node:20-slim bash -lc "npm i -g @anthropic-ai/claude-code && cd /workspace && claude"
/* macOS/Linux (bash/zsh)*/ docker run -it --rm -v "$PWD:/workspace" -e ANTHROPIC_API_KEY="sk-your-key" node:20-slim bash -lc 'npm i -g @anthropic-ai/claude-code && cd /workspace && claude'
/* No bash Fallback */ docker run -it --rm -v "$PWD:/workspace" -e ANTHROPIC_API_KEY="sk-your-key" node:20-slim sh -lc 'npm i -g @anthropic-ai/claude-code && cd /workspace && claude'
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
# Check if claude is installed correctly
/* Linux */ which claude
/* Windows */ where claude
/* Universal */ claude --version
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
# Common Management
/*claude config */ Configure settings
/*claude mcp list */ Setup MCP servers, you can also replace "list" with add/remove
/*claude /agents */ Configure/Setup Subagents for different tasks
/*claude update */ Update to latest
[!Tip] Open Project Via Terminal Into VS Code / Cursor
$ - cd /path/to/project
$ - code .
Make sure you have the (Claude Code extension) installed in your VS Code / Cursor
- OS: macOS 10.15+, Ubuntu 20.04+/Debian 10+, or Windows 10/11 or WSL
- Hardware: 4GB RAM minimum 8GB+ recommended
- Software: Node.js 18+ or git 2.23+ (optional) & GitHub or GitLab CLI for PR workflows (optional)
- Node.js is only required for npm-based installation. The native installer bundles its own runtime.
- Internet: Connection for API calls
- Node.js 18+ (only required for npm-based installation; the native installer bundles its own runtime)
[!Tip] Find API key from Anthropic Console
Do NOT commit real keys use git-ignored files, OS key stores, or secret managers
# Universal
/* start login process */ claude /login
/* Setup long-lived authentication token */ claude setup-token
/* Authenticate via Anthropic account */ claude auth login
----------------------------------------------------------------------------------------------------------------------------------
# Windows
/* Set-api-key */ set ANTHROPIC_API_KEY=sk-your-key-here-here
/* cmd-masked-check */ echo OK: %ANTHROPIC_API_KEY:~0,8%***
/* Set-persistent-key */ setx ANTHROPIC_API_KEY "sk-your-key-here-here"
/* cmd-unset-key */ set ANTHROPIC_API_KEY=
----------------------------------------------------------------------------------------------------------------------------------
# Linux
/* Set-api-key */ export ANTHROPIC_API_KEY="sk-your-key-here-here"
/* masked-check */ echo "OK: ${ANTHROPIC_API_KEY:0:8}***"
/* remove-session */ unset ANTHROPIC_API_KEY
----------------------------------------------------------------------------------------------------------------------------------
# Powershell
/* ps-session */ $env:ANTHROPIC_API_KEY = "sk-your-key-here-here"
/* ps-masked-check */ "OK: $($env:ANTHROPIC_API_KEY.Substring(0,8))***"
/* ps-persist */ [Environment]::SetEnvironmentVariable("ANTHROPIC_API_KEY","sk-your-key-here-here","User")
/* ps-rotate */ $env:ANTHROPIC_API_KEY = "sk-new-key"
/* ps-remove */ Remove-Item Env:\ANTHROPIC_API_KEY
----------------------------------------------------------------------------------------------------------------------------------
# Other...
# persist-bash/* */ echo 'export ANTHROPIC_API_KEY="sk-your-key-here-here"' >> ~/.bashrc && source ~/.bashrc
# persist-zsh /* */ echo 'export ANTHROPIC_API_KEY="sk-your-key-here-here"' >> ~/.zshrc && source ~/.zshrc
# persist-fish/* */ fish -lc 'set -Ux ANTHROPIC_API_KEY sk-your-key-here-here'
----------------------------------------------------------------------------------------------------------------------------------
You can also set any of these in settings.json under the "env" key for automatic application.
[!Important] Windows Users replace export with set or setx for perm
# Environment toggles (put in ~/.bashrc or ~/.zshrc)
export ANTHROPIC_API_KEY="sk-your-key-here-here" # API key sent as X-Api-Key header (interactive usage: /login)
export ANTHROPIC_AUTH_TOKEN="my-auth-token" # Custom Authorization header; Claude adds "Bearer " prefix automatically
export ANTHROPIC_CUSTOM_HEADERS="X-Trace-Id: 12345" # Extra request headers (format: "Name: Value")
export ANTHROPIC_MODEL="claude-sonnet-4-6-20260217" # Custom model name to use
export ANTHROPIC_DEFAULT_SONNET_MODEL="claude-sonnet-4-6-20260217" # Default Sonnet model alias
export ANTHROPIC_DEFAULT_OPUS_MODEL="claude-opus-4-6-20260130" # Default Opus model alias (Opus 4.6 now available)
export ANTHROPIC_SMALL_FAST_MODEL="haiku-model" # Haiku-class model for background tasks (placeholder)
export ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION="REGION" # Override AWS region for the small/fast model on Bedrock (placeholder)
export AWS_BEARER_TOKEN_BEDROCK="bedrock_..." # Amazon Bedrock API key/token for authentication
export BASH_DEFAULT_TIMEOUT_MS=60000 # Default timeout (ms) for long-running bash commands
export BASH_MAX_TIMEOUT_MS=300000 # Maximum timeout (ms) allowed for long-running bash commands
export BASH_MAX_OUTPUT_LENGTH=20000 # Max characters in bash outputs before middle-truncation
export CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR=1 # (0 or 1) return to original project dir after each Bash command
export CLAUDE_BASH_NO_LOGIN=1 # When set, BashTool does not use a login shell. Default behavior changed in v2.1.51 (login shell used only as fallback).
export CLAUDE_CODE_API_KEY_HELPER_TTL_MS=600000 # Interval (ms) to refresh creds when using apiKeyHelper
export CLAUDE_CODE_IDE_SKIP_AUTO_INSTALL=1 # (0 or 1) skip auto-installation of IDE extensions
export CLAUDE_CODE_MAX_OUTPUT_TOKENS=4096 # Max number of output tokens for most requests
export CLAUDE_CODE_USE_BEDROCK=1 # (0 or 1) use Amazon Bedrock
export CLAUDE_CODE_USE_VERTEX=0 # (0 or 1) use Google Vertex AI
export CLAUDE_CODE_SKIP_BEDROCK_AUTH=0 # (0 or 1) skip AWS auth for Bedrock (e.g., via LLM gateway)
export CLAUDE_CODE_SKIP_VERTEX_AUTH=0 # (0 or 1) skip Google auth for Vertex (e.g., via LLM gateway)
export CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=0 # (0 or 1) disable nonessential traffic (equivalent to DISABLE_* below)
export CLAUDE_CODE_DISABLE_TERMINAL_TITLE=0 # (0 or 1) disable automatic terminal title updates
export CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 # (0 or 1) enable agent teams research preview
export CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD=1 # (0 or 1) load CLAUDE.md from --add-dir paths
export CLAUDE_CODE_ENABLE_TASKS=false # Set to "false" to disable new task system
export DISABLE_AUTOUPDATER=0 # (0 or 1) disable automatic updates (overrides autoUpdates setting)
export DISABLE_BUG_COMMAND=0 # (0 or 1) disable the /bug command
export DISABLE_COST_WARNINGS=0 # (0 or 1) disable cost warning messages
export DISABLE_ERROR_REPORTING=0 # (0 or 1) opt out of Sentry error reporting
export DISABLE_NON_ESSENTIAL_MODEL_CALLS=0 # (0 or 1) disable model calls for non-critical paths
export DISABLE_TELEMETRY=0 # (0 or 1) opt out of Statsig telemetry
export HTTP_PROXY="http://proxy:8080" # HTTP proxy server URL
export HTTPS_PROXY="https://proxy:8443" # HTTPS proxy server URL
export MAX_THINKING_TOKENS=0 # (0 or 1 to turn off/on) force a thinking budget for the model
export MCP_TIMEOUT=120000 # MCP server startup timeout (ms)
export MCP_TOOL_TIMEOUT=60000 # MCP tool execution timeout (ms)
export MAX_MCP_OUTPUT_TOKENS=25000 # Max tokens allowed in MCP tool responses (default 25000)
export USE_BUILTIN_RIPGREP=0 # (0 or 1) set 0 to use system-installed rg instead of bundled one
export VERTEX_REGION_CLAUDE_3_5_HAIKU="REGION" # Region override for Claude 3.5 Haiku on Vertex AI (legacy model family name)
export VERTEX_REGION_CLAUDE_3_5_SONNET="REGION" # Region override for Claude 3.5 Sonnet on Vertex AI (legacy model family name)
export VERTEX_REGION_CLAUDE_3_7_SONNET="REGION" # Region override for Claude 3.7 Sonnet on Vertex AI (legacy model family name)
# Note: CLAUDE_3_5_* and CLAUDE_3_7_* use legacy model family names and may be updated in future versions.
export VERTEX_REGION_CLAUDE_4_0_OPUS="REGION" # Region override for Claude 4.0 Opus on Vertex AI
export VERTEX_REGION_CLAUDE_4_0_SONNET="REGION" # Region override for Claude 4.0 Sonnet on Vertex AI
export VERTEX_REGION_CLAUDE_4_1_OPUS="REGION" # Region override for Claude 4.1 Opus on Vertex AI
export VERTEX_REGION_CLAUDE_4_6_OPUS="REGION" # Region override for Claude 4.6 Opus on Vertex AI
export VERTEX_REGION_CLAUDE_4_6_SONNET="REGION" # Region override for Claude 4.6 Sonnet on Vertex AI
# ── New in v2.1.32–2.1.63 ──────────────────────────────────────────────────────
export CLAUDE_CODE_SIMPLE=1 # Minimal mode: disables MCP tools, attachments, hooks, CLAUDE.md, and skills
export CLAUDE_CODE_DISABLE_1M_CONTEXT=1 # Disable 1 M-token context window (use default shorter context)
export CLAUDE_CODE_DISABLE_BACKGROUND_TASKS=1 # Disable background tasks entirely
export CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1 # Opt out of experimental beta features
export CLAUDE_CODE_AUTO_CONNECT_IDE=false # Disable automatic IDE connection on startup
export CLAUDE_CODE_TMPDIR="/custom/tmp" # Override the temp directory Claude Code uses
export CLAUDE_CODE_SHELL="/bin/zsh" # Override shell detection (force a specific shell)
export CLAUDE_CODE_SHELL_PREFIX="command-wrapper" # Prefix/wrap every shell command Claude runs
export CLAUDE_CODE_FILE_READ_MAX_OUTPUT_TOKENS=50000 # Override max output tokens for the Read tool
export CLAUDE_CODE_PROXY_RESOLVES_HOSTS=true # Let the HTTP/HTTPS proxy handle DNS resolution
export CLAUDE_CODE_EXIT_AFTER_STOP_DELAY=30000 # Auto-exit SDK mode after idle for N ms
export CLAUDE_CODE_PLUGIN_GIT_TIMEOUT_MS=30000 # Timeout (ms) for plugin git operations
export CLAUDE_CODE_ACCOUNT_UUID="uuid" # Override account UUID (SDK / automation flows)
export CLAUDE_CODE_USER_EMAIL="[email protected]" # Override user email (SDK / automation flows)
export CLAUDE_CODE_ORGANIZATION_UUID="uuid" # Override organization UUID (SDK / automation flows)
export ENABLE_CLAUDEAI_MCP_SERVERS=false # Opt out from claude.ai-synced MCP servers
export FORCE_AUTOUPDATE_PLUGINS=1 # Allow plugin auto-update even when main updater is disabled
export IS_DEMO=1 # Demo mode — hides email/org from the UI
export NO_PROXY="localhost,127.0.0.1" # Bypass proxy for specified hosts (comma-separated)
claude config set -g theme dark # Theme: dark | light | light-daltonized | dark-daltonized
claude config set -g preferredNotifChannel iterm2_with_bell # Notification channel: iterm2 | iterm2_with_bell | terminal_bell | notifications_disabled
claude config set -g autoUpdates true # Auto-download & install updates (applied on restart)
claude config set -g verbose true # Show full bash/command outputs
claude config set -g attribution false # Omit "co-authored-by Claude" in git commits/PRs
claude config set -g forceLoginMethod claudeai # Restrict login flow: claudeai | console
claude config set -g model "claude-sonnet-4-6-20260217" # Default model override
claude config set -g statusLine '{"type":"command","command":"~/.claude/statusline.sh"}' # Custom status line
claude config set -g enableAllProjectMcpServers true # Auto-approve all MCP servers from .mcp.json
claude config set -g enabledMcpjsonServers '["memory","github"]' # Approve specific MCP servers
claude config set -g disabledMcpjsonServers '["filesystem"]' # Reject specific MCP servers
(Memory type) Claude Code offers four memory locations in a hierarchical structure, each serving a different purpose:
| Memory Type | Location | Purpose | Use Case Examples | Shared With |
| -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------- | -------------------------------------------------------------------- | ------------------------------- |
| Enterprise policy | macOS: /Library/Application Support/ClaudeCode/CLAUDE.mdLinux: /etc/claude-code/CLAUDE.mdWindows: C:\ProgramData\ClaudeCode\CLAUDE.md | Organization-wide instructions managed by IT/DevOps | Company coding standards, security policies, compliance requirements | All users in organization |
| Project memory | ./CLAUDE.md | Team-shared instructions for the project | Project architecture, coding standards, common workflows | Team members via source control |
| User memory | ~/.claude/CLAUDE.md | Personal preferences for all projects | Code styling preferences, personal tooling shortcuts | Just you (all projects) |
| Project memory (local) | ./CLAUDE.local.md | Personal project-specific preferences (git-ignored) | Your sandbox URLs, preferred test data, personal overrides | Just you (current project) |
| Project rules | .claude/rules/*.md | Modular project rules (loaded alongside CLAUDE.md) | Linting rules, API conventions, per-directory standards | Team members via source control |
All memory files are automatically loaded into Claude Code's context when launched. Files higher in the hierarchy take precedence and are loaded first, providing a foundation that more specific memories build upon.
.claude/rules/ Directory (v2.0.64+)
The .claude/rules/ directory lets you break project instructions into separate Markdown files instead of one large CLAUDE.md. Every *.md file inside is automatically loaded into context alongside CLAUDE.md. This is useful for:
- Modular organization: Separate concerns (e.g.,
api-conventions.md,testing-rules.md) - Per-directory overrides: Nested
rules/directories can apply scoped rules - Team collaboration: Different team members can own different rule files via PR review
Auto-Memory (v2.1.32+)
Claude now automatically saves useful context to memory during your sessions. Managed memories include things like project conventions, tooling preferences, and architectural decisions that Claude observed while working with you. Use /memory to view and manage auto-saved memories.
| Command | Purpose |
| :------------------------ | :------------------------------------------------------------------------------------------------------- |
| /add-dir | Add additional working directories |
| /agents | Manage custom AI subagents for specialized tasks |
| /bug | Report bugs (sends conversation to Anthropic) |
| /clear | Clear conversation history |
| /compact [instructions] | Compact conversation with optional focus instructions |
| /config | Open the Settings interface (Config tab) |
| /context | Visualize current context usage as a colored grid |
| /copy | Copy conversation content to clipboard |
| /cost | Show token usage statistics and billing information |
| /debug | Troubleshoot current session and diagnose issues |
| /doctor | Checks the health of your Claude Code installation |
| /exit | Exit the REPL |
| /export [filename] | Export the current conversation to a file or clipboard |
| /extra-usage | Enable extra usage mode (required before /fast) |
| /fast | Toggle fast mode for accelerated Opus 4.6 responses |
| /fork | Fork the current conversation into a new session |
| /help | Get usage help |
| /init | Initialize project with CLAUDE.md guide |
| /insights | Generate an interactive HTML report analyzing your coding habits |
| /keybindings | Configure custom keyboard shortcuts |
| /login | Switch Anthropic accounts |
| /logout | Sign out from your Anthropic account |
| /mcp | Manage MCP server connections and OAuth authentication |
| /memory | Edit CLAUDE.md memory files |
| /model | Select or change the AI model |
| /permissions | View or update tool permissions |
| /plan | Enter plan mode directly from the prompt |
| /plugins | Manage plugins (install, enable, disable, marketplace) |
| /pr_comments | View pull request comments |
| /rename <name> | Rename the current session for easier identification |
| /resume [session] | Resume a conversation by ID or name, or open session picker |
| /review | Request code review |
| /rules | View and manage .claude/rules/ directory (modular project rules) |
| /rewind | Rewind the conversation and/or code to a previous point |
| /sandbox | View sandbox dependency status with installation instructions |
| /stats | Visualize daily usage, session history, streaks, and model preferences |
| /settings | Open Settings interface (alias for /config) |
| /simplify | Simplify selected code or conversation (bundled skill) |
| /status | Open Settings interface (Status tab) showing version, model, account |
| /statusline | Set up Claude Code's status line UI |
| /tasks | List and manage background tasks |
| /teleport | Resume a remote session from claude.ai (subscribers only) |
| /terminal-setup | Install Shift+Enter key binding for newlines (iTerm2, VS Code, Kitty, Alacritty, Zed, Warp, and WezTerm) |
| /remote-env | Configure remote environment settings |
| /theme | Change the color theme |
| /todos | List current TODO items |
| /usage | Show plan usage limits and rate limit status (subscription plans) |
| /vim | Enter vim mode for alternating insert and command modes |
| /batch | Run batch operations on multiple files (bundled skill) |
| Flag / Command | Description | Example |
| :--------------------------------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------- |
| -d, --debug | Enable debug mode (shows detailed debug output). | claude -d -p "query" |
| --include-partial-messages | partial message streaming support via CLI flag |
| --mcp-debug | [DEPRECATED] MCP debug mode (shows MCP server errors). Use --debug instead. | claude --mcp-debug |
| --verbose | Override verbose mode setting from config (shows expanded logging / turn-by-turn output). | claude --verbose |
| -p, --print | Print response and exit (useful for piping output). | claude -p "query" |
| --output-format <format> | Output format (only works with --print): text (default), json (single result), or stream-json (realtime streaming). | claude -p "query" --output-format json |
| --input-format <format> | Input format (only works with --print): text (default) or stream-json (realtime streaming input). | claude -p --output-format stream-json --input-format stream-json |
| --replay-user-messages | Re-emit user messages from stdin back to stdout for acknowledgment — only works with --input-format=stream-json and --output-format=stream-json. | claude --input-format stream-json --output-format stream-json --replay-user-messages |
| --allowedTools, --allowed-tools <tools...> | Comma/space-separated list of tool names to allow (e.g. "Bash(git:*) Edit"). | --allowed-tools "Bash(git:*)" Edit" |
| --disallowedTools, --disallowed-tools <tools...> | Comma/space-separated list of tool names to deny (e.g. "Bash(git:*) Edit"). | --disallowed-tools "Edit" |
| --mcp-config <configs...> | Load MCP servers from JSON files or strings (space-separated). | claude --mcp-config ./mcp-servers.json |
| --strict-mcp-config | Only use MCP servers from --mcp-config, ignoring other MCP configurations. | claude --mcp-config ./a.json --strict-mcp-config |
| --append-system-prompt <prompt> | Append a system prompt to the default system prompt (useful in print mode). | claude -p --append-system-prompt "Do X then Y" |
| --permission-mode <mode> | Permission mode for the session (choices include acceptEdits, bypassPermissions, default, plan). | claude --permission-mode plan |
| --permission-prompt-tool <tool> | Specify an MCP tool to handle permission prompts in non-interactive mode. | claude -p --permission-prompt-tool mcp_auth_tool "query" |
| --fallback-model <model> | Enable automatic fallback to a specified model when the default is overloaded (note: only works with --print per help). | claude -p --fallback-model claude-haiku-20240307 "query" |
| --model <model> | Model for the current session. Accepts aliases like sonnet/opus or a full model name (e.g. claude-sonnet-4-6-20260217). | claude --model sonnet |
| --settings <file-or-json> | Load additional settings from a JSON file or a JSON string. | claude --settings ./settings.json |
| --add-dir <directories...> | Additional directories to allow tool access to. | claude --add-dir ../apps ../lib |
| --ide | Automatically connect to an IDE on startup if exactly one valid IDE is available. | claude --ide |
| -c, --continue | Continue the most recent conversation in the current directory. | claude --continue |
| -r, --resume [sessionId] | Resume a conversation; provide a session ID or interactively select one. | claude -r "abc123" |
| --session-id <uuid> | Use a specific session ID for the conversation (must be a valid UUID). | claude --session-id 123e4567-e89b-12d3-a456-426614174000 |
| --agents <json> | Define custom subagents dynamically via JSON (see subagent docs for format). | claude --agents '{"reviewer":{"description":"Reviews code","prompt":"..."}}' |
| --agent <name> | Specify a specific agent for the current session. | claude --agent my-custom-agent |
| --chrome | Enable Chrome browser integration for web automation and testing. | claude --chrome |
| --no-chrome | Disable Chrome browser integration for this session. | claude --no-chrome |
| --remote | Create a new web session on claude.ai with the provided task description. | claude --remote "Fix the login bug" |
| --teleport | Resume a web session in your local terminal. | claude --teleport |
| --fork-session | When resuming, create a new session ID instead of reusing the original. | claude --resume abc123 --fork-session |
| --json-schema <schema> | Get validated JSON output matching a JSON Schema after agent completes (print mode only). | claude -p --json-schema '{"type":"object",...}' "query" |
| --max-budget-usd <amount> | Maximum dollar amount to spend on API calls before stopping (print mode only). | claude -p --max-budget-usd 5.00 "query" |
| --max-turns <n> | Limit the number of agentic turns (print mode only). Exits with error when limit reached. | claude -p --max-turns 3 "query" |
| --betas <headers> | Beta headers to include in API requests (API key users only). | claude --betas interleaved-thinking |
| --tools <tools> | Restrict which built-in tools Claude can use. Use "" to disable all, "default" for all, or specific tool names. | claude --tools "Bash,Edit,Read" |
| --system-prompt <prompt> | Replace the entire system prompt with custom text (works in interactive and print modes). | claude --system-prompt "You are a Python expert" |
| --system-prompt-file <file> | Load system prompt from a file, replacing the default prompt (print mode only). | claude -p --system-prompt-file ./custom-prompt.txt "query" |
| --append-system-prompt-file <file> | Load additional system prompt text from a file and append to default (print mode only). | claude -p --append-system-prompt-file ./extra-rules.txt "query" |
| --plugin-dir <dir> | Load plugins from directories for this session only (repeatable). | claude --plugin-dir ./my-plugins |
| --setting-sources <sources> | Comma-separated list of setting sources to load (user, project, local). | claude --setting-sources user,project |
| --no-session-persistence | Disable session persistence so sessions are not saved to disk (print mode only). | claude -p --no-session-persistence "query" |
| --disable-slash-commands | Disable all skills and slash commands for this session. | claude --disable-slash-commands |
| --dangerously-skip-permissions | Bypass all permission checks (only for trusted sandboxes). | claude --dangerously-skip-permissions |
| --worktree, -w | Start in an isolated git worktree (v2.1.49). | claude -w "implement feature" |
| --from-pr <url> | Start session from a pull request URL (v2.1.27). | claude --from-pr https://github.com/org/repo/pull/123 |
| --init | Trigger Setup hook event (v2.1.10). | claude --init |
| --init-only | Run Setup hook and exit (v2.1.10). | claude --init-only |
| --maintenance | Run Setup hook in maintenance mode (v2.1.10). | claude --maintenance |
| -v, --version | Show the installed claude CLI version. | claude --version |
| -h, --help | Display help / usage. | claude --help |
The
--output-format jsonflag is particularly useful for scripting and automation, allowing you to parse Claude's responses programmatically.
## Claude Cheat Sheet
# Basics / interactive
claude # Start interactive REPL
claude "explain this project" # Start REPL seeded with a prompt
claude -p "summarize README.md" # Non-interactive print mode (SDK-backed)
cat logs.txt | claude -p "explain" # Pipe input to Claude and exit
claude -c # Continue most recent conversation (alias for --continue)
claude -r "<session-id>" "finish this" # Resume specific session by ID (alias for --resume)
claude --model claude-sonnet-4-6-20260217 # Pick model for this run
claude --max-turns 3 -p "lint this" # Cap agentic turns in print mode
claude --replay-user-messages # Replay user messages to stdout for debugging / SDK workflows
# Update & install
claude update # Manually update Claude Code
claude doctor # Diagnose install/version & setup
claude install # Start native binary installer (beta)
claude migrate-installer # Migrate from global npm to local installer
# Authentication (v2.1.41+)
claude auth login # Log in to your Anthropic account
claude auth status # Check authentication status
claude auth logout # Log out
# Agent management (v2.1.50+)
claude agents # List all configured agents (project, user, plugin)
claude remote-control # Start remote-control mode for external tooling
# Config: interactive wizard + direct ops
claude config # Interactive config wizard
claude config get <key> # Get value (e.g., claude config get theme)
claude config set <key> <val> # Set value (e.g., claude config set theme dark)
claude config add <key> <vals…> # Append to array-type keys (e.g., claude config add env DEV=1)
claude config remove <key> <vals…> # Remove items from list-type keys
claude config list # Show all current settings for project (project scope is default)
# Example project-scoped settings
claude config set model "claude-sonnet-4-6-20260217" # Override default model for this project
claude config set attribution false # Disable "co-authored-by Claude" byline in git/PRs
claude config set forceLoginMethod claudeai # Restrict login flow: claudeai | console
claude config set enableAllProjectMcpServers true # Auto-approve all MCP servers from .mcp.json
claude config set defaultMode "acceptEdits" # Set default permission mode
claude config set disableBypassPermissionsMode disable # Prevent bypassPermissions mode (example key)
# Manage list settings (project scope)
claude config add enabledMcpjsonServers github # Approve a specific MCP server from .mcp.json
claude config add enabledMcpjsonServers memory # Add another
claude config remove enabledMcpjsonServers memory # Remove one entry
claude config add disabledMcpjsonServers filesystem # Explicitly reject a specific MCP server
# Global scope (use -g or --global)
claude config set -g autoUpdates false # Turn off automatic updates globally
claude config set --global preferredNotifChannel iterm2_with_bell
claude config set -g theme dark # Theme: dark | light | light-daltonized | dark-daltonized
claude config set -g verbose true # Show full bash/command outputs everywhere
claude config get -g theme # Confirm a global value
# MCP (Model Context Protocol) management
claude mcp # Launch MCP wizard / configure MCP servers
claude mcp list # List configured MCP servers
claude mcp get <name> # Show details for a server
claude mcp remove <name> # Remove a server
claude mcp add <name> <command> [args...] # Add local stdio server
claude mcp add --transport sse <name> <url> # Add remote SSE server
claude mcp add --transport http <name> <url> # Add remote HTTP server
claude mcp add <name> --env KEY=VALUE -- <cmd> [args...] # Pass env to server command
claude mcp add --transport sse private-api https://api.example/mcp \
--header "Authorization: Bearer TOKEN" # Add with auth header
claude mcp add-jso