Skip to main content

Claude Code Commands (100+): The Reference

100+ current Claude Code commands: slash commands, skills, workflows, CLI subcommands, flags, shortcuts, and environment variables in one reference.

FHFinn Hillebrandt
AI Programming
Claude Code Commands (100+): The Reference
Links marked with * are affiliate links. If a purchase is made through such links, we receive a commission.

The ten Claude Code commands you need most are /init, /clear, /compact, /resume, /model, /plan, /context, /memory, /permissions, and /rewind.

1. The 10 Most Important Commands

/init
Creates a project guide in CLAUDE.md.
/clear
Starts a new conversation with no context.
/compact
Summarizes the conversation to free up context.
/resume
Resumes an earlier conversation by ID or name.
/model
Switches the model and saves the choice for new sessions.
/plan
Switches to plan mode before Claude Code changes any files.
/context
Shows what is filling the context window.
/memory
Edits CLAUDE.md files and the auto-memory store.
/permissions
Manages allowed, ask-first, and denied tool rules.
/rewind
Rolls code and conversation back to a checkpoint.
Source: Anthropic, Claude Code Commands
gradually.ai

How to use /init well and keep the file tidy is covered in the CLAUDE.md guide. For the full walkthrough of working with Claude Code, see the Claude Code guide, and for setup on Windows the Windows guide.

There are now well over 100 documented command entries once you count built-ins, skills, workflows, and aliases. Flags and keyboard shortcuts give you further control over your sessions.

This is the current Claude Code command landscape: built-in slash commands, bundled skills and workflows, CLI subcommands, flags, and keyboard shortcuts. Not every command appears for every account because platform, plan, and provider matter. For how Claude Code stacks up against OpenAI Codex, see our Claude Code vs. OpenAI Codex comparison.

TL;DRKey Takeaways
  • The official reference documents well over 100 command entries. This page separates built-ins, bundled skills, the Deep Research workflow, and retired commands.
  • Key shortcuts are Ctrl+G or Ctrl+X Ctrl+E for the external editor, Ctrl+O for Transcript Viewer, Option+P or Alt+P for model selection, and Shift+Tab for permission modes.
  • The commands you will need most are /init, /clear, /compact, /resume, /model, and /plan.

The tables cover Claude Code v2.1.316, checked on October 31, 2026.

2. Installing and Starting Claude Code

Installation and Start
# Recommended native installation on macOS, Linux, and WSL
curl -fsSL https://claude.ai/install.sh | bash

# Native installation in Windows PowerShell
irm https://claude.ai/install.ps1 | iex

# Verify the installation
claude --version

# Start Claude Code
claude                          # Interactive mode
claude "Fix the bug in auth"    # With initial prompt
claude -p "Analyze this code"   # One-time query without session
claude -c                       # Continue last session

3. Slash Commands (Built-in)

The commands from Anthropic's official command reference are your daily tools when working with Claude Code. Type / followed by any letters to filter. Not all commands are visible to every user, some depend on platform, plan, or environment.

Version badges show an introduction release documented in the official changelog for the command or its associated feature. For /fast and /output-style, I map the feature release to the commands documented today. Where no introduction release is documented, the badge says “Not documented.”

