Claude Code Reference
v2.1.178 · 87 auto-discovered · Commands, shortcuts, hooks, Python/AWS tips.
CLI Flags & Options
Click any flag to see its accepted values and copy-ready examples.
--worktree, -wAUTOStart Claude in an isolated [git worktree](/en/worktrees) at <repo>/.claude/worktrees/<name>. If no name is given, one is auto-generated. Pass #<number> or a GitHub pull request URL to fetch that PR from origin and branch the worktree from it
--worktree, -wAUTO--version, -vAUTOOutput the version number
--version, -vAUTO--resume, -rAUTOResume a specific session by ID or name, or show an interactive picker to choose a session. The picker and name search include sessions that added this directory with /add-dir; passing a session ID searches only the current project directory and its git worktrees. As of v2.1.144, [background sessions](/en/agent-view) appear in the picker marked with bg
--resume, -rAUTO--remote-control-session-name-prefix <prefix>AUTOPrefix for auto-generated [Remote Control](/en/remote-control) session names when no explicit name is set. Defaults to your machine's hostname, producing names like myhost-graceful-unicorn. Set CLAUDE_REMOTE_CONTROL_SESSION_NAME_PREFIX for the same effect
--remote-control-session-name-prefix <prefix>AUTO--remote-control, --rcAUTOStart an interactive session with [Remote Control](/en/remote-control#start-a-remote-control-session) enabled so you can also control it from claude.ai or the Claude app. Optionally pass a name for the session
--remote-control, --rcAUTO--print, -pAUTOPrint response without interactive mode (see [Agent SDK documentation](/en/agent-sdk/overview) for programmatic usage details)
--print, -pAUTO--name, -nAUTOSet a display name for the session, shown in /resume and the terminal title. You can resume a named session with claude --resume <name>. <br /><br />[/rename](/en/commands) changes the name mid-session and also shows it on the prompt bar
--name, -nAUTO--disallowedTools, --disallowed-toolsAUTODeny rules. A bare tool name removes the matching tools from the model's context: "Edit" removes Edit, "*" removes every tool, and "mcp__*" removes every MCP tool. A scoped rule such as Bash(rm *) leaves the tool available and denies only matching calls
--disallowedTools, --disallowed-toolsAUTO--debug-file <path>AUTOWrite debug logs to a specific file path. Implicitly enables debug mode. Takes precedence over CLAUDE_CODE_DEBUG_LOGS_DIR
--debug-file <path>AUTO--continue, -cAUTOLoad the most recent conversation in the current directory. Includes sessions that added this directory with /add-dir
--continue, -cAUTO--allowedTools, --allowed-toolsAUTOTools that execute without prompting for permission. See [permission rule syntax](/en/settings#permission-rule-syntax) for pattern matching. To restrict which tools are available, use --tools instead
--allowedTools, --allowed-toolsAUTO--advisor <model>AUTO{/* min-version: 2.1.98 */}Enable the server-side [advisor tool](/en/advisor) for this session with a model alias: opus, sonnet, or fable ({/* min-version: 2.1.170 */}v2.1.170+), or a full model ID. Takes precedence over the advisorModel setting for the session. Requires Claude Code v2.1.98 or later
--advisor <model>AUTOObservability in the terminalAUTOEnhances observability for engineers working via command line with agentic tools like Claude Code.N/A
Observability in the terminalAUTOgcx CLI toolAUTOprovides observability in the terminal for monitoring systems and responding to issuesN/A
gcx CLI toolAUTOTerminal observabilityAUTOGet observability in the terminal with the gcx CLI tool for monitoring systems and responding to issues with agentic tools like Claude CodeNot applicable
Terminal observabilityAUTOobservability in the terminalAUTOUse the gcx CLI tool to observe systems and respond to issues in the terminal, compatible with agentic tools like Claude Code.Not provided
observability in the terminalAUTOclaudeStart an interactive Claude Code session in the current directory.claude
claudeExamples
claudecd ~/projects/api && claudeclaude --model claude-sonnet-4-6TipRun inside the repo root so Claude picks up CLAUDE.md and .claude/ settings.
claude "prompt"Start a session and immediately run a prompt.claude "fix the auth bug"
claude "prompt"Examples
claude "add a /healthz endpoint"claude "explain the data layer in src/db"claude "find unused exports in src/lib"claude -pNon-interactive (print) mode. Runs once, prints, exits — perfect for scripts and CI.claude -p "analyze this code"
claude -pExamples
claude -p "summarize TODOs in src/"git diff main | claude -p "review this diff"claude -p --output-format json "list public API endpoints"TipCombine with --max-turns and --max-budget-usd in CI to bound cost.
claude -cContinue your most recent session right where you left off.claude -c
claude -cExamples
claude -cTipUseful after closing the terminal — context, todo list, and history are restored.
claude -r "name"Resume a named session.claude -r "auth-refactor"
claude -r "name"Examples
claude -r "auth-refactor"claude -r "infra-migration"claude --resumeOpen an interactive picker of recent sessions to resume.claude --resume
claude --resumeExamples
claude --resumeclaude -wOpen a session in an isolated git worktree so you can work on a side branch without disturbing your current tree.claude -w feature-auth
claude -wExamples
claude -w feature-authclaude -w hotfix/login-redirectclaude -w bump-depsTipEach worktree is its own checkout — perfect for parallel features.
--modelChoose which Claude model to use for this session.claude --model claude-opus-4-7
--modelAccepted values
claude-opus-4-7Most capable, 1M context, best for hard agentic coding (latest).claude-opus-4-6Previous flagship — strong reasoning, 1M context.claude-sonnet-4-6Fast & cheap default — great speed/quality trade-off.claude-haiku-4-5Fastest, cheapest — classification, structured output.
Examples
claude --model claude-opus-4-7claude -p --model claude-haiku-4-5 "lint these commit messages"--effortSet how hard Claude should think before answering. Higher = more thinking tokens, slower, better quality.claude --effort high
--effortAccepted values
lowSnappy answers, minimal thinking. Best for quick edits.mediumDefault. Balanced for most tasks.highMore extensive reasoning. Use for tricky bugs.maxMaximum reasoning depth. For the hardest problems.
Examples
claude --effort highclaude -p --effort max "explain why this race condition happens"TipAlso settable per-message with /effort or via env CLAUDE_CODE_EFFORT_LEVEL.
--permission-modeControl how Claude handles tool permissions for this session.claude --permission-mode plan
--permission-modeAccepted values
defaultPrompt before each new tool use (safest interactive default).planPlan-only — Claude analyzes and proposes a plan but cannot edit until you switch modes.acceptEditsAuto-accept file edits without prompting. Bash still prompts.bypassPermissionsSkip ALL permission prompts. Dangerous — use only in sandboxes.
Examples
claude --permission-mode planclaude --permission-mode acceptEditsclaude -p --permission-mode bypassPermissions "run the test suite and fix failures"TipToggle modes mid-session with Shift+Tab.
--allowedToolsPre-approve specific tools (and command patterns) so Claude doesn't ask each time.--allowedTools "Read,Edit,Bash"
--allowedToolsAccepted values
ReadAllow reading any file.EditAllow modifying existing files.WriteAllow creating new files.BashAllow ANY shell command (broad — prefer narrow patterns).Bash(npm *)Allow only npm subcommands. Same syntax for git, aws, terraform…GrepAllow content search.GlobAllow file pattern matching.WebSearchAllow web search.WebFetchAllow URL fetches.
Examples
claude --allowedTools "Read,Edit,Bash(npm test)"claude -p --allowedTools "Read,Grep,Glob" "find all TODO comments"claude --allowedTools "Read,Edit,Bash(git *),Bash(npm *)"--max-turnsCap the number of agentic turns Claude can take in a single run.claude -p --max-turns 5
--max-turnsExamples
claude -p --max-turns 3 "quick lint pass"claude -p --max-turns 10 "add tests for src/auth"TipCombine with --max-budget-usd to safely bound CI runs.
--max-budget-usdStop the session once API spending crosses this dollar amount.claude -p --max-budget-usd 5.00
--max-budget-usdExamples
claude -p --max-budget-usd 0.50 "summarize this file"claude -p --max-turns 10 --max-budget-usd 2.00 "refactor utils"--output-formatFormat of stdout in print mode. Lets you pipe Claude into jq, xargs, etc.claude -p --output-format json "query"
--output-formatAccepted values
textPlain text (default).jsonSingle JSON object with content + metadata.stream-jsonNewline-delimited JSON events as they happen.
Examples
claude -p --output-format json "list api routes" | jq .contentclaude -p --output-format stream-json "review src/auth" | tee log.ndjson--bareMinimal mode — disables hooks, skills, and project memory. Great for reproducible runs.claude --bare
--bareExamples
claude --bareclaude --bare -p "plain answer with no project context"TipEquivalent to setting CLAUDE_CODE_SIMPLE=1.
--debugEnable verbose debug logging (tool calls, hook events, API requests).claude --debug
--debugExamples
claude --debugclaude --debug 2> debug.logpipe inputPipe stdin into Claude — diffs, logs, files, anything.cat file.py | claude -p "review this"
pipe inputExamples
cat error.log | claude -p "explain the root cause"git diff main | claude -p "review for security issues"kubectl describe pod foo | claude -p "why is this crashing?"Environment Variables
ANTHROPIC_API_KEY | API key for direct Anthropic access |
CLAUDE_CODE_USE_BEDROCK | Set to 1 to use AWS Bedrock |
CLAUDE_CODE_USE_VERTEX | Set to 1 to use Google Vertex AI |
CLAUDE_CODE_EFFORT_LEVEL | Default effort level (low/medium/high/max) |
MAX_THINKING_TOKENS | Max tokens for extended thinking |
CLAUDE_CODE_SIMPLE | Set to 1 for bare mode (no hooks/skills) |
Available Tools
Provides observability in the terminal for engineers using agentic tools like Claude Code.
A significant leap in AI capability under the gated defense framework of Project Glasswing, enhancing cybersecurity.
Enables AI assistants like Claude Code to interact with Terraform, reducing manual effort and accelerating delivery.
Enables observability in the terminal for engineers using agentic tools like Claude Code.
Claude Code is integrated with Anthropic’s Claude Mythos Preview under the gated defense framework of Project Glasswing.
Enables AI assistants like Claude Code to interact with Terraform through the Model Context Protocol (MCP).
A gated defense framework under which Anthropic’s Claude Mythos Preview operates, enhancing cybersecurity capabilities.
Enhances observability for engineers using command line tools like Claude Code.
Claude Code is effective at handling day-to-day engineering tasks, now with observability in the terminal through the gcx CLI tool.
handles many day-to-day engineering tasks effectively
Agentic tools that have become highly effective at handling many day-to-day engineering tasks
Handle many day-to-day engineering tasks efficiently
Handle many day-to-day engineering tasks effectively
Cursor and Claude Code are highly effective at handling many day-to-day engineering tasks
Cloudflare's integration with Anthropic's Claude Managed Agents for fast, isolated execution environment
mass-migrated blog to Astro using Claude Code
mass-migrated blog to Astro using Claude Code
Claude Managed Agents are integrated with Cloudflare for fast, isolated execution environment for autonomous code delivery.
Claude Code can handle mass-migrating blogs to Astro, managing posts, images, URLs, and sitemaps.
teach the Claude Code agent about blog architecture, deployment, and what not to touch
migrate large amounts of content to Astro using Claude Code
Use the gcx CLI tool to observe systems and respond to issues when working with agentic tools like Claude Code.
Cloudflare's integration with Anthropic's Claude Managed Agents for fast, isolated execution environment for autonomous code delivery.
Fast, isolated execution environment for autonomous code delivery
Cloudflare's integration with Claude Managed Agents for autonomous code delivery
Easily customize your agent's tools in the Cloudflare integration.
Scale agent workflows globally while controlling access to private backends.
Cloudflare integrates with Claude Managed Agents to provide a fast, isolated execution environment for autonomous code delivery.
handle day-to-day engineering tasks with agentic tools like Cursor and Claude Code
scale agent workflows globally with strict control over private backends
manage canonical URLs, JSON-LD markup, sitemap generation with Claude Code
Adds a specialized deep research skill to Claude Code, enhancing its ability to manage sessions, chain tools, execute code, and respond to user requests.
a code search tool for agents that uses significantly fewer tokens than grep
Provides secure, microVM-based isolation for running AI coding agents like Claude Code.
Claude Code is mentioned as an effective agenic tool for handling day-to-day engineering tasks.
Claude Code is used as an AI coding agent in a secure, microVM-based isolation environment provided by Docker's Coding Agent Sandboxes.
A new version of the DeepSeek tool integrated with Claude Code for more efficient agent loop operations.
Claude Code agent loop with DeepSeek V4 Pro, 17x cheaper
provides secure environment for running AI coding agents like Claude Code
Helps developers build real-time vision AI applications by handling intricate data pipelines
Enables coding agents to write production code at scale
Read files from disk
Create new files
Edit existing files (sends only the diff)
Run shell commands
Find files by pattern (faster than find)
Search file contents (faster than grep/rg)
Search the web
Fetch and parse web pages
Watch background scripts
Invoke subagents for parallel work
Create and manage task lists
Ask clarifying questions