Claude Code Commands Cheat Sheet: Every Slash Command, Shortcut and CLI Flag

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.

LayerWhere you type itExampleWhat it controls
Slash commandsStart of a message in a session/compactThe session: context, model, plans, reviews
Shortcuts and prefixesThe promptShift+Tab, !, @How you interact: modes, shell, files
CLI commands and flagsYour shellclaude -c, --permission-mode planHow 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.

CommandWhat it doesWhen to reach for it
/initGenerates a starter CLAUDE.md for the projectFirst session in any repo
/clearStarts a new conversation with empty contextSwitching to an unrelated task
/compactSummarizes the conversation to free contextMid-task, when history gets long
/contextShows what is filling the context windowBefore you decide to compact
/modelSwitches the modelA task needs more or less power
/planEnters plan modeAnything touching more than a file or two
/rewindRolls code and conversation back to a checkpointClaude went down the wrong path
/resumeReopens an earlier conversationComing back the next day
/permissionsManages allow, ask and deny rulesTired of approving the same command
/usageShows session cost, plan limits and activityWatching 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

CommandWhat it does
/initGenerates a starter CLAUDE.md. Set CLAUDE_CODE_NEW_INIT=1 for an interactive flow that also covers skills, hooks and personal memory files
/memoryEdits CLAUDE.md files, turns auto memory on or off and shows its entries
/permissionsOpens a dialog to view, add and remove allow, ask and deny rules. Alias: /allowed-tools
/mcpManages 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
/configOpens settings for theme, model, output style and more. It also accepts key=value pairs
/importBrings 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.

CommandWhat 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
/usageShows session cost, plan limits and activity stats. Aliases: /cost, /stats
/btw [question]Asks a side question without adding it to the conversation
/rewindRolls back the conversation, the code, or both to an earlier point. Aliases: /checkpoint, /undo
/recapGenerates a one-line summary of the session on demand
/autocompactSets 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

CommandWhat 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

CommandWhat it does
/plan [description]Enters plan mode from the prompt. Add a description to start straight away, such as /plan fix the auth bug
/diffShows 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-reviewChecks 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
/verifyBuilds 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

CommandWhat it does
/tasksLists 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
/agentsPrints 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

CommandWhat 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
/teleportPulls a cloud session into this terminal. Alias: /tp
/remote-controlMakes this session controllable from claude.ai or the Claude app
/desktopContinues the session in the Claude Code desktop app on macOS or x64 Windows. Alias: /app
/exitExits the CLI. Alias: /quit

Set up, diagnose and customize

CommandWhat it does
/doctorRuns a setup checkup for installation, settings, extensions and CLAUDE.md problems
/debug [description]Turns on debug logging and troubleshoots from the session log
/statusOpens the Status tab: version, model, account and connectivity
/statuslineConfigures the status line. See my status line guide
/hooksShows your hook configuration. Hooks themselves are in the hooks guide
/skillsLists available skills, with filtering and sorting by token cost
/skill-doctorShows 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-skillsApply plugin or skill changes without restarting
/theme, /color, /tuiChange the color theme, prompt bar color and terminal renderer
/terminal-setupInstalls a Shift+Enter newline binding in VS Code, Cursor, Alacritty, Zed and others
/keybindingsOpens your keyboard shortcuts file
/sandboxToggles sandbox mode on supported platforms
/login, /logoutSign in to or out of your Anthropic account
/help, /release-notesShow help, or browse the changelog by version
/feedback, /bugReport 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.

CommandStatus
/vimRemoved in v2.1.92. Use /config and set Editor mode to switch between Vim and Normal editing
/pr-commentsRemoved in v2.1.91. Ask Claude directly to view the pull request comments
/ultraplanRemoved. Use plan mode instead
/cost and /statsStill work, but they are aliases for /usage now
/agentsPrints 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

ShortcutWhat it does
EscInterrupts Claude mid-turn. The work done so far is kept, so you can redirect
Esc then EscWith text in the prompt, clears it and saves the draft to history. With an empty prompt, opens the rewind menu
Shift+TabCycles permission modes: default, acceptEdits, plan, then bypassPermissions and auto when available
Ctrl+CInterrupts a running operation. With nothing running, the first press clears the prompt and a second exits
Ctrl+DExits the session. Press twice within 800ms
Ctrl+OToggles the transcript viewer with detailed tool usage and timestamps
Ctrl+RReverse-searches your command history
Ctrl+G or Ctrl+X Ctrl+EOpens your prompt in your default text editor
Ctrl+BBackgrounds running Bash commands and agents. Tmux users press it twice
Ctrl+TShows or hides Claude's task checklist
Ctrl+SStashes the prompt, or restores it when pressed again on an empty prompt
Ctrl+LRedraws a garbled screen without losing your conversation
Ctrl+ZSuspends Claude Code to your shell on Unix. Run fg to resume
Ctrl+X Ctrl+KStops all background subagents. Press twice within 3 seconds