/add-dir
Parameter
<path>
Introduced
Not documented
Description
Give the current session access to an additional working directory.
/advisor
Parameter
[model|off]
Introduced
Not documented
Description
Enable or disable Advisor, which consults a second model at key moments. The model and off arguments require v2.1.260 or later.
/agents
Parameter
Introduced
v1.0.60
Description
Open guidance for managing subagents through Claude or .claude/agents/ files.
/artifacts
Parameter
Introduced
Not documented
Description
List personal or shared artifacts and attach one to the session. Requires v2.1.208 or later; attaching with Enter requires v2.1.216 or later.
/auto-mode-setup
Parameter
Introduced
Not documented
Description
Draft autoMode.environment entries from the project and recent sessions. The command is available on Pro, Max, and Team from v2.1.228 (native Windows from v2.1.233), and on Enterprise or with a Console API key from v2.1.283. Since v2.1.304, it is also available on Bedrock, Vertex, Foundry, Claude apps gateway, and in telemetry-disabled sessions.
/autocompact
Parameter
[auto|<tokens>]
Introduced
Not documented
Description
Set how full the context window can become before automatic compaction. Requires v2.1.221 or later.
/autofix-pr
Parameter
[prompt]
Introduced
Not documented
Description
Start a web session that can watch a pull request and push CI or review fixes.
/background
Parameter
[prompt]
Introduced
Not documented
Description
Detach the current session as a background agent. Alias: /bg.
/branch
Parameter
[name]
Introduced
v2.1.77
Description
Create a conversation branch and switch to it without losing the original.
/btw
Parameter
[question]
Introduced
Not documented
Description
Answer a side question outside the conversation context.
/bug
Parameter
[report]
Introduced
Not documented
Description
Report a bug or share the session after consent. In the VS Code extension, its own feedback dialog requires v2.1.229 or later. Alias: /share.
/cd
Parameter
<path>
Introduced
v2.1.169
Description
Change working directory while retaining the conversation and prompt cache.
/chrome
Parameter
Introduced
Not documented
Description
Open Claude in Chrome settings.
/clear
Parameter
[name]
Introduced
Not documented
Description
Start a new conversation without context. Aliases: /reset and /new.
/color
Parameter
[color|default]
Introduced
Not documented
Description
Set the prompt-bar color. Available to all users since v2.1.75.
/compact
Parameter
[instructions]
Introduced
Not documented
Description
Summarize the conversation to free context.
/config
Parameter
[key=value ...]
Introduced
Not documented
Description
Open settings or set values directly. Alias: /settings.
/context
Parameter
[all]
Introduced
v1.0.86
Description
Show what occupies the context window, including optimization suggestions.
/copy
Parameter
[N]
Introduced
Not documented
Description
Copy the latest or Nth-most-recent response to the clipboard.
/cost
Parameter
Introduced
Not documented
Description
Alias for /usage.
/design
Parameter
consent
Introduced
Not documented
Description
Grant Claude access to Claude Design. When Claude asks you to run it, type the command yourself at the Claude Code prompt.
/design
Parameter
revoke
Introduced
Not documented
Description
Withdraw Claude’s access to Claude Design.
/design-login
Parameter
Introduced
Not documented
Description
Authorize access to Claude Design for /design-sync. The sign-in applies to the standalone claude.ai/design site, which Anthropic closes by December 14, 2026.
/desktop
Parameter
Introduced
Not documented
Description
Continue the session in the Claude Code desktop app. Alias: /app.
/diff
Parameter
Introduced
Not documented
Description
Open the interactive diff viewer for uncommitted and turn-level changes.
/effort
Parameter
[level|auto|status|ultracode [on|off]]
Introduced
v2.1.76
Description
Choose reasoning effort. ultracode on and off, plus keeping the current level, work since v2.1.284.
/exit
Parameter
Introduced
Not documented
Description
Exit the CLI or detach an attached background session. Alias: /quit.
/export
Parameter
[filename]
Introduced
Not documented
Description
Export the current conversation as plain text.
/fast
Parameter
[on|off]
Introduced
v2.1.36
Description
Toggle Fast mode when the account supports it.
/feedback
Parameter
[report]
Introduced
Not documented
Description
Open the same feedback dialog as /bug.
/focus
Parameter
Introduced
v2.1.110
Description
Switch to the reduced focus view in the fullscreen renderer.
/fork
Parameter
[prompt]
Introduced
Not documented
Description
Copy the conversation into a new background session.
/goal
Parameter
[condition|clear]
Introduced
v2.1.139
Description
Set a goal that Claude continues pursuing across turns.
/heapdump
Parameter
Introduced
Not documented
Description
Write diagnostics for memory issues. This hidden command can contain sensitive data.
/help
Parameter
Introduced
Not documented
Description
Show help and the commands available in this session.
/hooks
Parameter
Introduced
Not documented
Description
Show hook configurations.
/ide
Parameter
Introduced
Not documented
Description
Manage IDE integrations and display their status.
/import
Parameter
[codex|gemini|cursor] [--dry-run] [--yes]
Introduced
Not documented
Description
Import configuration from Codex, Gemini CLI, or Cursor, including rules, MCP servers, and skills. Cursor is supported since v2.1.265.
/init
Parameter
Introduced
Not documented
Description
Create project guidance in CLAUDE.md.
/insights
Parameter
Introduced
Not documented
Description
Generate an HTML report about local Claude Code sessions and usage patterns.
/install-github-app
Parameter
Introduced
Not documented
Description
Set up the Claude GitHub App for a repository.
/install-slack-app
Parameter
Introduced
Not documented
Description
Install the Claude Slack app through browser sign-in.
/keybindings
Parameter
Introduced
v2.1.18
Description
Open the file for customizable keyboard shortcuts.
/list-agents
Parameter
Introduced
Not documented
Description
List reachable subagents, teammates, and sessions. Requires v2.1.224 or later; teammate rows and the current session’s own name require v2.1.239 or later. Alias: /peers.
/login
Parameter
Introduced
Not documented
Description
Sign in to Anthropic.
/logout
Parameter
Introduced
Not documented
Description
Sign out of the Anthropic account.
/mcp
Parameter
[reconnect|enable|disable]
Introduced
Not documented
Description
Manage MCP connections and OAuth sign-ins.
/memory
Parameter
Introduced
Not documented
Description
Edit CLAUDE.md files and automatic memory.
/mobile
Parameter
Introduced
Not documented
Description
Show a QR code for the Claude mobile app. Aliases: /ios and /android.
/model
Parameter
[model]
Introduced
Not documented
Description
Switch models and save the choice for new sessions.
/output-style
Parameter
[style]
Introduced
v1.0.81
Description
List available output styles or switch to one. Available again since v2.1.269.
/passes
Parameter
Introduced
Not documented
Description
Share a free Claude Code week when the account is eligible.
/permissions
Parameter
Introduced
v1.0.7
Description
Manage allowed, prompted, and denied tool rules. Alias: /allowed-tools.
/plan
Parameter
[description]
Introduced
v2.1.0
Description
Enter plan mode and optionally start with a task.
/plugin
Parameter
[subcommand]
Introduced
v2.0.12
Description
Manage plugins, for example list, install, enable, and disable.
/powerup
Parameter
Introduced
v2.1.90
Description
Open interactive mini-lessons about Claude Code features.
/privacy-settings
Parameter
Introduced
Not documented
Description
Open privacy settings for Pro and Max subscribers.
/radio
Parameter
Introduced
Not documented
Description
Open Claude FM in the browser when the command is available for the provider.
/rate-limit-options
Parameter
Introduced
Not documented
Description
Show options after reaching a usage limit. Requires a claude.ai subscription; wait-and-continue options require v2.1.234 or later. Listed in the command menu since v2.1.284; the first version of the previously hidden command is not documented.
/recap
Parameter
Introduced
v2.1.108
Description
Generate a one-sentence summary of the current session.
/release-notes
Parameter
Introduced
v0.2.37
Description
Open release notes in the interactive picker.
/reload-plugins
Parameter
[--force]
Introduced
v2.1.69
Description
Reload active plugins and apply MCP changes with --force.
/reload-skills
Parameter
Introduced
v2.1.152
Description
Reload skill and command directories without restarting Claude Code.
/remote-control
Parameter
Introduced
Not documented
Description
Make the local session controllable through claude.ai or the Claude app. Alias: /rc.
/remote-env
Parameter
Introduced
v2.1.0
Description
Choose the default environment for cloud agents.
/rename
Parameter
[name]
Introduced
v2.0.64
Description
Rename the current session.
/restart
Parameter
Introduced
Not documented
Description
Restart Claude Code and resume the session, which applies an installed update. Requires Pro, Max, or Ultra, a native install on macOS or Linux (not WSL), and v2.1.288 or later. Alias: /update.
/resume
Parameter
[session]
Introduced
v1.0.27
Description
Resume a conversation by ID or name. Directly attach to a running background session since v2.1.285. Alias: /continue.
/review
Parameter
[level] [--fix] [--comment] [--max-findings <value>] [target]
Introduced
Not documented
Description
Alias for /code-review.
/rewind
Parameter
Introduced
v2.0.0
Description
Restore code and/or conversation to a checkpoint. Aliases: /checkpoint and /undo.
/sandbox
Parameter
Introduced
Not documented
Description
Toggle sandbox mode on supported platforms.
/schedule
Parameter
[description]
Introduced
Not documented
Description
Create, update, or run cloud routines. Alias: /routines.
/scroll-speed
Parameter
Introduced
v2.1.139
Description
Set scrolling speed in the fullscreen renderer.
/security-review
Parameter
Introduced
Not documented
Description
Check the branch diff for security problems.
/setup-bedrock
Parameter
Introduced
Not documented
Description
Set up Amazon Bedrock authentication, region, and models.
/setup-vertex
Parameter
Introduced
Not documented
Description
Set up Google Cloud Agent Platform.
/skills
Parameter
Introduced
Not documented
Description
List available skills and manage their visibility.
/stats
Parameter
Introduced
Not documented
Description
Alias for /usage and open the Stats tab.
/status
Parameter
Introduced
Not documented
Description
Show version, model, account, connectivity, and session type.
/statusline
Parameter
Introduced
v1.0.71
Description
Configure the status line.
/stickers
Parameter
Introduced
Not documented
Description
Order Claude Code stickers.
/stop
Parameter
Introduced
Not documented
Description
Stop the currently attached background session.
/subtask
Parameter
<task>
Introduced
v2.1.212
Description
Start a background subagent whose result returns to this conversation.
/tasks
Parameter
Introduced
Not documented
Description
Show and manage background work in the current session. Alias: /bashes.
/team-onboarding
Parameter
Introduced
v2.1.101
Description
Create an onboarding guide for teammates from your usage history.
/teleport
Parameter
Introduced
v2.1.0
Description
Bring a cloud session into this terminal. Alias: /tp.
/terminal-setup
Parameter
Introduced
Not documented
Description
Configure terminal-specific shortcuts such as Shift+Enter.
/theme
Parameter
Introduced
Not documented
Description
Switch theme, ANSI theme, or accessible color variant.
/tui
Parameter
[default|fullscreen]
Introduced
v2.1.110
Description
Switch the terminal renderer and restart the conversation in it.
/ultrareview
Parameter
[PR|branch]
Introduced
v2.1.111
Description
Alias for the cloud version of /code-review ultra.
/upgrade
Parameter
Introduced
v1.0.11
Description
Open the upgrade page for a higher plan.
/usage
Parameter
Introduced
v2.0.0
Description
Show costs, plan limits, and usage statistics.
/usage-credits
Parameter
Introduced
v2.1.144
Description
Configure usage credits or request them from an administrator.
/voice
Parameter
[hold|tap|off]
Introduced
Not documented
Description
Control voice dictation for Claude.ai accounts.
/web-setup
Parameter
Introduced
Not documented
Description
Connect local GitHub credentials to Claude Code on the web.
/workflows
Parameter
Introduced
v2.1.154
Description
Open progress for running and completed workflows.

