Commands - Claude Code Docs
Documentation Index Fetch the complete documentation index at: /docs/llms.txt Use this file to discover all available pages before exploring further. Skip to main content Assistant Responses are generated using AI and may contain mistakes. Commands control Claude Code from inside a session. They provide a quick way to switch models, manage permissions, clear context, run a workflow, and more. Type / to see the commands available to you, or type / followed by letters to filter.
How the command menu matches what you type covers highlighting, typos, and the few commands Claude Code hides from the menu until you type their full name. A command is only recognized at the start of your message. Text that follows the command name becomes its arguments. At the terminal prompt, you can start one message with several skills : typing /skill-a /skill-b do XYZ loads both skills and passes the trailing text to each as arguments.
Up to six skills can be chained. If you send a command while Claude is responding, Claude Code queues it and runs it after the current turn finishes. Claude Code runs some commands immediately without interrupting the response, such as /status , /tasks , and /usage . In fullscreen rendering , Claude Code also opens dialog commands such as /theme and /help immediately. Before v2.1.234, Claude Code queued those dialogs until the turn finished.
Commands across a typical workflow Most commands are useful at a specific point in a session, from setting up a project to shipping a change. First session in a repo. Run /init to generate a starter CLAUDE.md , then /memory to refine it. Use /mcp to set up any servers the project needs, ask Claude to create any subagents you want, and run /permissions to set your approval rules. During a task. /plan switches into plan mode before a large change. /model and /effort adjust which model you’re using and how much reasoning it applies.
When the conversation gets long, /context shows what’s filling the window and /compact summarizes it to free space. Use /btw for a side question that shouldn’t add to the conversation history. Run work in parallel. Claude delegates side tasks to subagents , and /tasks lists the current session’s background work, including subagents that have finished. /background detaches the whole session to keep running as a background agent and frees your terminal.
For a large change that spans the codebase, /batch decomposes it into independent units and runs each in its own worktree . See Run agents in parallel for how these approaches relate. Before you ship. /diff shows what changed. /code-review checks the current diff for correctness bugs and can apply the findings with --fix ; pass a PR number, such as /code-review high 1234 , to review a pull request instead. /review is an alias. /code-review ultra runs a multi-agent review in the cloud. /security-review checks the diff for security vulnerabilities.
Between sessions. /clear starts fresh on a new task while keeping project memory. /resume returns to an earlier conversation, /branch branches the current one to try a different direction, and /fork copies it into a new background session . /teleport pulls a cloud session into this terminal, and /remote-control lets you continue this local session from another device. When something is wrong. /rewind rolls code and conversation back to a checkpoint, or summarizes part of the conversation. /doctor runs a setup checkup that diagnoses installation and configuration issues and can fix them, /debug diagnoses runtime issues, and /feedback reports a bug with session context attached.
All commands The table below lists all the commands included in Claude Code. Most are built-in commands whose behavior is coded into the CLI. Two kinds of entries are marked: Skill : a bundled skill. It works like skills you write yourself: a prompt handed to Claude. Workflow : a bundled dynamic workflow that fans work out across many subagents and runs in the background. To add your own commands, see skills . In the table below, <arg> indicates a required argument and [arg] indicates an optional one.
Not every command appears for every user. Availability depends on your platform, plan, and environment. For example, /desktop only shows on macOS and x64 Windows when signed in with a Claude subscription, and /upgrade doesn’t show on Enterprise plans. Command Purpose /add-dir <path> Add a working directory for file access. Type a partial path to see matching directory suggestions; press Tab to accept one. Most .claude/ configuration isn’t discovered from the added directory.
You can’t add most network paths , such as \\server\share . After a successful add, your DirectoryAdded hooks run. If you run /add-dir while Claude is responding, Claude’s next tool call can access the directory once you confirm the add /advisor [model|off] Enable or disable the advisor tool , which consults a second model for guidance at key moments during a task. Accepts fable , opus , sonnet , or a full model ID. fable requires Fable access .
Without an argument, opens a picker. In a session without an interactive terminal, or over Remote Control , pass the model or off as an argument; with no argument there, the command prints the current advisor as text. These forms require Claude Code v2.1.260 or later /agents Print a reminder to ask Claude to create or manage subagents , or to edit .claude/agents/ or ~/.claude/agents/ directly. On v2.1.197 and earlier, opens an interactive interface for creating and managing subagent configurations /artifact-capabilities Skill .
Load the reference for the runtime capabilities a published artifact can use, such as calling your connectors or offering a file download , including which ones your account has. Claude normally loads it on its own before building a page that uses one. Available where artifacts are /artifact-diagramming Skill . Load diagramming guidance for Claude to follow in artifacts : when a diagram helps, what to draw, and how to write inline SVG that stays legible in light and dark themes.
Requires Claude Code v2.1.221 or later /artifacts List the artifacts you own or that are shared with you, then attach one to the session, open it in your browser, or copy its link. Available where artifacts are /auto-mode-setup Draft autoMode.environment entries from your project and recent sessions, then review the draft and save it to your user settings. On a Pro, Max, Ultra, or Team plan, requires Claude Code v2.1.228 or later, or v2.1.233 or later on native Windows.
On an Enterprise plan or with a Claude Console API key, requires v2.1.283 or later. If the command is missing, see /auto-mode-setup returns “Unknown command” /autocompact [auto|<tokens>] Set the auto-compact window: how full the context window gets before Claude Code compacts automatically. Pass a size such as 500k , or auto to return to the window tuned for your model. Claude Code saves the value to user settings and applies it to the current session.
See Set the auto-compact window for accepted values and what overrides it. Without an argument, opens a dialog that shows the current window. Requires Claude Code v2.1.221 or later /autofix-pr [prompt] Spawn a cloud session that watches the current branch’s PR and pushes fixes when CI fails or reviewers leave comments. Detects the open PR from your checked-out branch with gh pr view ; to watch a different PR, check out its branch first.
By default the cloud session is told to fix every CI failure and review comment; pass a prompt to give it different instructions, for example /autofix-pr only fix lint and type errors . Requires the gh CLI and access to cloud sessions /background [prompt] Detach the current session to run as a background agent and free this terminal. Pass a prompt to send one more instruction before detaching. Monitor the session with claude agents .
To copy the conversation into a new background session while this one keeps running, use /fork . Alias: /bg
The rest of this page is on the live site.