Reference · Basic · 8 min
Claude Code commands cheat sheet: slash, shortcuts and flags
An up-to-date Claude Code cheat sheet: slash commands, keyboard shortcuts and CLI flags grouped by task, with what each does and when to reach for it.
Tested with Claude Code 2.1.316 · reviewed
Summary
Claude Code ships with over a hundred / commands, dozens of keyboard shortcuts and just as many terminal options. This cheat sheet keeps only the ones you'll actually use day to day, grouped by job: session and context, model and cost, permissions and modes, project and memory, extensions, troubleshooting, keyboard shortcuts and command-line flags. Each row tells you what it does in one line and when it pays off.
Everything here was checked against the official docs and claude --help on Claude Code 2.1.316. Type / in a session to see the full list for your version (your own skills included), and press ? on an empty prompt to see the shortcuts.
Session and context
| Command | What it does | When to use it |
|---|---|---|
/clear [name] | Starts a fresh conversation with empty context (aliases /reset and /new) | When you switch tasks; the name labels the old one in /resume |
/compact [instructions] | Summarizes the conversation to free up context without leaving it | When context is filling up but you're still on the same task |
/context | Shows what's filling the context window as a grid, with suggestions | Before choosing between /clear and /compact, or when Claude slows down |
/resume [session] | Picks up a conversation by ID or name, or opens the picker | To get back to yesterday's task |
/rename [name] | Names the current session (or generates a name for you) | So you can find it later with /resume or claude -r |
/branch [name] | Branches the conversation at this point and switches you into the branch | To try another approach without losing where you are |
/rewind | Rolls the conversation and/or code back to an earlier point (aliases /checkpoint, /undo) | When Claude went down the wrong path and you want its edits gone |
/btw [question] | Asks a side question without adding it to the conversation | For a quick question that shouldn't clutter context |
/copy [N] | Copies the last response (or the Nth-latest) to the clipboard | To paste a code block or answer somewhere else |
/export [file] | Exports the conversation as plain text | To save or share a session |
/recap | Generates a one-line summary of the session | When you come back from a break |
/exit | Quits Claude Code (alias /quit) | When you're done |
/context
/compact keep only the API decision and the files we touched
/clear login-fix
/resume login-fix
Clearing versus compacting, plus idle compaction, is covered in /clear vs /compact.
Model and cost
| Command | What it does | When to use it |
|---|---|---|
/model [model] | Switches model and saves it as your default; in the picker, s switches for this session only | To move up to a stronger model or down to a cheaper one |
/effort [level] | Sets the effort level: low through xhigh, max or auto; status prints it | More effort for hard problems, less for mechanical work |
/fast [on|off] | Turns fast mode on or off | When speed matters more than cost |
/usage | Shows session cost, plan limits and activity stats (aliases /cost and /stats) | To see how much room you have before the limit |
/rate-limit-options | Shows your options when a usage limit blocks a request | When you hit your plan's limit |
/model sonnet
/effort high
/usage
Which model fits which task is in Opus vs Sonnet vs Haiku, fast mode in Opus 4.8 and fast mode, and making your quota last in Usage limits.
Permissions and modes
| Command | What it does | When to use it |
|---|---|---|
/permissions | Opens allow, ask and deny rules by scope, plus recent auto mode denials (alias /allowed-tools) | To stop approving the same command over and over |
/plan [description] | Enters plan mode from the prompt, optionally with the task | Before a big change: agree on the approach before any code is touched |
/sandbox | Toggles sandbox mode (supported platforms only) | To isolate Bash commands from the rest of your system |
/fewer-permission-prompts | Bundled skill: scans your transcripts and proposes an allowlist for .claude/settings.json | When approving read-only commands keeps slowing you down |
/add-dir <path> | Adds another working directory to the session | When the task reaches into a sibling repo |
/plan move login to OAuth without touching the database
/permissions
Rules in depth: Claude Code permissions. Plan mode: Plan mode. The classifier: Auto mode.
Project, memory and review
| Command | What it does | When to use it |
|---|---|---|
/init | Creates a starter CLAUDE.md for the project | The first time you open Claude Code in a repo |
/memory | Edits your CLAUDE.md files, toggles auto memory and shows its entries | When Claude keeps making a mistake one line in CLAUDE.md would prevent |
/diff | Reviews working tree changes, including Claude's edits | Before you commit |
/code-review [level] [target] | Bundled skill: reviews the current diff, a PR, a branch or a path for bugs (alias /review) | Before merging; --fix applies what it finds |
/security-review | Checks your branch's changes against origin's default branch for vulnerabilities | Before pushing code that touches auth, input handling or data |
/cd <path> | Moves the session to another directory, keeping the conversation | To carry on the same task somewhere else |
/init
/diff
/code-review
/security-review
How to trim the CLAUDE.md that /init writes is in A CLAUDE.md that works; what to check by hand is in the review checklist.
Extensions: skills, plugins, MCP and hooks
| Command | What it does | When to use it |
|---|---|---|
/skills | Lists available skills; t sorts by token count | To see what's installed and what it weighs |
/reload-skills | Rescans skill and command folders without a restart | After creating or editing a skill mid-session |
/skill-doctor | Shows each skill's context cost and how often it's used | To decide which ones to turn off |
/plugin [subcommand] | Opens the plugin manager or acts directly (list, install, enable, disable) | To install or switch off a plugin |
/reload-plugins | Reloads active plugins to apply changes without a restart | After installing or editing a plugin |
/mcp | Manages MCP server connections and auth; reconnect all retries the failed ones | When an MCP server stops responding or asks you to log in |
/hooks | Shows your hook configuration | To check what runs on each event |
/agents | In 2.1.316 it just reminds you to ask Claude to create the subagent or edit .claude/agents/ | So you don't go looking for the old menu, gone since after 2.1.197 |
/statusline | Sets up the status line, from a description or from your shell prompt | To keep model, context and limits always in view |
/output-style [style] | Lists output styles or switches to one | For terser or more explanatory answers |
From the terminal, without opening a session:
# Add a remote MCP server and list the configured ones
claude mcp add --transport http sentry https://mcp.sentry.dev/mcp
claude mcp list
# Install a plugin, then see what it ships and its context cost
claude plugin install <plugin>
claude plugin details <plugin>
Each piece has its own recipe: your first skill, building a plugin, MCP for developers, safety hooks, subagents and the status line. Not sure which one you need? See which piece to use.
Troubleshooting
| Command | What it does | When to use it |
|---|---|---|
/doctor | Bundled skill: checks install, settings, extensions and CLAUDE.md, and proposes fixes it applies once you confirm (alias /checkup) | When something's broken and you don't know why |
/debug [description] | Bundled skill: turns on debug logging and reads the log for you | For a specific failure you can reproduce |
/status | Shows version, model, account and connectivity | To confirm which account and model you're on |
/config | Opens settings (theme, model, output style…); also takes key=value | To change a preference without editing JSON |
/tasks | Shows and manages the session's background work (alias /bashes) | To check on or stop a background command or subagent |
/release-notes | Opens the changelog by version | After an update, to see what changed |
/bug [report] | Reports a bug or shares the conversation, behind a consent screen | To tell Anthropic something's wrong |
/help | Shows help and the available commands | When you can't remember a command |
# From the terminal, without opening a session
claude --version
claude doctor
claude auth status --text
claude update
The most common errors (529, 401, 403, limits) and their fixes are in Common Claude Code errors.
Keyboard shortcuts
| Shortcut | What it does | When to use it |
|---|---|---|
Esc | Interrupts Claude or closes a dialog, keeping the work so far | When it's heading the wrong way and you want to redirect it |
Esc Esc | With text, clears the draft; on an empty prompt, opens the rewind menu | To undo without typing /rewind |
Shift+Tab | Cycles permission modes: Manual, acceptEdits, plan and, when available, bypassPermissions and auto | To jump into plan mode or accept edits in a second |
Ctrl+C | Interrupts; with nothing running, clears the prompt and a second press quits | To stop or exit |
Ctrl+R | Searches back through your prompt history | To rerun a long prompt |
Ctrl+O | Opens the transcript viewer with full tool details | To see exactly what it ran |
Ctrl+B | Sends running Bash commands and agents to the background (press twice in tmux) | For a dev server or long test run you don't want to wait on |
Ctrl+T | Shows or hides Claude's task checklist | To follow progress on a long task |
Ctrl+G | Opens the prompt in your text editor | To write a long prompt comfortably |
Ctrl+V | Pastes an image from the clipboard (Alt+V on Windows and WSL) | To show it a screenshot of an error |
Ctrl+J or \ + Enter | New line without sending, in any terminal | For multi-line prompts |
Alt+P | Switches model without clearing your prompt (Option+P on macOS) | Halfway through typing |
Alt+T | Toggles extended thinking (Option+T on macOS); no effect on the 5.5 or Fable models, which always use it | With older models |
! at the start | Shell mode: runs the command and adds its output to the session | So Claude sees your git status or test output |
@ | Autocompletes file paths to mention them | To point at the exact file |
? on an empty prompt | Shows or hides the shortcuts panel | To find the rest |
! git status
Look at @src/auth/login.ts and explain why the test fails
On macOS, the Alt shortcuts need Option set as Meta in your terminal. If Shift+Enter doesn't add a new line in your editor, /terminal-setup installs it for VS Code, Cursor, Alacritty or Zed, and /keybindings opens your shortcuts file so you can remap them.
Most-used command-line flags
| Flag | What it does | When to use it |
|---|---|---|
-p, --print | Answers and exits, no interactive mode | In scripts, cron jobs and pipes |
-c, --continue | Loads the most recent conversation in this directory | To pick up where you left off |
-r, --resume [session] | Resumes a session by ID or name, or opens the picker | To go back to a specific session |
-n, --name <name> | Names the session | So you can resume it with claude -r <name> |
--model <model> | Picks the model for this session (sonnet, opus, haiku, fable or a full name) | To start on the right model straight away |
--effort <level> | Sets effort for this session only | For a script that doesn't need deep thinking |
--permission-mode <mode> | Starts in a permission mode (default, acceptEdits, plan, auto, dontAsk, bypassPermissions) | To open straight into plan mode |
-w, --worktree [name] | Opens the session in an isolated git worktree | For parallel tasks that don't step on each other |
--add-dir <paths> | Grants access to extra directories | When the task spans two repos |
--allowedTools <tools> | Tools that run without asking for permission | With -p, so the script doesn't hang waiting |
--output-format <format> | Outputs text, json or stream-json (with -p only) | To feed the answer into another program |
--max-turns <n> | Caps the agent's turns (with -p only) | To keep a script from running away |
--max-budget-usd <amount> | Stops once estimated spend hits the cap (with -p only) | When you pay per use with an API key |
--append-system-prompt <text> | Appends text to the system prompt | For a one-off rule without touching CLAUDE.md |
--debug [filter] | Turns on debug mode, with an optional filter (--debug=hooks,mcp) | When a hook or MCP server misbehaves |
--safe-mode | Starts with every customization turned off | To find out whether your config is the problem |
# One question, then exit
claude -p "explain what this project does"
# Pipe a file in
cat logs.txt | claude -p "explain the error"
# Continue the last conversation in this directory
claude -c
# Resume a session by name with a new prompt
claude -r "auth-refactor" "finish this PR"
# Start in plan mode on a specific model
claude --model opus --permission-mode plan
# A bounded script with JSON output
claude -p "list the TODOs in this repo" --output-format json --max-turns 3
# Parallel work in a worktree
claude -w feature-auth
claude -p in scripts and cron is in Claude Code headless, worktrees in parallel agents, and driving it from your phone (--remote-control or /remote-control) in Remote Control.
Commands that no longer exist
| Command | What happened | Use this instead |
|---|---|---|
/vim | Removed in 2.1.92 | /config → Editor mode |
/pr-comments | Removed in 2.1.91 | Ask Claude to read the PR comments |
/ultraplan | Removed | Plan mode (/plan or Shift+Tab) |
--enable-auto-mode | Removed in 2.1.111 | --permission-mode auto |
What we checked
On Linux with Claude Code 2.1.316 we checked every command, shortcut and flag against the official docs (commands, interactive mode and the CLI reference) and against claude --help, claude mcp --help and claude plugin --help. We only read the help output and didn't run anything that uses up quota. --max-turns is in the docs but doesn't show up in this version's claude --help. If a / command is missing from your menu, it may depend on your plan, platform or version.
Reviewed on 2 Nov 2026 with Claude Code 2.1.316; source: official documentation.
FAQ
How do I see every Claude Code command?
Type / in a session: you get the full list for your version, including your skills and your plugins' skills, and you can filter as you type. /help shows help, and claude --help lists the terminal options.
What's the difference between /clear and /compact?
/clear starts a new conversation with empty context; /compact summarizes the current one to free up space so you can keep going on the same task. We walk through examples in /clear vs /compact.
Can I create my own commands?
Yes: any skill at .claude/skills/<name>/SKILL.md (or a file in .claude/commands/) gives you /name. There are five ready to copy in the command pack and a walkthrough in your first skill.
How do I resume an earlier conversation?
claude -c loads the most recent one in the current directory, and claude -r opens the picker or resumes one by ID or name. Inside a session, /resume does the same.