Claude Code CLI Reference

SkillAI & models

A skill for ai & models by thelobbi.

Available today. Use it from your connected AI after setup.

Connect ahel once, and every AI you use reads what you have installed.

Then ask your AI: use the Claude Code CLI Reference skill

What this skill tells your AI

The instructions your AI receives, as published by thelobbi/claude in plugins/claude-code-expert/skills-old/cli-reference/SKILL.md and read by ahel’s review.

Complete reference for the Claude Code command-line interface.

Installation

System Requirements

  • macOS 13.0+, Windows 10 1809+, Ubuntu 20.04+, Debian 10+, Alpine 3.19+
  • 4GB+ RAM
  • Internet connection required
  • Shell: Bash, Zsh, PowerShell, CMD
  • Windows: Git for Windows required

Methods

# Native (Recommended)
curl -fsSL https://claude.ai/install.sh | bash

# Homebrew (macOS)
brew install --cask claude-code

# WinGet (Windows)
winget install Anthropic.ClaudeCode

# npm (legacy)
npm install -g @anthropic-ai/claude-code

# Direct invocation
npx @anthropic-ai/claude-code

# Update to latest
npm update -g @anthropic-ai/claude-code

Initial Login

claude     # First run opens browser for login

Supports: Claude Pro, Teams, Enterprise, Console, Bedrock, Vertex AI, Foundry. Credentials stored at ~/.claude.json.

Basic Usage

# Interactive mode (default)
claude

# Start with initial prompt
claude "explain this codebase"

# Non-interactive / print mode
claude -p "what does this function do?"

# Pipe input
cat file.ts | claude -p "review this code"

# Resume last conversation
claude --continue

# Resume specific conversation
claude --resume <session-id>

CLI Flags

Session Management Flags

FlagShortDescription
--help-hShow help message
--version-vShow version number
--print-pNon-interactive mode: print response and exit
--verboseEnable verbose/debug logging
--debug [category]Debug logging for specific category
--model-mOverride model (e.g., sonnet, opus, haiku)
--continue-cResume most recent conversation
--resume-rResume specific conversation by ID
--fork-sessionCreate new session from current context
--teleportResume a web session locally
--remote "task"Create cloud session
--worktree-wRun in isolated git worktree

Output & Format Flags

FlagDescription
--output-formatOutput format: text (default), json, stream-json
--max-turnsMaximum conversation turns in non-interactive mode
--max-budget-usdSpending limit per session
--no-inputSkip initial user input (for piped content)
--input-formatInput format: text (default), stream-json
--json-schemaStructured output with JSON schema (print mode)

Permission & Security Flags

FlagDescription
--dangerously-skip-permissionsSkip all permission prompts (use with caution)
--allowedToolsComma-separated list of allowed tools
--disallowedToolsComma-separated list of disallowed tools
--permission-modePermission mode: default, plan, acceptEdits, dontAsk, bypassPermissions
--permission-prompt-toolMCP tool for handling permission prompts

Configuration Flags

FlagDescription
--system-promptOverride entire system prompt (use with -p)
--append-system-promptAppend text to system prompt
--system-prompt-fileLoad system prompt from file
--append-system-prompt-fileAppend system prompt from file
--mcp-configPath to MCP config JSON file
--settingsLoad settings from file or JSON string
--agentsDefine custom agents as JSON
--plugin-dirLoad plugin from directory (repeatable)
--add-dirAdd additional working directories to context
--initRun initialization hooks
--maintenanceRun maintenance hooks

PR & Review Flags

FlagDescription
--from-pr <url>Load PR context from GitHub URL
--fallback-modelFallback model if primary unavailable

Agent Team Flags

FlagDescription
--teammate-modeRun as part of an agent team
--chromeEnable Chrome browser for agent
--no-chromeDisable Chrome browser
--strict-mcp-configFail on invalid MCP config
--setting-sourcesShow which file each setting comes from
--include-partial-messagesInclude partial messages in stream output
--betasEnable beta features
--no-session-persistenceDisable session persistence
--allow-dangerously-skip-permissionsAllow skipping permissions programmatically

Auth CLI

claude auth login              # Login to Anthropic
claude auth logout             # Logout
claude auth status             # Show auth status

claude agents                  # Manage agent teams
claude update                  # Update Claude Code

claude mcp add-json <name> <json>   # Add MCP from JSON blob
claude mcp add-from-claude-desktop  # Import from Claude Desktop

Session ID Flags

FlagDescription
--session-idSet specific session ID
--conversation-idSet conversation ID within session

Environment Variables

Authentication

VariableDescription
ANTHROPIC_API_KEYAPI key for Anthropic direct access
ANTHROPIC_AUTH_TOKENOAuth/bearer token for API access
CLAUDE_CODE_API_KEYAlternative API key variable

Provider Selection

VariableDescription
CLAUDE_CODE_USE_BEDROCK1 to use AWS Bedrock
CLAUDE_CODE_USE_VERTEX1 to use Google Vertex AI
ANTHROPIC_BASE_URLCustom API base URL