4. Bundled Skills and Workflows

According to the skills reference, bundled skills are detailed work instructions rather than hard-coded UI logic. Claude can select them itself when the task fits, except for /verify. Workflows go further and distribute background work across several agents.

/artifact-capabilities
Load the reference for published artifact runtime capabilities, such as connector calls and downloads.
/artifact-diagramming
Load guidance for readable diagrams in artifacts. Requires Claude Code v2.1.221 or later.
/batch <prompt>
Split a large change into independent worktrees, each with a background subagent.
/claude-api [migrate|upgrade|api-version|managed-agents-onboard|managed-agents-secure|prompt-audit|cost-optimize|build-eval|hillclimb|preserved-thinking-migration]
Load API and Managed Agents reference material. migrate and managed-agents-onboard predate v2.1.221; their exact first version is not documented. URL and quickstart inputs for managed-agents-onboard require v2.1.290 or later. Minimum versions: prompt-audit v2.1.221, upgrade v2.1.236, cost-optimize v2.1.247, build-eval and hillclimb v2.1.259, preserved-thinking-migration v2.1.282, managed-agents-secure v2.1.304, and api-version v2.1.307.
/claude-in-chrome [task]
Carry out browser tasks through Claude in Chrome when the integration is enabled. The first version is not documented.
/code-review [level] [--fix] [--comment] [--max-findings <value>] [target]
Review a diff, pull request, branch, or path and optionally apply fixes. --max-findings is available since v2.1.288. Alias: /review.
/dataviz [request]
Help design accessible charts, graphics, and dashboards.
/debug [description]
Enable debug logging and analyze the current session log.
/design [brief]
Create UI designs as a Claude Design artifact. Requires v2.1.265 or later, available artifacts, and the Design template; Anthropic API only.
/design-sync [prompt]
Sync a React design system into Claude Design.
/doctor [prompt-audit [path]]
Check installation and configuration, find unnecessary context, and offer changes for review. prompt-audit requires v2.1.283 or later. Alias: /checkup.
/fewer-permission-prompts
Suggest a prioritized allowlist for frequent read-only tool calls.
/loop [interval] [prompt]
Repeat a prompt while the session remains open. Alias: /proactive.
/plugin-authoring
Load the reference for developing Claude Code mods. Requires Claude Code v2.1.287 or later.
/run
Start and operate the app so Claude can observe changes in practice.
/run-skill-generator
Create project-specific foundations for /run and /verify.
/simplify [target]
Review changed code for reuse, simplification, efficiency, and abstraction.
/skill-doctor
Show skill context costs and usage. Requires Claude Code v2.1.252 or later and feature-flag fetching.
/slides [brief]
Create a presentation as a Claude Slides artifact. Requires v2.1.265 or later, available artifacts, and the Slides template; Anthropic API only.
/update-config [request]
Change matching settings.json entries from a natural-language request. The first version is not documented.
/verify
Build, start, and observe the application alongside tests and type checks.
/workflow-authoring
Load the reference for creating and editing dynamic workflows. Requires Claude Code v2.1.248 or later with Dynamic Workflows enabled.

For /code-review and /review, --max-findings requires a value. A number limits the findings, all shows every finding, and default resets the limit.

4.1 Bundled Workflow

/deep-research <question>
Fan out web research, cross-check sources, and return a sourced report.

4.2 Retired Commands

/pr-comments
Removed in v2.1.91. Ask Claude to inspect pull-request comments instead.
/ultraplan
Removed. The official reference does not publish a separate removal version. Use plan mode or /plan.
/vim
Removed in v2.1.92. Configure editor mode through /config.
/extra-usage
Replaced by /usage-credits.

5. Keyboard Shortcuts

