Claude Code reference
Claude Code commands list and CLI flags
Type / at the start of a message to open the Claude Code commands list, then type a few letters to filter it. Text after a command supplies its arguments. To reopen a session, use /resume inside Claude or pass --resume to claude in your terminal.
Last updated · Published
By CWYN · Published
1. Claude Code command lookup
Use the slash commands inside a conversation and the CLI flags when starting Claude from your shell. For a shorter printable sheet, jump to daily commands.
Checked against docs, not run. Anthropic’s command reference and CLI reference (as of ).
Built-in slash commands
Names on the same row are aliases. Availability depends on your platform, plan and environment. The workflow examples also cover bundled skills such as /doctor and /code-review.
Session · Context · Model · Permissions · Config
| Slash command | What it does |
|---|---|
| Session | |
/artifacts | Find an artifact you own or can access, then attach it to the session or open it. |
/autofix-pr | Start a cloud session that watches the current branch’s pull request and pushes fixes for CI or review feedback. |
/background, /bg | Detach the session so it can keep working after you leave the terminal. |
/branch | Switch to a copy of this conversation and keep the original available to resume. |
/bug, /share | Choose how much session history to include in a bug report before sending it. |
/cd | Change the working directory while keeping the current conversation. |
/desktop, /app | Continue this terminal session in the Claude Code desktop app. |
/diff | Inspect uncommitted changes in the working tree, including edits Claude made. |
/exit, /quit | Leave the CLI or detach from an attached background session. |
/feedback | Open the feedback dialog to send Anthropic a product suggestion. |
/fork | Start a background copy of the conversation, or a subagent when agent view is off. |
/goal | Give Claude a condition to work toward across turns, check progress or clear the goal. |
/insights | Generate an HTML report about your recent local sessions and how you use Claude Code. |
/list-agents, /peers | List the agents, teammates and sessions you can message. |
/plan | Enter plan mode, optionally supplying the task you want Claude to plan. |
/rate-limit-options | See the options available when your account reaches a usage limit. |
/remote-control, /rc | Connect to this local session from another device using Remote Control. |
/rename | Give this session a name you can recognize in the session picker. |
/restart, /update | Restart into an installed update and resume the session on supported installations. |
/resume, /continue | Reopen a saved conversation by name or ID, or pick one from the list. |
/rewind, /checkpoint, /undo | Return code or conversation history to a checkpoint, or summarize from that point. |
/schedule, /routines | Create, inspect, update or run a scheduled cloud task. |
/security-review | Check the current branch’s diff against the default branch on origin for security issues. |
/stop | Stop a background session while retaining its transcript and worktree. |
/subtask | Delegate a task to a subagent that inherits the conversation and reports back here. |
/tasks, /bashes | Check progress on background work and see which subagents have finished. |
/teleport, /tp | Bring a selected cloud conversation into your local terminal. |
/usage, /cost, /stats | Inspect session cost, plan limits and activity, with /stats opening the statistics tab. |
/workflows | View progress, pause or resume a workflow, or save it for later. |
| Context | |
/autocompact | Choose how full the context window can get before Claude summarizes it automatically. |
/btw | Ask a side question without adding the exchange to the main conversation. |
/clear, /new, /reset | Start with empty conversation context while keeping the previous session available to resume. |
/compact | Summarize the conversation to make room, optionally naming details to keep. |
/context | See which tools, instructions and messages are taking up the context window. |
/copy | Copy Claude’s latest reply to the clipboard, or pass a number to select an earlier reply. |
/export | Save the conversation as plain text or copy it to the clipboard. |
/init | Create a starter CLAUDE.md with project instructions. |
/memory | Edit CLAUDE.md instructions and inspect or toggle auto memory. |
/recap | Get a one-line reminder of what you were doing in this session. |
/skill-doctor | See how much context each skill uses and how often it is called. |
| Model | |
/advisor | Choose the second model Claude can consult for advice, or turn the advisor off. |
/effort | Set the reasoning effort or check the current level. |
/fast | Turn fast mode on or off for a supported model. |
/model | Choose a model and save the default, or press s in the picker to switch only this session. |
| Permissions | |
/add-dir | Give Claude file access to an additional working directory. |
/auto-mode-setup | Draft auto mode rules from the project and recent sessions, then review them before saving. |
/design consent | Grant Claude access to Claude Design. |
/design revoke | Withdraw Claude’s access to Claude Design. |
/design-login | Sign in to authorize access to your design system. |
/login | Sign in to your Anthropic account. |
/logout | Sign out of the account connected to Claude Code. |
/permissions, /allowed-tools | Inspect and edit rules for which tool calls Claude can run, must ask about or must deny. |
/privacy-settings | Review or update the privacy settings available to your account. |
/sandbox | Switch sandboxing on or off on supported platforms. |
/web-setup | Connect GitHub for cloud sessions using the credentials from your local GitHub CLI. |
| Config | |
/agents | Show how to create or edit subagent definitions. |
/chrome | Configure the Claude in Chrome integration. |
/color | Change the color of this session’s prompt bar. |
/config, /settings | Open settings or pass a supported key and value to change it directly. |
/focus | Switch the fullscreen view between the full transcript and a compact summary of the turn. |
/heapdump | Write local memory diagnostics to investigate high memory use. |
/help | Open help and see the commands available in this session. |
/hooks | Inspect the hooks configured for Claude Code. |
/ide | Check the IDE connection and manage editor integrations. |
/import | Bring local settings and other configuration from Codex, Gemini CLI or Cursor into Claude Code. |
/install-github-app | Set up the Claude GitHub App for a repository on GitHub.com. |
/install-slack-app | Open the sign-in flow to install the Claude Slack app. |
/keybindings | Open the file where you customize keyboard shortcuts. |
/mcp | Manage MCP server connections and authentication. |
/mobile, /ios, /android | Show a QR code for downloading the Claude mobile app. |
/output-style | List output styles or select the one Claude should use. |
/passes | Share a week of Claude Code access if your account is eligible. |
/plugin | Inspect, install, enable or disable Claude Code plugins. |
/powerup | Explore Claude Code features through short interactive lessons. |
/radio | Open Claude FM in a browser or get the stream address. |
/release-notes | Pick a release to read its changes. |
/reload-plugins | Apply changes to active plugins without restarting Claude Code. |
/reload-skills | Rescan skill and command directories to pick up edits made during the session. |
/remote-env | Choose the default environment for cloud sessions launched from the CLI. |
/scroll-speed | Adjust mouse-wheel scrolling in supported fullscreen terminals. |
/setup-bedrock | Configure credentials, region and model choices for Amazon Bedrock. |
/setup-vertex | Configure authentication, project, region and model choices for Google Cloud. |
/skills | Browse available skills and manage which ones appear in the slash menu. |
/status | Inspect the running version, model, account and connection status. |
/statusline | Configure the information shown in the terminal status line. |
/stickers | Check whether Claude Code stickers are available. |
/team-onboarding | Create a guide for teammates using examples from your recent Claude Code sessions. |
/terminal-setup | Apply the newline, bell or clipboard settings supported by your terminal. |
/theme | Choose a color theme or follow the terminal’s light or dark appearance. |
/tui | Check the active terminal renderer or relaunch with a different renderer. |
/upgrade | Open the page for changing to a higher plan. |
/usage-credits | Open usage-credit settings or request credits from a billing administrator. |
/voice | Enable, disable or change the activation mode for voice dictation. |
Anthropic’s slash command reference (as of ).
Main CLI flags
Put flags after claude at your shell prompt. For example, claude --continue reopens recent work and claude -p "Explain this project" prints an answer and exits. Replace values in angle brackets with your own. Square brackets mark optional values.
Session · Context · Model · Permissions · Config
| Flag | What it does |
|---|---|
| Session | |
--background, --bg | Start a background session and return control to the shell. |
--continue, -c | Continue the most recent eligible conversation for the current directory. |
--fork-session | Give a resumed conversation its own session ID when used with --resume or --continue. |
--from-pr <PR> | Open the session picker filtered to a particular pull request. |
--max-budget-usd <amount> | Stop a print-mode run when its estimated API spend reaches the dollar limit. |
--max-turns <count> | Limit how many turns Claude can take in a print-mode run. |
--name, -n <name> | Name the session so you can find it again. |
--no-session-persistence | Skip saving a print-mode session to disk. |
--print, -p | Write the response to standard output and exit. |
--remote-control, --rc | Start an interactive session you can also control from Claude on another device. |
--resume, -r [session] | Reopen the session with this name or ID, or show the picker if you omit it. |
--worktree, -w [name] | Start the session in a separate Git worktree. |
| Context | |
--append-system-prompt <text> | Add instructions to the default system prompt. |
--autocompact <size> | Set the automatic compaction threshold for this session. |
--system-prompt <text> | Replace the default system prompt with your own instructions. |
| Model | |
--effort <level> | Set the reasoning effort for this session on a model that supports it. |
--fallback-model <model> | Select a model to try if the primary model is unavailable or overloaded. |
--model <model> | Choose the model for this session by alias or full model name. |
| Permissions | |
--add-dir <path> | Allow Claude to read and edit files in an additional directory. |
--allowedTools, --allowed-tools <rules> | Preapprove tool calls that match the supplied permission rules. |
--dangerously-skip-permissions | Run with permission prompts bypassed, a mode Anthropic recommends only in an isolated environment. |
--disallowedTools, --disallowed-tools <rules> | Deny matching tool calls or remove a named tool from the available set. |
--permission-mode <mode> | Start in the selected permission mode, such as plan. |
--tools <list> | Choose which built-in tools are available in the session. |
| Config | |
--agent <name> | Use a particular agent definition for this session. |
--debug | Turn on diagnostic logging. |
--help | Display the CLI’s help text. |
--input-format <format> | Read print-mode input as plain text or streaming JSON. |
--json-schema <schema> | Validate the final print-mode result against a JSON Schema. |
--mcp-config <config> | Load MCP server definitions from a JSON file or inline JSON. |
--output-format <format> | Choose text, JSON or streaming JSON for print-mode output. |
--plugin-dir <path> | Load a plugin from the supplied path for this session. |
--settings <settings> | Apply settings from a JSON file or inline JSON for this session. |
--verbose | Show detailed output for each turn. |
--version, -v | Print the installed Claude Code version. |
Anthropic’s CLI flag reference (as of ).
Daily Claude Code commands
For a PDF of the daily commands, workflow examples and keyboard shortcuts, choose Print in your browser, then Save as PDF.
| Command | Use it when |
|---|---|
/plan | You want a plan before editing code. |
/context | You want to see what is taking up context. |
/compact | You need room to keep working on the same task. |
/diff | You want to read the edits in your working tree. |
/rewind | You want to return to a point before a mistaken edit. |
/clear | You are starting an unrelated task with empty context. |
/resume | You want to pick up a previous conversation. |
/status | You need to check the current model, account or connection. |
/usage | You want to check session cost or plan usage limits. See How the 5-hour and weekly Claude Code usage limits work. |
Claude Code command reference (as of ).
2. Claude Code slash commands by moment
First session
| Command | What it does | Use it when |
|---|---|---|
/init | Creates a project guide in CLAUDE.md. | A new repository needs project instructions. |
/memory | Opens CLAUDE.md files for editing and lets you inspect or toggle auto memory. | You need to check a missing project rule. |
/mcp | Manages MCP connections and sign-in. Use reconnect with a server name to reconnect it. | A configured MCP server is missing. |
/permissions | Opens the allow, ask and deny rules for tools. | Claude keeps asking about a command you allowed. |
First-session commands (as of ).
During a task
| Command | What it does | Use it when |
|---|---|---|
/plan | Enters plan mode. Add a task description to start planning it. | You want to review a plan before Claude edits your code. |
/model | Sets the default model for new sessions. Press s in the picker for this session only. See Claude Code model aliases and how to pick one. | You want to try another model on the current task. |
/effort | Sets the effort level. auto selects automatic effort and max lasts for the session. | You want to adjust how much effort Claude puts into a problem. |
/context | Shows a grid of context usage and suggestions for freeing space. | You are checking context while tracing a missing instruction. |
/compact | Summarizes the conversation to free context. Add instructions to focus the summary. | You need more room but want to keep the failing test in view. Try /compact keep the failing test. |
/btw | Answers a side question without adding it to the conversation. | You have a quick question while working on something else. |
Task and context commands (as of ).
Parallel work
| Command | What it does | Use it when |
|---|---|---|
/tasks | Shows background work, including finished subagents. | You want to see which tasks have finished. |
/background | Moves work into the background. | You want to keep working while a task runs. |
/batch | Bundled skill that splits large changes across worktrees. | You have the same change to make in several independent modules. |
Parallel work commands (as of ).
Before you ship
| Command | What it does | Use it when |
|---|---|---|
/diff | Shows working-tree changes, including Claude’s edits. | You want to read the patch before you commit. |
/code-review | Bundled skill that checks a diff, PR, branch or path for correctness bugs. /review is an alias. | You want findings on a change. Add --fix to apply them. |
/security-review | Checks the branch diff against the default branch on origin for vulnerabilities. | You have an origin remote and want a security check before merging. |
Diff and review commands (as of ).
Between sessions
| Command | What it does | Use it when |
|---|---|---|
/clear | Starts a conversation with empty context. /reset and /new are aliases. | Your next task can start fresh. |
/resume | Opens the session picker, or takes a session name or ID. | You want to return to an earlier session. |
/branch, /fork | Switch to a new branch of the conversation, or fork a copy into the background. | You want to try a second approach from the same starting point. |
/teleport | Pulls a cloud session into this terminal. | You are changing where you work on a conversation. |
/remote-control | Provides remote access to a session. | You want to continue from another device. |
Session commands (as of ).
When something is wrong
| Command | What it does | Use it when |
|---|---|---|
/rewind | Rewinds the conversation, code or both. You can also summarize from a message. | You want to undo a file edit from a checkpoint. |
/doctor | Bundled skill that checks your setup and proposes fixes for you to confirm. | You suspect an installation or settings problem. |
/hooks | Shows configured hooks. | You need to see why a hook did not fire. |
/debug | Bundled skill that uses the session debug log to investigate a problem. | You want to trace an error you can reproduce. |
/feedback | Lets you report a problem with Claude Code. | You have a bug report to share. |
Troubleshooting commands (as of ).
3. Keyboard shortcuts
| Keys | What they do |
|---|---|
| Shift+Tab | Cycle through permission modes. |
| Esc | Interrupt Claude’s response. |
| Esc Esc | Press Escape twice to open the rewind menu. |
| Ctrl+C | Cancel your input, or exit when the prompt is empty. |
| Ctrl+R | Search backward through your prompt history. |
| @ + path | Reference a file. For example, @README.md. |
| ? | Show the exact shortcuts available in your environment. |
Anthropic’s Claude Code cheatsheet (as of ).
4. Claude Code commands vs skills
Built-in commands are coded into the CLI. For example, /status opens the Status tab in Settings. The slash menu also includes bundled workflows and skills. A bundled skill or a skill you write gives Claude a prompt to follow.
To make a custom command for your project, write the prompt in .claude/skills/<name>/SKILL.md. The legacy .claude/commands/ directory still works. Follow the project skill walkthrough to turn a repeated request into a command.
Command types, Claude Code skills and custom command paths (as of ).
5. Claude Code commands FAQ
Why is a slash command missing?
Availability depends on your platform, plan and environment. Type / at an empty prompt to see your session’s list. If the command appears there, put it at the start of your message. Command availability (as of ).
What is the difference between /clear and /compact?
Use /compact to continue the same conversation with a shorter summary. Use /clear to start a new conversation with empty context. You can use /resume to return to the previous conversation. See what survives compaction before choosing. Context and session commands (as of ).
How do I make a custom command?
Choose a name for the skill and put its prompt in .claude/skills/<name>/SKILL.md in your project. At the Claude Code prompt, type a slash followed by the skill name to run it. For a working example, see the handoff skill in the Claude Code Complete Setup Pack. Create a project skill (as of ).
Can I run a command while Claude is working?
Yes. A command normally waits until the current turn finishes. /status, /tasks and /usage can run immediately while Claude continues responding. Commands during a response (as of ).
Where can I see my Claude Code usage?
Run /usage to see session cost, plan usage limits and activity statistics. /cost and /stats are aliases. To put the session cost in context, compare API charges with a subscription. Usage command and aliases (as of ).