Model and mode toggles

macOSWindows and LinuxWhat it does
Option+PAlt+PSwitches model without clearing your prompt
Option+TAlt+TToggles 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+OAlt+OToggles fast mode

Prefixes and multiline input

InputWhat it does
/ at the startRuns a command or skill
! at the startShell mode: runs the command directly and adds its output to the session
@Triggers file path autocomplete
? on an empty promptShows the shortcut help panel
\ then EnterNewline that works in every terminal
Shift+EnterNewline. Native in iTerm2, WezTerm, Ghostty, Kitty, Warp, Apple Terminal and Windows Terminal
Ctrl+JNewline 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

ShortcutWhat it does
Ctrl+A and Ctrl+EJump to the start or end of the line
Ctrl+KDeletes to the end of the line
Ctrl+UDeletes to the start of the line. Repeat to clear across lines
Ctrl+WDeletes back to the previous whitespace, so one press removes a whole path or --flag=value
Ctrl+YPastes the text you last deleted. Alt+Y cycles earlier deletions
Alt+B and Alt+FMove 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.

CommandWhat it does
claudeStarts 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 -cContinues the most recent conversation in this directory
claude -r "name" "query"Resumes a session by ID or name
claude updateUpdates to the latest version
claude install [version]Installs or reinstalls the native binary, such as claude install stable
claude auth login, logout, statusSign in, sign out, or print auth status as JSON
claude mcpConfigures MCP servers
claude pluginManages plugins
claude agentsOpens agent view to monitor and dispatch parallel background sessions
claude attach, logs, stop, respawn, rmManage background sessions from the shell
claude doctorPrints read-only install and settings diagnostics without starting a session
claude setup-tokenGenerates a long-lived OAuth token for CI and scripts
claude ultrareview [target]Runs ultrareview non-interactively

The flags that earn their place:

FlagWhat it does
--continue, -c and --resume, -rPick a conversation back up. Add --fork-session to resume into a new session ID
--name, -nNames the session so it is easy to find in /resume
--modelSets the model for the session
--effortSets the effort level for the session
--permission-modeStarts in a mode: default, acceptEdits, plan, auto, dontAsk or bypassPermissions
--allowedToolsTools that run without prompting, such as "Bash(git log *)" "Read"
--toolsRestricts which built-in tools Claude can use at all
--add-dirAdds extra working directories
--worktree, -wStarts in an isolated git worktree under .claude/worktrees
--print, -pNon-interactive mode for scripts and pipes
--output-formatPrint mode output: text, json or stream-json
--max-turns and --max-budget-usdCap agentic turns or spend in print mode
--json-schemaReturns validated JSON matching a schema in print mode
--append-system-promptAdds text to the default system prompt
--bgStarts the session as a background agent and returns immediately
--from-prOpens the picker filtered to sessions linked to a pull request
--bareMinimal mode: skips auto-discovery of hooks, skills, plugins, MCP servers and memory
--safe-modeStarts with all customizations disabled, for troubleshooting a broken config
--debug and --verboseDebug logging, or full turn-by-turn output
--version, -vPrints the version

A few invocations I would actually save:

bash
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 5

If 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:

markdown
---
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.

  1. Allow specific commands. Run /permissions and add allow rules for the commands you trust, such as Bash(git diff *). This is the right default. The rules persist.
  2. Switch the mode. Press Shift+Tab to move to acceptEdits so file edits stop prompting, or to auto, which uses a classifier to approve routine actions. On a file permission prompt, Shift+Tab also picks the option that allows the action for the rest of the session, when the prompt offers it.
  3. Allow per run. Start with --allowedTools "Bash(git log *)" "Read" for a scripted session that should never prompt for those.
  4. Skip all checks. --dangerously-skip-permissions is 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 -c to pick up yesterday's work, or claude for something new.
  • Press Shift+Tab to plan before any change that touches more than a couple of files.
  • Run /context when a session feels sluggish, then /compact with focus instructions, or /clear if the task changed.
  • Use ! for quick shell checks instead of asking Claude to run them.
  • Press Esc twice 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.