Keyboard shortcuts make the difference between productive flow and constant looking things up. Here are all available shortcuts for interactive mode.

5.1 General Controls

Ctrl+C
Description
Interrupt the active operation. When idle, the first press clears the prompt and the second exits Claude Code.
Context
Standard interrupt
Ctrl+X Ctrl+K
Description
Stop all background subagents and disable artifact auto-replies for the rest of the session
Context
Press twice within 3 seconds to confirm
Ctrl+D
Description
Show the exit confirmation on an empty prompt. Press again within 800 ms to exit.
Context
With text, delete the character to the right
Ctrl+G / Ctrl+X Ctrl+E
Description
Open prompt in the external editor
Context
For longer prompts
Ctrl+L
Description
Redraw the terminal screen
Context
Keeps conversation history
Ctrl+O
Description
Open Transcript Viewer
Context
Inspect the conversation transcript
Ctrl+R
Description
Reverse search in command history
Context
Interactive history search
Ctrl+T
Description
Toggle task list visibility
Context
Show/hide tasks in status area
Ctrl+V / Cmd+V / Alt+V
Description
Paste an image from the clipboard
Context
Ctrl+V, iTerm2 Cmd+V, or Windows/WSL Alt+V
Ctrl+B
Description
Background the current task
Context
Tmux users press it twice
Ctrl+S
Description
Stash or restore the current prompt
Context
Keep a draft while checking something else
Ctrl+Z
Description
Suspend the process
Context
Unix terminals
Tab
Description
Accept autocomplete or add a comment to a permission response
Context
Prompt and permission dialogs
Arrow keys / Ctrl+P / Ctrl+N
Description
Navigate prompt history
Context
Recall previous inputs
Left / Right arrow
Description
Cycle dialog tabs
Context
In permission dialogs and menus
Esc
Description
Interrupt generation or close a dialog
Context
Single Escape
Esc Esc
Description
Clear a draft or open rewind
Context
Depends on the current state
Option+T / Alt+T
Description
Toggle extended thinking
Context
Has no effect with Opus 5.5, Sonnet 5.5, Haiku 5.5, or the Fable models, where thinking is always enabled
Option+P / Alt+P
Description
Open model picker
Context
Quick model switch without clearing prompt
Option+O / Alt+O
Description
Toggle Fast mode
Context
When the account supports it
Shift+Tab
Description
Switch permission modes
Context
Manual, acceptEdits, Plan, bypass, and Auto. Alt+M is the Windows fallback without VT mode.

5.2 Text Editing

Ctrl+A / Ctrl+E
Description
Move to the start or end of the current line
Context
Line navigation
Ctrl+K
Description
Delete to end of line
Context
Deleted text is stored
Ctrl+U
Description
Delete from cursor to start of line
Context
Deleted text is stored
Ctrl+W
Description
Delete back to the previous whitespace, including a full path or --flag=value
Context
For the previous word, use Option+Delete on macOS or Ctrl+Backspace on Windows
Ctrl+Y
Description
Paste previously deleted text
Context
Paste from kill ring
Alt+Y (after Ctrl+Y)
Description
Cycle through paste history
Context
Cycle previously deleted texts
Alt+B
Description
Move cursor back one word
Context
Option as Meta on macOS
Alt+F
Description
Move cursor forward one word
Context
Option as Meta on macOS
Alt+D
Description
Delete the next word
Context
Option as Meta on macOS
Ctrl+_ / Ctrl+Shift+-
Description
Undo the last edit
Context
Restores text and cursor position

5.3 Multi-line Input

Quick Escape
Shortcut
\\ + Enter
Context
Works in all terminals
Option key
Shortcut
Option+Enter
Context
After enabling Option as Meta on macOS
Shift+Enter
Shortcut
Shift+Enter
Context
Native in iTerm2, WezTerm, Ghostty, Kitty, Warp, Apple Terminal, and Windows Terminal
Control Sequence
Shortcut
Ctrl+J
Context
Line feed for multi-line
Paste Mode
Shortcut
Direct paste
Context
For code blocks, logs

5.4 Quick Commands

/ at start
Description
Execute slash command or skill
Notes
Filters and autocompletes
! at start
Description
Bash mode
Notes
Executes commands directly, output in session
@
Description
Mention a file path or reachable session
Notes
Triggers path autocomplete
:
Description
Insert an emoji shortcut
Notes
Suggestions appear after at least two characters
? on an empty prompt
Description
Toggle shortcut help
Notes
With text in the prompt, it inserts a question mark

5.5 Theme and Voice Input

Ctrl+T in /theme
Description
Toggle syntax highlighting for code blocks
Context
Only inside the theme picker
Hold or tap Space
Description
Start or stop voice dictation
Context
After enabling voice input. Run /voice tap first for tap-to-toggle.

5.6 Transcript Viewer

Ctrl+O opens the full conversation with tool calls and timestamps. The viewer has its own shortcuts.

