Claude Code Commands Cheat Sheet: Every Slash Command, Shortcut and CLI Flag
Type / in Claude Code and the menu scrolls past a hundred entries. Most people learn six of them, never look at the rest, and wonder why their sessions feel slow and expensive. The commands are not hard. The list is just long, badly sorted for a newcomer, and changing every few weeks.
This is the cheat sheet I wanted when I started: slash commands grouped by what you are trying to do, the keyboard shortcuts that matter on macOS and Windows, the CLI commands and flags you run from your shell, how custom commands work now, and the commands that were removed so you stop looking for them. I checked it against the official commands, interactive mode and CLI reference pages on October 24, 2026. Claude Code ships updates constantly, so treat the docs as the source of truth if a command here has drifted.
Claude Code Commands at a Glance
Claude Code commands fall into three layers. Slash commands are typed at the start of a message inside a session, such as /clear or /compact. Keyboard shortcuts and prefixes are typed in the prompt, such as Shift+Tab, ! for a shell command, and @ for a file. CLI commands and flags are typed in your terminal before or while launching, such as claude -c or claude --model.
| Layer | Where you type it | Example | What it controls |
|---|---|---|---|
| Slash commands | Start of a message in a session | /compact | The session: context, model, plans, reviews |
| Shortcuts and prefixes | The prompt | Shift+Tab, !, @ | How you interact: modes, shell, files |
| CLI commands and flags | Your shell | claude -c, --permission-mode plan | How a session starts and runs |
Two details save confusion. A slash command is only recognized at the very start of your message, and anything after the name becomes its arguments. And some entries in the menu are not built in at all: /batch, /loop, /simplify, /code-review and others are bundled skills. They behave like commands, but they are prompts Claude follows, which is why they can do multi-step work.
The Ten Claude Code Commands to Learn First
If you only learn ten things, learn these. They cover most of what separates a smooth session from a messy one.
| Command | What it does | When to reach for it |
|---|---|---|
/init | Generates a starter CLAUDE.md for the project | First session in any repo |
/clear | Starts a new conversation with empty context | Switching to an unrelated task |
/compact | Summarizes the conversation to free context | Mid-task, when history gets long |
/context | Shows what is filling the context window | Before you decide to compact |
/model | Switches the model | A task needs more or less power |
/plan | Enters plan mode | Anything touching more than a file or two |
/rewind | Rolls code and conversation back to a checkpoint | Claude went down the wrong path |
/resume | Reopens an earlier conversation | Coming back the next day |
/permissions | Manages allow, ask and deny rules | Tired of approving the same command |
/usage | Shows session cost, plan limits and activity | Watching your limits |
Two shortcuts belong on that list: Shift+Tab cycles permission modes, and pressing Esc twice rewinds. Both are covered below. If you want the guided version of this list, with an install and a first session, start with my Claude Code tutorial and come back here for the full reference.
Claude Code Slash Commands by Task
The official page lists them alphabetically. That is fine for lookup and bad for learning, so these are grouped by the moment you need them. Aliases are noted because the same command often has two or three names.
Start a project and set the rules
| Command | What it does |
|---|---|
/init | Generates a starter CLAUDE.md. Set CLAUDE_CODE_NEW_INIT=1 for an interactive flow that also covers skills, hooks and personal memory files |
/memory | Edits CLAUDE.md files, turns auto memory on or off and shows its entries |
/permissions | Opens a dialog to view, add and remove allow, ask and deny rules. Alias: /allowed-tools |
/mcp | Manages MCP server connections and OAuth. /mcp reconnect all retries every server that failed or needs auth |
/add-dir <path> | Adds a working directory for file access during the session. Most .claude/ configuration in that directory is not picked up |
/config | Opens settings for theme, model, output style and more. It also accepts key=value pairs |
/import | Brings config from Codex, Gemini CLI or Cursor into Claude Code, including instruction files, MCP servers and skills |
The order the docs suggest for a first session is /init, then /memory to refine the file, then /mcp for any servers, then /permissions. The CLAUDE.md part is the one that pays off most, and I walk through what belongs in it in the tutorial. For MCP specifically, see the MCP server developer guide.
Control context and cost
Context is the budget you spend every turn, so this group matters more than it looks. I wrote about the bigger picture in context engineering for AI coding. The commands themselves are simple.
| Command | What it does |
|---|---|
/clear [name] | Starts a new conversation with empty context. Pass a name to label the old one in the /resume picker. Aliases: /reset, /new |
/compact [instructions] | Summarizes the conversation so far. Add focus instructions to steer what the summary keeps |
/context [all] | Draws your context usage as a colored grid and flags memory bloat and context-heavy tools |
/usage | Shows session cost, plan limits and activity stats. Aliases: /cost, /stats |
/btw [question] | Asks a side question without adding it to the conversation |
/rewind | Rolls back the conversation, the code, or both to an earlier point. Aliases: /checkpoint, /undo |
/recap | Generates a one-line summary of the session on demand |
/autocompact | Sets how full the context window gets before compaction runs automatically |
/export [filename] | Exports the conversation as plain text |
/copy [N] | Copies the last assistant response, or the Nth-latest with a number |
/clear versus /compact is the decision people get wrong. /clear throws the conversation away and keeps project memory, so use it when the next task is unrelated. /compact keeps a summary and continues the same task. Running /context first tells you whether compaction is even worth it. /btw is the quiet winner of this group: you get an answer without paying for it in the main thread's history.
Switch the model and effort
| Command | What it does |
|---|---|
/model [model] | Switches the model and saves it as your default for new sessions. With no argument it opens a picker, and pressing s on a row switches for the current session only |
/effort [level] | Sets reasoning effort from low to xhigh, max, or auto. status prints the current level. max lasts only for the session |
/fast [on or off] | Toggles fast mode |
/advisor [model or off] | Turns on an advisor tool that consults a second model at key moments |
If you are weighing models by price and capability, my cache pricing review of Fable 5.1 covers what switching mid-session costs. There is a catch the docs call out: changing model or effort mid-conversation can invalidate your prompt cache, and Claude Code warns you before it does.
Plan, review and ship
| Command | What it does |
|---|---|
/plan [description] | Enters plan mode from the prompt. Add a description to start straight away, such as /plan fix the auth bug |
/diff | Shows the changes in your working tree, including Claude's edits so far |
/code-review [level] [target] | Reviews the current diff for correctness bugs. Takes a level from low to max, plus --fix, --comment and a PR number, branch or path. Alias: /review |
/security-review | Checks the diff between your branch and the default branch for vulnerabilities such as injection, auth issues and data exposure |
/simplify [target] | Reviews changed code for cleanup and applies the fixes |
/batch <instruction> | Splits a large change into independent units and runs them in parallel, each in its own worktree |
/ultrareview [PR or branch] | Runs a deep multi-agent review in a cloud sandbox |
/autofix-pr [prompt] | Starts a cloud session that watches your PR and pushes fixes when CI fails or reviewers comment |
/verify | Builds and runs your app to confirm a change works, instead of trusting tests alone |
Plan mode is the habit I would push hardest. Having Claude write the approach before it edits anything catches a wrong turn while it is still cheap, and /plan gets you there without remembering the keyboard cycle. For multi-file work in parallel, /batch leans on git worktrees, and the review commands pair with the problems in the AI code review bottleneck.
Run work in parallel and in the background
| Command | What it does |
|---|---|
/tasks | Lists background work in the session, including finished subagents. Alias: /bashes |
/background [prompt] | Detaches the whole session as a background agent and frees your terminal |
/fork [prompt] | Copies the conversation into a new background session and keeps you working here |
/subtask <task> | Spawns a forked subagent that inherits the conversation and works while you continue |
/agents | Prints a reminder to ask Claude to create or manage subagents. On v2.1.197 and earlier it opened an interactive screen |
/goal [condition] | Keeps Claude working across turns until a condition is met. /goal clear removes it |
/loop [interval] [prompt] | Repeats a prompt while the session stays open, for example /loop 5m check if the deploy finished |
/schedule [description] | Creates, lists or runs cloud scheduled tasks |
The /agents row is a good example of why a cheat sheet goes stale. If an older tutorial tells you /agents opens a manager, check your version. Subagents are covered properly in the subagents guide, and the broader idea of delegating work to run unattended is in background AI coding agents.
Move between sessions and devices
| Command | What it does |
|---|---|
/resume [session] | Resumes a conversation by ID or name, or opens the picker. Alias: /continue |
/branch [name] | Branches the conversation here so you can try another direction and keep the original |
/rename [name] | Names the current session. With no name it generates one from the conversation |
/teleport | Pulls a cloud session into this terminal. Alias: /tp |
/remote-control | Makes this session controllable from claude.ai or the Claude app |
/desktop | Continues the session in the Claude Code desktop app on macOS or x64 Windows. Alias: /app |
/exit | Exits the CLI. Alias: /quit |
Set up, diagnose and customize
| Command | What it does |
|---|---|
/doctor | Runs a setup checkup for installation, settings, extensions and CLAUDE.md problems |
/debug [description] | Turns on debug logging and troubleshoots from the session log |
/status | Opens the Status tab: version, model, account and connectivity |
/statusline | Configures the status line. See my status line guide |
/hooks | Shows your hook configuration. Hooks themselves are in the hooks guide |
/skills | Lists available skills, with filtering and sorting by token cost |
/skill-doctor | Shows what each skill costs in context and how often it is used |
/plugin [subcommand] | Manages plugins. See the plugin marketplace guide |
/reload-plugins and /reload-skills | Apply plugin or skill changes without restarting |
/theme, /color, /tui | Change the color theme, prompt bar color and terminal renderer |
/terminal-setup | Installs a Shift+Enter newline binding in VS Code, Cursor, Alacritty, Zed and others |
/keybindings | Opens your keyboard shortcuts file |
/sandbox | Toggles sandbox mode on supported platforms |
/login, /logout | Sign in to or out of your Anthropic account |
/help, /release-notes | Show help, or browse the changelog by version |
/feedback, /bug | Report a bug or send feedback, with a consent step before anything is sent |
Claude Code commands that were removed or changed
Old blog posts still list these. They no longer work the way they describe.
| Command | Status |
|---|---|
/vim | Removed in v2.1.92. Use /config and set Editor mode to switch between Vim and Normal editing |
/pr-comments | Removed in v2.1.91. Ask Claude directly to view the pull request comments |
/ultraplan | Removed. Use plan mode instead |
/cost and /stats | Still work, but they are aliases for /usage now |
/agents | Prints a reminder on v2.1.198 and later instead of opening a manager |
--enable-auto-mode (flag) | Removed in v2.1.111. Auto mode is in the Shift+Tab cycle by default |
Some commands are also hidden from the menu until you type the full name, such as /setup-bedrock and /setup-vertex. That is the closest thing to a secret command. Run /help or type / and keep typing to filter, and you will see everything your plan and platform allow.
Claude Code Keyboard Shortcuts
Shortcuts are where Claude Code feels fast. The ones worth learning first are Shift+Tab, Esc, Ctrl+O and the ! prefix. A note first: on macOS, any shortcut that uses Option as Alt (Alt+B, Alt+F, Alt+D, Alt+Y, Alt+P) needs your terminal set to treat Option as Meta. Without that setting they do nothing, and it is the most common reason a shortcut seems broken.
Core controls
| Shortcut | What it does |
|---|---|
Esc | Interrupts Claude mid-turn. The work done so far is kept, so you can redirect |
Esc then Esc | With text in the prompt, clears it and saves the draft to history. With an empty prompt, opens the rewind menu |
Shift+Tab | Cycles permission modes: default, acceptEdits, plan, then bypassPermissions and auto when available |
Ctrl+C | Interrupts a running operation. With nothing running, the first press clears the prompt and a second exits |
Ctrl+D | Exits the session. Press twice within 800ms |
Ctrl+O | Toggles the transcript viewer with detailed tool usage and timestamps |
Ctrl+R | Reverse-searches your command history |
Ctrl+G or Ctrl+X Ctrl+E | Opens your prompt in your default text editor |
Ctrl+B | Backgrounds running Bash commands and agents. Tmux users press it twice |
Ctrl+T | Shows or hides Claude's task checklist |
Ctrl+S | Stashes the prompt, or restores it when pressed again on an empty prompt |
Ctrl+L | Redraws a garbled screen without losing your conversation |
Ctrl+Z | Suspends Claude Code to your shell on Unix. Run fg to resume |
Ctrl+X Ctrl+K | Stops all background subagents. Press twice within 3 seconds |
Model and mode toggles
| macOS | Windows and Linux | What it does |
|---|---|---|
Option+P | Alt+P | Switches model without clearing your prompt |
Option+T | Alt+T | Toggles extended thinking. The docs say it has no effect on Opus 5.5, Sonnet 5.5, Haiku 5.5 or the Fable models, which always use it |
Option+O | Alt+O | Toggles fast mode |
Prefixes and multiline input
| Input | What it does |
|---|---|
/ at the start | Runs a command or skill |
! at the start | Shell mode: runs the command directly and adds its output to the session |
@ | Triggers file path autocomplete |
? on an empty prompt | Shows the shortcut help panel |
\ then Enter | Newline that works in every terminal |
Shift+Enter | Newline. Native in iTerm2, WezTerm, Ghostty, Kitty, Warp, Apple Terminal and Windows Terminal |
Ctrl+J | Newline that works in any terminal with no setup |
Ctrl+V (Cmd+V in iTerm2, Alt+V on Windows and WSL) | Pastes an image from the clipboard |
The ! prefix is underrated. Typing ! npm test runs it right away, puts the output in the conversation, and lets Claude respond to the result, with no approval step and no model tokens spent deciding to run it. It supports Ctrl+B backgrounding too.
Editing the prompt
| Shortcut | What it does |
|---|---|
Ctrl+A and Ctrl+E | Jump to the start or end of the line |
Ctrl+K | Deletes to the end of the line |
Ctrl+U | Deletes to the start of the line. Repeat to clear across lines |
Ctrl+W | Deletes back to the previous whitespace, so one press removes a whole path or --flag=value |
Ctrl+Y | Pastes the text you last deleted. Alt+Y cycles earlier deletions |
Alt+B and Alt+F | Move back or forward one word |
Ctrl+_ | Undoes the last input edit |
On Windows, if Shift+Tab does not cycle modes because your Node or Bun runtime does not enable VT input mode, use Alt+M. Customizing any of these goes through /keybindings.
Claude Code CLI Commands and Flags
These run in your shell, outside the session. The docs list around 85 flags, and you will use about fifteen. Here are the commands first.
| Command | What it does |
|---|---|
claude | Starts an interactive session |
claude "query" | Starts a session with an initial prompt |
claude -p "query" | Runs the query non-interactively, prints the result and exits |
cat file | claude -p "query" | Processes piped content |
claude -c | Continues the most recent conversation in this directory |
claude -r "name" "query" | Resumes a session by ID or name |
claude update | Updates to the latest version |
claude install [version] | Installs or reinstalls the native binary, such as claude install stable |
claude auth login, logout, status | Sign in, sign out, or print auth status as JSON |
claude mcp | Configures MCP servers |
claude plugin | Manages plugins |
claude agents | Opens agent view to monitor and dispatch parallel background sessions |
claude attach, logs, stop, respawn, rm | Manage background sessions from the shell |
claude doctor | Prints read-only install and settings diagnostics without starting a session |
claude setup-token | Generates a long-lived OAuth token for CI and scripts |
claude ultrareview [target] | Runs ultrareview non-interactively |
The flags that earn their place:
| Flag | What it does |
|---|---|
--continue, -c and --resume, -r | Pick a conversation back up. Add --fork-session to resume into a new session ID |
--name, -n | Names the session so it is easy to find in /resume |
--model | Sets the model for the session |
--effort | Sets the effort level for the session |
--permission-mode | Starts in a mode: default, acceptEdits, plan, auto, dontAsk or bypassPermissions |
--allowedTools | Tools that run without prompting, such as "Bash(git log *)" "Read" |
--tools | Restricts which built-in tools Claude can use at all |
--add-dir | Adds extra working directories |
--worktree, -w | Starts in an isolated git worktree under .claude/worktrees |
--print, -p | Non-interactive mode for scripts and pipes |
--output-format | Print mode output: text, json or stream-json |
--max-turns and --max-budget-usd | Cap agentic turns or spend in print mode |
--json-schema | Returns validated JSON matching a schema in print mode |
--append-system-prompt | Adds text to the default system prompt |
--bg | Starts the session as a background agent and returns immediately |
--from-pr | Opens the picker filtered to sessions linked to a pull request |
--bare | Minimal mode: skips auto-discovery of hooks, skills, plugins, MCP servers and memory |
--safe-mode | Starts with all customizations disabled, for troubleshooting a broken config |
--debug and --verbose | Debug logging, or full turn-by-turn output |
--version, -v | Prints the version |
A few invocations I would actually save:
claude -c
claude -r "auth-refactor" "finish this PR"
claude -w feature-auth
claude --permission-mode plan
git diff main | claude -p "review this diff for bugs"
claude -p "list every TODO" --output-format json --max-turns 5If you script with -p, the Agent SDK guide is the next step. For worktree-based parallel work, see the worktree guide.
Custom Claude Code Commands Are Skills Now
You can still write your own commands, but the mechanism changed. The docs say custom commands have been merged into skills: a file at .claude/commands/deploy.md and a skill at .claude/skills/deploy/SKILL.md both create /deploy and work the same way. Existing command files keep working. Skills add a folder for supporting files, frontmatter that controls whether you or Claude can invoke them, and automatic loading when relevant. If a command file and a skill share a name, the skill wins.
A minimal custom command is a markdown file:
---
description: Review a file for bugs and missing tests
---
Review $ARGUMENTS for correctness bugs and missing tests.
List findings by severity, most serious first.Save it as .claude/commands/review-file.md and run /review-file src/auth.ts. $ARGUMENTS expands to everything after the command name. You can also address arguments by position with $0, $1 and so on, counting from zero, and wrap multi-word values in quotes. Put files in .claude/ to share them with a project, or ~/.claude/ to keep them personal.
For anything you will reuse or share, write a skill instead. I cover the full format in the skill developer guide, and the plugin marketplace guide shows how to package and install them.
How to Allow Commands Without Approval Prompts
People search for "claude code allow all commands" because the prompts get old. There are four sane answers, from narrowest to widest.
- Allow specific commands. Run
/permissionsand add allow rules for the commands you trust, such asBash(git diff *). This is the right default. The rules persist. - Switch the mode. Press
Shift+Tabto move toacceptEditsso file edits stop prompting, or toauto, which uses a classifier to approve routine actions. On a file permission prompt,Shift+Tabalso picks the option that allows the action for the rest of the session, when the prompt offers it. - Allow per run. Start with
--allowedTools "Bash(git log *)" "Read"for a scripted session that should never prompt for those. - Skip all checks.
--dangerously-skip-permissionsis equivalent to--permission-mode bypassPermissions. Only use it in a throwaway container or sandbox, never on a machine with credentials you care about.
Blanket allow-all is the option I would avoid, and the reason is practical: one bad command in an unattended session is hard to undo. The least-privilege guide for coding agents goes through how to scope permissions without drowning in prompts, and a PreToolUse hook can block the dangerous commands while allowing the rest.
Build the Habit, Not the Memory
You do not need to memorize any of this. A short daily loop covers most of it:
- Start with
claude -cto pick up yesterday's work, orclaudefor something new. - Press
Shift+Tabtoplanbefore any change that touches more than a couple of files. - Run
/contextwhen a session feels sluggish, then/compactwith focus instructions, or/clearif the task changed. - Use
!for quick shell checks instead of asking Claude to run them. - Press
Esctwice when a direction is wrong, instead of arguing with it.
The same pattern applies to the less common commands. Learn them when a problem shows up. /rewind makes sense the first time a refactor goes sideways, and /btw makes sense the first time you want a quick answer without polluting a long thread. For a full worked example of how far this loop can go, see the 32,784-line workflow post.
Frequently Asked
What are some useful commands in Claude Code? Start with /init, /clear, /compact, /context, /model, /plan, /rewind, /resume, /permissions and /usage. Add the ! shell prefix, @ file mentions, Shift+Tab and double Esc.
Are there secret commands in Claude Code? Not really. A few are hidden from the menu until you type their full name, such as /setup-bedrock and /setup-vertex, and several useful ones are just overlooked, like /btw, /recap and /powerup. /help and /skills list what is available to you.
How do I run a command in Claude Code? Type / at the very start of a message, then the command name and any arguments. To run a shell command instead, start the message with !. A slash command is only recognized at the start of the message.
How do I allow commands in Claude Code? Use /permissions to add allow rules, press Shift+Tab to change the permission mode, or pass --allowedTools when you launch. Avoid --dangerously-skip-permissions outside a sandbox.
What are the Claude Code keyboard shortcuts on Windows? Most match macOS with Alt in place of Option: Alt+P switches model, Alt+T toggles extended thinking and Alt+O toggles fast mode. Use Alt+V to paste an image, and Alt+M for the mode cycle if Shift+Tab does not work in your runtime.
What does Ctrl+O do in Claude Code? It toggles the transcript viewer, which shows detailed tool usage and timestamps, and expands lines that collapse by default. Ctrl+G is a different shortcut: it opens your prompt in your default text editor.
What is the difference between a command and a skill? Custom commands have been merged into skills. A markdown file in .claude/commands/ and a skill in .claude/skills/ both create the same /name command. Skills add supporting files, invocation controls and automatic loading, and the docs recommend them for new work.
Where do I see every command? Type / and keep typing to filter, run /help, or run /skills for the skills list. The full reference is the official commands page.
Sources: Claude Code commands, Interactive mode, CLI reference and Skills, checked October 24, 2026.