ES · Leer en español Explore for free

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.

Cover: Claude Code commands cheat sheet: slash, shortcuts and flags

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

CommandWhat it doesWhen 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 itWhen context is filling up but you're still on the same task
/contextShows what's filling the context window as a grid, with suggestionsBefore choosing between /clear and /compact, or when Claude slows down
/resume [session]Picks up a conversation by ID or name, or opens the pickerTo 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 branchTo try another approach without losing where you are
/rewindRolls 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 conversationFor a quick question that shouldn't clutter context
/copy [N]Copies the last response (or the Nth-latest) to the clipboardTo paste a code block or answer somewhere else
/export [file]Exports the conversation as plain textTo save or share a session
/recapGenerates a one-line summary of the sessionWhen you come back from a break
/exitQuits 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

CommandWhat it doesWhen to use it
/model [model]Switches model and saves it as your default; in the picker, s switches for this session onlyTo 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 itMore effort for hard problems, less for mechanical work
/fast [on|off]Turns fast mode on or offWhen speed matters more than cost
/usageShows session cost, plan limits and activity stats (aliases /cost and /stats)To see how much room you have before the limit
/rate-limit-optionsShows your options when a usage limit blocks a requestWhen 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

CommandWhat it doesWhen to use it
/permissionsOpens 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 taskBefore a big change: agree on the approach before any code is touched
/sandboxToggles sandbox mode (supported platforms only)To isolate Bash commands from the rest of your system
/fewer-permission-promptsBundled skill: scans your transcripts and proposes an allowlist for .claude/settings.jsonWhen approving read-only commands keeps slowing you down
/add-dir <path>Adds another working directory to the sessionWhen 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

CommandWhat it doesWhen to use it
/initCreates a starter CLAUDE.md for the projectThe first time you open Claude Code in a repo
/memoryEdits your CLAUDE.md files, toggles auto memory and shows its entriesWhen Claude keeps making a mistake one line in CLAUDE.md would prevent
/diffReviews working tree changes, including Claude's editsBefore 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-reviewChecks your branch's changes against origin's default branch for vulnerabilitiesBefore pushing code that touches auth, input handling or data
/cd <path>Moves the session to another directory, keeping the conversationTo 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

CommandWhat it doesWhen to use it
/skillsLists available skills; t sorts by token countTo see what's installed and what it weighs
/reload-skillsRescans skill and command folders without a restartAfter creating or editing a skill mid-session
/skill-doctorShows each skill's context cost and how often it's usedTo 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-pluginsReloads active plugins to apply changes without a restartAfter installing or editing a plugin
/mcpManages MCP server connections and auth; reconnect all retries the failed onesWhen an MCP server stops responding or asks you to log in
/hooksShows your hook configurationTo check what runs on each event
/agentsIn 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
/statuslineSets up the status line, from a description or from your shell promptTo keep model, context and limits always in view
/output-style [style]Lists output styles or switches to oneFor 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

CommandWhat it doesWhen to use it
/doctorBundled 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 youFor a specific failure you can reproduce
/statusShows version, model, account and connectivityTo confirm which account and model you're on
/configOpens settings (theme, model, output style…); also takes key=valueTo change a preference without editing JSON
/tasksShows and manages the session's background work (alias /bashes)To check on or stop a background command or subagent
/release-notesOpens the changelog by versionAfter an update, to see what changed
/bug [report]Reports a bug or shares the conversation, behind a consent screenTo tell Anthropic something's wrong
/helpShows help and the available commandsWhen 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

ShortcutWhat it doesWhen to use it
EscInterrupts Claude or closes a dialog, keeping the work so farWhen it's heading the wrong way and you want to redirect it
Esc EscWith text, clears the draft; on an empty prompt, opens the rewind menuTo undo without typing /rewind
Shift+TabCycles permission modes: Manual, acceptEdits, plan and, when available, bypassPermissions and autoTo jump into plan mode or accept edits in a second
Ctrl+CInterrupts; with nothing running, clears the prompt and a second press quitsTo stop or exit
Ctrl+RSearches back through your prompt historyTo rerun a long prompt
Ctrl+OOpens the transcript viewer with full tool detailsTo see exactly what it ran
Ctrl+BSends 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+TShows or hides Claude's task checklistTo follow progress on a long task
Ctrl+GOpens the prompt in your text editorTo write a long prompt comfortably
Ctrl+VPastes an image from the clipboard (Alt+V on Windows and WSL)To show it a screenshot of an error
Ctrl+J or \ + EnterNew line without sending, in any terminalFor multi-line prompts
Alt+PSwitches model without clearing your prompt (Option+P on macOS)Halfway through typing
Alt+TToggles extended thinking (Option+T on macOS); no effect on the 5.5 or Fable models, which always use itWith older models
! at the startShell mode: runs the command and adds its output to the sessionSo Claude sees your git status or test output
@Autocompletes file paths to mention themTo point at the exact file
? on an empty promptShows or hides the shortcuts panelTo 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

FlagWhat it doesWhen to use it
-p, --printAnswers and exits, no interactive modeIn scripts, cron jobs and pipes
-c, --continueLoads the most recent conversation in this directoryTo pick up where you left off
-r, --resume [session]Resumes a session by ID or name, or opens the pickerTo go back to a specific session
-n, --name <name>Names the sessionSo 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 onlyFor 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 worktreeFor parallel tasks that don't step on each other
--add-dir <paths>Grants access to extra directoriesWhen the task spans two repos
--allowedTools <tools>Tools that run without asking for permissionWith -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 promptFor 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-modeStarts with every customization turned offTo 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

CommandWhat happenedUse this instead
/vimRemoved in 2.1.92/config → Editor mode
/pr-commentsRemoved in 2.1.91Ask Claude to read the PR comments
/ultraplanRemovedPlan mode (/plan or Shift+Tab)
--enable-auto-modeRemoved 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.

The whole library