?
Toggle Transcript Viewer help in the fullscreen renderer
{ / }
Jump to the previous or next user prompt in the fullscreen renderer
Ctrl+E
Toggle all content in the classic renderer
[
Write the full conversation from fullscreen mode to native terminal scrollback
v
Write the conversation to a temporary file and open it in $VISUAL or $EDITOR
q / Ctrl+C / Esc
Close the Transcript Viewer

6. CLI Commands

For everyday work, starting, resuming, and claude mcp are usually enough. According to the CLI reference, the CLI can now also manage background sessions, cloud environments, plugins, and local project data.

The version names a documented introduction release or minimum version. If Anthropic has not documented an introduction release or minimum version, the entry says "Not documented".

claude
Introduced / minimum version
Not documented
Description
Start interactive REPL
Example
claude
claude "query"
Introduced / minimum version
Not documented
Description
Start REPL with initial prompt
Example
claude "explain this project"
claude -p "query"
Introduced / minimum version
Not documented
Description
Query via SDK, then exit
Example
claude -p "explain this function"
cat file | claude -p "query"
Introduced / minimum version
Not documented
Description
Process piped content
Example
cat logs.txt | claude -p "explain"
claude -c
Introduced / minimum version
v0.2.93
Description
Continue most recent conversation
Example
claude -c
claude -c -p "query"
Introduced / minimum version
Not documented
Description
Continue via SDK
Example
claude -c -p "Check for type errors"
claude -r "session" "query"
Introduced / minimum version
v0.2.93
Description
Resume session by ID or name
Example
claude -r "auth-refactor" "Finish this PR"
claude update
Introduced / minimum version
Not documented
Description
Update to latest version
Example
claude update
claude auth login
Introduced / minimum version
v2.1.41
Description
Sign in to an Anthropic account (with --email, --sso, or --console)
Example
claude auth login --sso
claude auth logout
Introduced / minimum version
v2.1.41
Description
Sign out from Anthropic account
Example
claude auth logout
claude auth status
Introduced / minimum version
v2.1.41
Description
Show authentication status (JSON or --text)
Example
claude auth status --text
claude agents
Introduced / minimum version
v2.1.50
Description
CLI command first listed configured agents; Agent View for background sessions arrived in v2.1.139. Script it with --json.
Example
claude agents --json
claude doctor
Introduced / minimum version
Not documented
Description
Check Claude Code installation health
Example
claude doctor
claude mcp
Introduced / minimum version
Not documented
Description
Configure and manage MCP servers. The interactive setup wizard for claude mcp add is documented since v0.2.32.
Example
claude mcp add --transport http github https://api.githubcopilot.com/mcp/
claude mcp login|logout <name>
Introduced / minimum version
v2.1.186
Description
Sign in to or out of an MCP server
Example
claude mcp login github
claude gateway --config
Introduced / minimum version
Not documented
Description
Start an API gateway with a configuration file
Example
claude gateway --config gateway.yaml
claude install [version]
Introduced / minimum version
Not documented
Description
Install a specific Claude Code version
Example
claude install latest
claude attach <id|name>
Introduced / minimum version
Not documented
Description
Attach the terminal to a background session. The CLI help has listed the command since v2.1.251; partial session-name matching is available since v2.1.290.
Example
claude attach 7c5dcf5d
claude auto-mode defaults
Introduced / minimum version
v2.1.208
Description
Print the built-in Auto mode classifier rules as JSON
Example
claude auto-mode defaults
claude auto-mode config
Introduced / minimum version
Not documented
Description
Show the effective Auto mode configuration
Example
claude auto-mode config
claude auto-mode reset
Introduced / minimum version
v2.1.212
Description
Restore the default Auto mode configuration
Example
claude auto-mode reset --yes
claude daemon logs|run
Introduced / minimum version
Not documented
Description
Follow supervisor logs or run the supervisor in the foreground
Example
claude daemon logs
claude daemon status
Introduced / minimum version
Not documented
Description
Inspect the supervisor status and version
Example
claude daemon status
claude daemon stop --any [--keep-workers]
Introduced / minimum version
Not documented
Description
Stop the supervisor across projects. Add --keep-workers to leave its worker sessions running.
Example
claude daemon stop --any
claude import [codex|gemini|cursor]
Introduced / minimum version
v2.1.213
Description
Import configuration from another coding agent. Cursor import is available since v2.1.265.
Example
claude import codex --dry-run
claude logs <id|name>
Introduced / minimum version
Not documented
Description
Show recent output from a background session. The CLI help has listed the command since v2.1.251; partial session-name matching is available since v2.1.290.
Example
claude logs 7c5dcf5d
claude plugin
Introduced / minimum version
Not documented
Description
Manage plugins. The plural form plugins is an alias. Install with --marketplace &lt;source&gt;, available since v2.1.292.
Example
claude plugin install code-review --marketplace anthropics/claude-plugins-official
claude purge [path]
Introduced / minimum version
Not documented
Description
Delete local transcripts, task lists, debug logs, edit and prompt history, and the project entry. Preview with --dry-run first. The old name claude project purge was introduced in v2.1.126 and still works.
Example
claude purge ~/work/repo --dry-run
claude remote-control
Introduced / minimum version
v2.1.51
Description
Start Remote Control so a session can be controlled via claude.ai
Example
claude remote-control --name "My Project"
claude respawn|rm|stop|kill <id>
Introduced / minimum version
Not documented
Description
Restart, remove, or stop managed sessions. kill is an alias for stop. The CLI help has listed these commands since v2.1.251. rm --discard-unpushed &lt;commit&gt;@&lt;worktree-id&gt; discards a worktree and its unpushed commits and requires v2.1.260 or later; --force-remove-worktree &lt;worktree-id&gt; removes a directory Git or its hook could not remove and requires v2.1.268 or later.
Example
claude rm 7c5dcf5d --force-remove-worktree worktree-id
claude self-hosted-runner
Introduced / minimum version
v2.1.224
Description
Manage a self-hosted runner
Example
claude self-hosted-runner setup
claude setup-token
Introduced / minimum version
Not documented
Description
Create or manage a setup token
Example
claude setup-token
claude ultrareview
Introduced / minimum version
v2.1.120
Description
Run the cloud code-review variant. Since v2.1.309, workspace trust is required. Scripts pass --trust-workspace without a value, after a PR number or base branch.
Example
claude ultrareview 1234 --trust-workspace --json

7. CLI Flags

CLI flags are very useful for starting Claude Code with the right settings.

7.1 Basic Flags

-p, --print
Description
Print response without interactive mode
Example
claude -p "query"
-c, --continue
Description
Continue last conversation
Example
claude -c
-r, --resume
Description
Resume specific session by ID or name
Example
claude -r "auth-refactor" "query"
-n, --name
Description
Set display name for session (visible in /resume and terminal title)
Example
claude -n "feature-work"
-w, --worktree
Description
Start in isolated git worktree
Example
claude -w feature-auth
-v, --version
Description
Output version number
Example
claude -v

7.2 Model & System Prompt

--effort
Description
Set effort to low, medium, high, xhigh, max, ultracode, or auto when the selected model supports it
Example
claude --effort high
--model
Description
Set a model with an alias such as sonnet, opus, haiku, or fable, or a full model ID. Claude Haiku 5.5 (claude-haiku-5-5) is the default Haiku model on the Anthropic API.
Example
claude --model sonnet
--system-prompt
Description
Replace entire system prompt
Example
claude --system-prompt "You are a Python expert"
--system-prompt-file
Description
Load system prompt from file (replaces default)
Example
claude --system-prompt-file ./prompt.txt
--append-system-prompt
Description
Append text to default system prompt
Example
claude --append-system-prompt "Always use TypeScript"
--append-system-prompt-file
Description
Append file contents to default system prompt
Example
claude --append-system-prompt-file ./rules.txt
--system-prompt-snapshot
Description
Use off to rebuild the system prompt on each request. Available since v2.1.257.
Example
claude --system-prompt-snapshot off
--exclude-dynamic-system-prompt-sections
Description
Move machine-specific prompt sections into the first user message to improve prompt-cache reuse for scripts
Example
claude -p --exclude-dynamic-system-prompt-sections "query"
--tools
Description
Restrict available tools ("" for none, "default" for all)
Example
claude --tools "Bash,Edit,Read"

7.3 Agents & Subagents

--agent
Description
Specify an agent for the session
Example
claude --agent my-custom-agent
--agents
Description
Define subagents via JSON. In print mode, a JSON file path also works, since v2.1.281.
Example
claude -p --agents ./agents.json "query"
--append-subagent-system-prompt
Description
Append text to every subagent system prompt in print mode
Example
claude -p --append-subagent-system-prompt "Cite file paths" "query"
--append-subagent-system-prompt-file
Description
Append file contents to subagent system prompts in print mode. Available since v2.1.261; cannot be combined with the text flag.
Example
claude -p --append-subagent-system-prompt-file ./subagent-rules.txt "query"
--teammate-mode
Description
Set Agent Teams display mode: in-process, auto, tmux, or iterm2
Example
claude --teammate-mode auto

7.4 Permissions & Security

--allowedTools / --allowed-tools
Description
Allow tools without permission prompt
Example
claude --allowedTools "Bash(git log *)" "Read"
--disallowedTools / --disallowed-tools
Description
Remove tools entirely or deny matching calls
Example
claude --disallowedTools "Edit" "Bash(curl *)"
--permission-mode
Description
Start in specific permission mode
Example
claude --permission-mode plan
--restricted
Description
Start in restricted mode. By default, removes command and code tools and WebFetch, confines file tools to working directories, loads only managed settings and settings supplied with --settings, and refuses bypassPermissions and cloud sessions. Requires v2.1.248 or later.
Example
claude --restricted
--allow-dangerously-skip-permissions
Description
Add bypass mode to Shift+Tab without starting the session in it
Example
claude --permission-mode plan --allow-dangerously-skip-permissions
--dangerously-skip-permissions
Description
Skip all permission prompts (use with caution!)
Example
claude --dangerously-skip-permissions
--permission-prompt-tool
Description
MCP tool for permission prompts (non-interactive)
Example
claude -p --permission-prompt-tool mcp_tool "query"
--permission-prompts
Description
Choose who answers permission prompts in print mode. none denies them automatically. Available since v2.1.259.
Example
claude -p --permission-prompts none "query"

7.5 MCP Server & Integration

--mcp-config
Description
Load MCP servers from JSON files (space-separated)
Example
claude --mcp-config ./mcp.json
--strict-mcp-config
Description
Use ONLY --mcp-config, ignore all other MCP sources
Example
claude --strict-mcp-config --mcp-config ./mcp.json
--plugin-dir
Description
Load plugins from a directory (repeat flag for multiple)
Example
claude --plugin-dir ./my-plugins
--plugin-url
Description
Load a plugin ZIP from a URL for this session
Example
claude --plugin-url https://example.com/plugin.zip
--chrome / --no-chrome
Description
Enable/disable Chrome browser integration
Example
claude --chrome
--ide
Description
Automatically connect to IDE at startup
Example
claude --ide
--channels
Description
Research Preview for MCP channel notifications from plugins
Example
claude --channels plugin:my-notifier@my-marketplace
--dangerously-load-development-channels
Description
Load unapproved channels for local development after confirmation
Example
claude --dangerously-load-development-channels server:webhook
--betas
Description
Beta headers for API requests (API key only)
Example
claude --betas "feature-x"

7.6 Output & Format

--output-format
Description
Specify output format (text, json, stream-json)
Example
claude -p "query" --output-format json
--input-format
Description
Specify input format (text, stream-json)
Example
claude -p --input-format stream-json
--json-schema
Description
Get validated JSON matching schema (print mode only)
Example
claude -p --json-schema '{...}' "query"
--include-partial-messages
Description
Include partial streaming events (stream-json only)
Example
claude -p --output-format stream-json --include-partial-messages "query"
--forward-subagent-text
Description
Emit subagent text and thinking blocks in stream-json output
Example
claude -p --output-format stream-json --verbose --forward-subagent-text "query"
--include-hook-events
Description
Emit hook lifecycle events in stream-json output
Example
claude -p --output-format stream-json --verbose --include-hook-events "query"
--prompt-suggestions
Description
Emit predicted follow-up prompts in stream-json output
Example
claude -p --prompt-suggestions --output-format stream-json --verbose "query"
--replay-user-messages
Description
Re-emit incoming user messages when both input and output use stream-json
Example
claude -p --input-format stream-json --output-format stream-json --verbose --replay-user-messages
--verbose
Description
Enable verbose logging with full turn-by-turn output
Example
claude --verbose

7.7 Directories & Session

--add-dir
Description
Add additional working directories
Example
claude --add-dir ../apps ../lib
--environment
Description
Start a cloud session in a self-hosted environment by ID
Example
claude -p "Fix the login" --environment ccpool_abc123
--ref
Description
Use a named Git ref instead of local HEAD with --environment
Example
claude -p "Run the build" --environment ccpool_abc123 --ref main
--from-pr
Description
Resume sessions linked to a GitHub PR
Example
claude --from-pr 123
--session-id
Description
Use specific session ID (UUID)
Example
claude --session-id "550e8400-..."
--fork-session
Description
Create new session ID when resuming
Example
claude --resume abc123 --fork-session
--no-session-persistence
Description
Disable session saving (print mode only)
Example
claude -p --no-session-persistence "query"
--tmux
Description
Create a tmux session for a worktree, optionally with --tmux=classic
Example
claude -w feature-auth --tmux

7.8 Remote & More

--desktop
Description
Open the Claude Desktop app in the current directory and exit the CLI. Available since v2.1.285; requires macOS or Windows x64 and a Claude subscription.
Example
claude --desktop
--cloud
Description
Start or target a cloud session on claude.ai
Example
claude --cloud "Fix all bugs"
--remote
Description
Deprecated alias for --cloud
Example
claude --remote "Fix all bugs"
--bg, --background
Description
Start a background agent and return its session ID immediately. Do not combine with -p.
Example
claude --bg "check the flaky test"
--exec
Description
Run a shell command as a PTY-backed background job together with --bg
Example
claude --bg --exec 'pytest -x'
--remote-control, --rc
Description
Start with Remote Control (session controllable via claude.ai)
Example
claude --rc "My Project"
--remote-control-session-name-prefix
Description
Set the prefix for automatically generated Remote Control session names
Example
claude remote-control --remote-control-session-name-prefix dev-box
--teleport
Description
Resume remote web session locally
Example
claude --teleport
--debug
Description
Enable debug logging. Category filters must follow an equals sign.
Example
claude --debug='api,mcp'
--debug-file
Description
Write debug logs to a specified file and enable debugging
Example
claude --debug-file /tmp/claude-debug.log
--max-turns
Description
Limit agentic turns (print mode only)
Example
claude -p --max-turns 3 "query"
--max-budget-usd
Description
Maximum budget in USD (print mode only)
Example
claude -p --max-budget-usd 5.00 "query"
--fallback-model
Description
Auto-fallback on overload (print mode only)
Example
claude -p --fallback-model sonnet "query"
--init / --maintenance / --init-only
Description
Run Setup hooks for initialization or maintenance, or exit after setup
Example
claude -p --maintenance "query"
--settings
Description
Load settings from JSON file or string
Example
claude --settings ./settings.json
--setting-sources
Description
Comma-separated list of settings sources (user, project, local)
Example
claude --setting-sources "user,project"
--safe-mode
Description
Troubleshoot without local customization such as CLAUDE.md, skills, plugins, and hooks
Example
claude --safe-mode
--bare
Description
Minimal mode for scriptable calls without automatic project customization
Example
claude --bare -p "query"
--autocompact
Description
Set the auto-compaction window for this session only
Example
claude --autocompact 500k
--advisor
Description
Enable the server-side Advisor for this session
Example
claude --advisor opus
--ax-screen-reader
Description
Force simplified, screen-reader-friendly output
Example
claude --ax-screen-reader
--disable-slash-commands
Description
Disable all skills and commands for this session
Example
claude --disable-slash-commands

8. Environment Variables

Beyond CLI flags, there are numerous environment variables that control Claude Code behavior. Set them in your shell or in settings.json under the env key. Values in a settings env override shell variables. Changes apply to running sessions unless a variable is explicitly read only at startup.

8.1 Model & Performance

ANTHROPIC_MODEL
Description
Set the default model. --model and /model override it.
Default
Provider default
CLAUDE_CODE_EFFORT_LEVEL
Description
Set low, medium, high, xhigh, max, or auto when the selected model supports it. Overrides /effort and settings.
Default
Model-dependent
CLAUDE_CODE_MAX_OUTPUT_TOKENS
Description
Limit output tokens per response. A higher value reduces usable context.
Default
Model-dependent
MAX_THINKING_TOKENS
Description
Set a fixed thinking budget. Adaptive thinking remains active until CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING is set. 0 disables thinking on the Anthropic API except for Opus 5.5, Sonnet 5.5, Haiku 5.5, and the Fable models.
Default
Model-dependent
CLAUDE_CODE_SUBAGENT_MODEL
Description
Model for subagents, Agent Teams, and workflows. Accepts an alias or full ID; inherit uses the session model.
Default
Session model
CLAUDE_CODE_SUBAGENT_EFFORT
Description
Effort level for subagents when nothing else sets one. Without it, they inherit the session effort. Since v2.1.316.
Default
Session effort

8.2 Bash & Timeouts

BASH_DEFAULT_TIMEOUT_MS
Description
Default timeout for Bash commands in milliseconds
Default
120,000 (2 min)
BASH_MAX_TIMEOUT_MS
Description
Upper bound for Bash timeouts in milliseconds
Default
600,000 (10 min)
BASH_MAX_OUTPUT_LENGTH
Description
Maximum Bash output in characters. The allowed range ends at 150,000.
Default
30,000
MAX_MCP_OUTPUT_TOKENS
Description
Token limit for MCP tool output
Default
25,000

8.3 Feature Toggles

CLAUDE_CODE_DISABLE_AUTO_MEMORY
Description
Disable automatic memory creation
Value
1 = off
CLAUDE_CODE_DISABLE_BACKGROUND_TASKS
Description
Disable background tasks
Value
1 = off
CLAUDE_CODE_DISABLE_CRON
Description
Stop scheduled cron jobs in session
Value
1 = off
CLAUDE_CODE_DISABLE_1M_CONTEXT
Description
Disable the 1M token context window
Value
1 = off
CLAUDE_CODE_DISABLE_GIT_INSTRUCTIONS
Description
Remove git instructions from system prompt
Value
1 = off
CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION
Description
Control prompt suggestions (grayed-out suggestion text)
Value
false = off
CLAUDE_CODE_TASK_LIST_ID
Description
Named task list for cross-session tasks
Value
e.g., my-project
CLAUDE_CODE_DISABLE_ULTRATHINK
Description
Turn off the ultrathink keyword. Since v2.1.311, ultrathink in the terminal raises a turn to xhigh effort on Opus 5.5, Sonnet 5.5, Haiku 5.5, Fable 5.2, and Fable 5.1 through the Anthropic API. Variable since v2.1.316.
Value
1 = off
CLAUDE_CODE_DISABLE_BUNDLED_SKILLS
Description
Disable bundled skills for the session
Value
1 = off
CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS
Description
Maximum number of concurrent subagents
Value
Default: 20
CLAUDE_CODE_SKIP_PROMPT_HISTORY
Description
Disable input and transcript history
Value
1 = off
CLAUDE_CODE_SUBPROCESS_ENV_SCRUB
Description
Remove provider secrets from spawned subprocess environments
Value
1 = on
ENABLE_TOOL_SEARCH
Description
Control on-demand MCP tool loading. Accepts true, false, auto, or auto:N.
Value
Provider-dependent
ENABLE_CLAUDEAI_MCP_SERVERS
Description
Control claude.ai MCP servers
Value
false = off
DISABLE_AUTOUPDATER
Description
Disable automatic updates. Manual updates remain available.
Value
1 = off
DISABLE_UPDATES
Description
Block manual updates too.
Value
1 = off
DISABLE_TELEMETRY
Description
Opt out of telemetry and feature-flag requests. This also removes Remote Control, import, schedule, and Advisor.
Value
Any non-empty value
DO_NOT_TRACK
Description
Alternative telemetry opt-out
Value
1 = off

8.4 Authentication & Provider

ANTHROPIC_API_KEY
Description
API key for Anthropic
Context
Required without subscription
ANTHROPIC_BASE_URL
Description
Alternative base URL for an Anthropic-compatible API
Context
Proxy or own gateway
CLAUDE_CODE_USE_BEDROCK
Description
Use AWS Bedrock as provider
Context
1 = enabled
CLAUDE_CODE_USE_VERTEX
Description
Use Google Vertex AI as provider
Context
1 = enabled
CLAUDE_CODE_USE_FOUNDRY
Description
Use Microsoft Foundry as provider
Context
1 = enabled
HTTP_PROXY / HTTPS_PROXY
Description
Proxy configuration
Context
For corporate networks

9. MCP (Model Context Protocol) Integration

MCP is one of Claude Code's most important extensions. With it, you can directly integrate external tools and services. The community is already delivering hundreds of MCP server implementations and constantly expanding the ecosystem.

Setting Up MCP Servers
# Add MCP server
claude mcp add --transport http github https://api.githubcopilot.com/mcp/

# Start with debug
claude --debug='mcp'

# Expose Claude Code itself as an MCP server
claude mcp serve

Tool Search can load MCP tools on demand and save context. Control it through ENABLE_TOOL_SEARCH, for example with auto, true, false, or auto:N.

Another feature is MCP Elicitation: MCP servers can display interactive forms or browser URLs during a task to request structured input. MCP servers can also provide their own commands in the format /mcp__<server>__<prompt>.

10. Skills

One of the coolest features of Claude Code? You can create your own skills that perfectly fit your workflow. Skills are the evolution of former custom commands and follow the open Agent Skills standard.

Project skills are stored in .claude/skills/ and are available to everyone in the project. Personal skills go in ~/.claude/skills/ and only apply to you. Enterprise skills are distributed organization-wide through managed settings.

Creating a Skill (.claude/skills/test-all/SKILL.md)
---
name: test-all
description: Runs all tests and linters
argument-hint: [test-suite] [flags]
allowed-tools: Bash(npm test:*), Bash(npm run:*)
model: sonnet
disable-model-invocation: false
context: fork
---

Run the following tests:
1. npm test $ARGUMENTS
2. npm run lint
3. npm run typecheck

Show me a summary of all results.

After creating it, simply type /test-all and Claude runs your complete test suite. I have about 10 such skills for recurring tasks.

Before writing a skill from scratch, check our directory of 400+ ready-made Claude Code Skills. Many recurring tasks, like test runs, reviews, or deployments, already exist there as ready-to-use SKILL.md downloads.

11. Troubleshooting: When Claude Code Doesn't Do What It Should

Even after hundreds of sessions, I sometimes run into problems. Here are the most common errors and their solutions.

Claude doesn't understand project
Cause
Wrong start folder
Solution
Start in project root, create CLAUDE.md
Token limit reached
Cause
Too much context
Solution
Use /clear, /compact for smart compression
Commands don't work
Cause
Outdated version
Solution
Run /doctor, then run claude update only if it recommends an update
MCP server won't connect
Cause
Missing configuration
Solution
Run claude --debug=mcp for diagnosis
Shift+Enter doesn't work
Cause
Terminal setup missing
Solution
Use /terminal-setup in supported terminals. Warp, iTerm2, and Windows Terminal support Shift+Enter natively.

You can use the following debug commands for problem analysis:

Debugging Commands
# Check system status
/status

# Check installation
/doctor

# Visualize context usage
/context

# Show token costs
/cost

# Verbose mode for details
claude --verbose

# Activate debug mode
claude --debug='api,mcp'

# Session troubleshooting
/debug "my problem"

# Open configuration
/config

Frequently Asked Questions About Claude Code Commands

After installing it, open a terminal in your project folder and start Claude Code. Describe a concrete task. To begin, ask Claude Code to explain the existing code and suggest a small change.

Review the proposed changes and the tests before you accept them. For a full introduction, see the Claude Code guide.

Use the @ symbol followed by the file path to reference files. Claude Code then offers autocomplete for paths. You can also use /add-dir to add additional working directories that are then available in the session.

Six are enough to start: /init, /clear, /compact, /resume, /model, and /plan. They let you set up a project, manage sessions and context, and plan before changing code. /help shows all commands at any time. Add more once you use these confidently.

Yes, as a skill: create a SKILL.md file in .claude/skills/my-skill/ (project) or ~/.claude/skills/my-skill/ (personal). YAML frontmatter sets allowed-tools, description, argument-hint, and model. This pays off for recurring tasks.

Run /compact to compress the context, optionally with focus instructions, e.g., /compact 'Focus on the API implementation'. For a fresh start, delete the complete context with /clear.

No, not all of them. Effort levels, thinking, remote features, and individual integrations in particular depend on the model, platform, plan, and provider. /model, /effort, and /help in your own session show what is available to you.

Use 'claude mcp add --transport http' with a name and server URL. The official GitHub endpoint is https://api.githubcopilot.com/mcp/. Manage the configuration via /mcp. For supported models, Tool Search defers MCP tools by default; ENABLE_TOOL_SEARCH lets you control that behavior when your runtime supports the setting.

With headless mode: run Claude with --output-format json or stream-json. Combine this with -p for one-time execution without interactive mode and --max-turns to limit the number of agentic turns. Example: claude -p 'Fix ESLint errors' --output-format json --max-turns 5
FH

Finn Hillebrandt

AI Expert & Blogger

Finn Hillebrandt is the founder of Gradually AI, an SEO and AI expert. He helps online entrepreneurs simplify and automate their processes and marketing with AI. Finn shares his knowledge here on the blog in 50+ articles as well as through the AI Business Club.

Learn more about Finn and the team, follow Finn on LinkedIn, join his Facebook group for ChatGPT, OpenAI & AI Tools or do like 17,500+ others and subscribe to his AI Newsletter with tips, news and offers about AI tools and online business. Also visit his other blog, Blogmojo, which is about WordPress, blogging and SEO.