AWS Bedrock Configuration

VariableDescription
ANTHROPIC_BEDROCK_BASE_URLBedrock endpoint URL
AWS_REGIONAWS region for Bedrock
AWS_ACCESS_KEY_IDAWS access key
AWS_SECRET_ACCESS_KEYAWS secret key
AWS_SESSION_TOKENAWS session token (for temporary creds)
AWS_PROFILEAWS profile name
ANTHROPIC_MODELOverride model ID for Bedrock

Google Vertex Configuration

VariableDescription
ANTHROPIC_VERTEX_PROJECT_IDGCP project ID
CLOUD_ML_REGIONGCP region
ANTHROPIC_VERTEX_BASE_URLCustom Vertex endpoint

Model Overrides

VariableDescription
ANTHROPIC_MODELOverride default model ID
ANTHROPIC_DEFAULT_SONNET_MODELOverride Sonnet model ID
ANTHROPIC_DEFAULT_OPUS_MODELOverride Opus model ID
CLAUDE_CODE_EFFORT_LEVELReasoning effort: low, medium, high

Behavior Configuration

VariableDescription
DISABLE_AUTOMEMORY1 to disable auto-memory
DISABLE_AUTOUPDATER1 to disable auto-updates
DISABLE_BUG_COMMAND1 to disable /bug command
CLAUDE_CODE_MAX_OUTPUT_TOKENSOverride max output tokens
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC1 to disable telemetry
CLAUDE_CODE_ENABLE_TELEMETRYEnable OpenTelemetry
CLAUDE_CODE_SKIP_DOCTOR1 to skip doctor checks
CLAUDE_CODE_DISABLE_FAST_MODEDisable fast Opus mode
CLAUDE_CODE_SIMPLEUse minimal system prompt
CLAUDE_CODE_DISABLE_1M_CONTEXTDisable large context window
CLAUDE_CODE_SHELLOverride shell detection
BASH_DEFAULT_TIMEOUT_MSBash command timeout in ms
MAX_MCP_OUTPUT_TOKENSMCP tool output token limit
SLASH_COMMAND_TOOL_CHAR_BUDGETSkill character budget

Directory Overrides

VariableDescription
CLAUDE_CONFIG_DIRCustom config directory location
CLAUDE_CODE_TMPDIROverride temporary directory

Cloud Provider: Microsoft Foundry

VariableDescription
CLAUDE_CODE_USE_FOUNDRY1 to use Microsoft Foundry

Agent Teams & Advanced

VariableDescription
CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMSEnable agent teams feature
CLAUDE_CODE_TEAM_NAMETeam name for agent teams
CLAUDE_CODE_PLAN_MODE_REQUIREDRequire plan mode for teammates
CLAUDE_CODE_DISABLE_CRONDisable background cron tasks
CLAUDE_CODE_DISABLE_BACKGROUND_TASKSDisable all background tasks
CLAUDE_CODE_SHELL_PREFIXPrefix for shell commands

mTLS & Client Certificates

VariableDescription
CLAUDE_CODE_CLIENT_CERTClient certificate path for mTLS
CLAUDE_CODE_CLIENT_KEYClient private key path
CLAUDE_CODE_CLIENT_KEY_PASSPHRASEPassphrase for client key

Proxy & Network

VariableDescription
HTTP_PROXY / HTTPS_PROXYHTTP/S proxy URL
NO_PROXYProxy bypass list
NODE_TLS_REJECT_UNAUTHORIZED0 to skip TLS verification
CLAUDE_CODE_PROXY_RESOLVES_HOSTSLet proxy handle DNS resolution

Model Aliases

AliasResolves To
opusclaude-opus-4-6
sonnetclaude-sonnet-4-6
haikuclaude-haiku-4-5-20251001
opusplanOpus with plan mode
sonnet[1m]Sonnet with 1M context
claude-opus-4-6[1m]Opus with 1M context

Exit Codes

CodeMeaning
0Success
1General error
2Invalid arguments

Examples

# Use specific model
claude -m claude-haiku-4-5-20251001 -p "quick question"

# JSON output for scripting
claude -p "list files" --output-format json

# Multi-turn with max turns
claude -p "refactor this" --max-turns 5

# With Bedrock
CLAUDE_CODE_USE_BEDROCK=1 AWS_REGION=us-east-1 claude

# With Vertex
CLAUDE_CODE_USE_VERTEX=1 ANTHROPIC_VERTEX_PROJECT_ID=my-project claude

# Add extra directories
claude --add-dir /path/to/other/repo

# With custom MCP config
claude --mcp-config ./custom-mcp.json

Signals

GitHub stars
21
Forks
2
Last commit
Sep 2026

ahel review

  • K1info
    remote-installer-piped-to-shell
  • K1binfo
    installs-packages

Automated review, not a security audit. Ruleset v1+k2.

Advanced
Catalog kind
skill
Gateway key
cli-reference-thelobbi
Source
github.com/thelobbi/claude