CoreCodeBlog

Guides

Claude Code commands: slash commands and keyboard shortcuts cheat sheet

Published · Last checked

This page is a quick reference for the slash commands and keyboard shortcuts you reach for every day in Claude Code, ordered by the flow of a session: setting up a project, working on a task, managing context, then reviewing and troubleshooting. Command names, aliases and behavior come from Anthropic's Commands and Interactive mode docs, checked on October 30, 2026. The tables are a selection; the full list is in those docs.

Key points
  • Type / to list the commands available to you, and keep typing letters to filter. A command is only recognized at the start of your message.
  • The ones you will use most: /init creates a CLAUDE.md, /compact summarizes the conversation, /clear starts a new one, /resume returns to an old one, and /rewind rolls back code and conversation.
  • Shift+Tab cycles permission modes, Esc interrupts Claude, and Esc + Esc on an empty prompt opens the rewind menu.
  • Not every command appears for every user: it depends on your platform, plan and environment. Limits the docs state are kept below.

Starting a project and working on a task

In a repo for the first time, run /init and then refine the result with /memory. Before a large change, /plan switches into plan mode.

CommandWhat it does
/initInitializes the project with a CLAUDE.md guide. Set CLAUDE_CODE_NEW_INIT=1 for an interactive flow that also walks through skills, hooks and personal memory files. See writing a CLAUDE.md
/memoryEdits CLAUDE.md files, turns auto memory on or off, and shows auto memory entries
/plan [description]Enters plan mode from the prompt. Add a description to start on that task right away, for example /plan fix the auth bug
/model [model]Switches the model and saves it as your default for new sessions. With no argument it opens a picker, where s on a row switches for the current session only. See choosing a model
/effort [level|auto|status|ultracode [on|off]]Sets the effort level: low to xhigh, max, or auto; status prints it. max is session-only
/btw [question]Asks a side question without adding to the conversation
/add-dir <path>Adds a working directory for file access during the session. Type a partial path to see suggestions and press Tab to accept one. Most .claude/ configuration isn't discovered from the added directory
/tasksViews and manages background work in the current session, including subagents that have finished. Also available as /bashes

Context and sessions

CommandWhat it does
/context [all]Shows context usage as a colored grid, with suggestions for context-heavy tools and memory bloat. In fullscreen mode the per-item breakdown is collapsed; pass all to expand it
/compact [instructions]Frees up context by summarizing the conversation so far. Optionally pass focus instructions for the summary
/clear [name]Starts a new conversation with empty context. Pass a name to label the previous conversation in the /resume picker. To free context and keep the same conversation, use /compact. Aliases: /reset, /new
/resume [session]Resumes a conversation by ID or name, or opens the session picker. Alias: /continue
/rewindRewinds the conversation and/or code to a previous point, or summarizes from a selected message. Aliases: /checkpoint, /undo
/usageShows session cost, plan usage limits and activity stats. /cost and /stats are aliases. For ways to spend less, see spending fewer tokens

Review, settings and troubleshooting

CommandWhat it does
/diffReviews the changes in your working tree, including the edits Claude has made so far
/code-reviewChecks the current diff for correctness bugs. Pass --fix to have Claude apply the findings, or a PR number to review a pull request, such as /code-review high 1234. /code-review ultra runs a multi-agent review in the cloud. Alias: /review
/security-reviewAnalyzes the changes on your current branch for security vulnerabilities. Needs an origin remote
/permissionsManages allow, ask and deny rules for tool permissions in an interactive dialog: view rules by scope, add or remove them, manage working directories. Alias: /allowed-tools
/config [key=value ...]Opens the Settings interface for theme, model, output style and more. Pass pairs to set a setting directly, such as /config model=sonnet; /config --help lists the keys it accepts. Alias: /settings
/statusOpens the Settings interface on the Status tab, showing version, model, account and connectivity. Works while Claude is responding
/doctorRuns a setup checkup that diagnoses installation, settings, extension and CLAUDE.md problems and proposes fixes that Claude applies after you confirm. Alias: /checkup
/terminal-setupInstalls a Shift+Enter keybinding for newlines in VS Code, Cursor, Devin Desktop, Alacritty or Zed. In Apple Terminal it enables Option+Enter for newlines and turns off the audible bell instead

A few commands are limited by plan or platform: /desktop only shows on macOS and x64 Windows when signed in with a Claude subscription, and /upgrade doesn't show on Enterprise plans. Also, /vim was removed in v2.1.92; to switch between Vim and Normal editing modes, use /config and then Editor mode.

Keyboard shortcuts

The shortcuts below come from the General controls table in the Interactive mode doc. On macOS, Option or Alt shortcuts such as Alt+B, Alt+F, Alt+D, Alt+Y and Alt+P need Option configured as Meta in your terminal first.

ShortcutWhat it does
Ctrl+CInterrupts a running operation. If nothing is running, the first press clears the prompt and a second press exits Claude Code
EscStops the current response or tool call mid-turn; Claude keeps the work done so far. Closes an open dialog, and declines the action on a permission prompt
Esc + EscWith text in the prompt, clears it and saves the draft to history so Up recalls it. With an empty prompt, opens the rewind menu
Shift+TabCycles permission modes: default (labeled Manual in the mode indicator), acceptEdits, plan, and, when available, bypassPermissions and then auto. On some Windows setups it is Alt+M
Ctrl+OToggles the transcript viewer, which shows detailed tool usage and execution
Ctrl+RReverse-searches your command history
Ctrl+BBackgrounds running Bash commands and agents. Tmux users press twice
Ctrl+G or Ctrl+X Ctrl+EOpens your prompt in your default text editor
Ctrl+V (Cmd+V in iTerm2, Alt+V on Windows and WSL)Pastes an image from the clipboard and inserts an [Image #N] chip at the cursor, so you can reference it by position in your prompt
Option+P (macOS) or Alt+P (Windows/Linux)Switches the model without clearing your prompt
Option+T (macOS) or Alt+T (Windows/Linux)Toggles extended thinking. It has no effect on Opus 5.5, Sonnet 5.5, Haiku 5.5 or the Fable models, which always use extended thinking

Newlines and input prefixes

InputWhat it does
\ + EnterInserts a newline; works in all terminals
Shift+EnterInserts a newline. Native in iTerm2, WezTerm, Ghostty, Kitty, Warp, Apple Terminal and Windows Terminal; for other terminals, see /terminal-setup above
Ctrl+JInserts a newline; works in any terminal without configuration
! at the startShell mode: runs a command directly, adds its output to the session, and has Claude respond to it
@File path mention; triggers path autocomplete
? on empty inputToggles the shortcut help panel
! npm test
! git status

A shell-mode command doesn't need Claude to interpret or approve it, and its output goes into the conversation context. Claude then responds to the output automatically, at the same cost as sending a normal prompt.

Launch flags mentioned in these docs

The full list of launch flags is in the CLI reference. These two pages mention only a couple:

claude --debug               # start with debug logging on
claude --settings file.json  # apply this settings file to this session only

To turn on debug logging partway through a session, run /debug; it starts capturing logs from that point forward.

FAQ

I get "Unknown command". What is going on?

Usually either a typo, or the command isn't available for your platform, plan or environment. After a typo the menu highlights nothing and Enter submits your text as typed, which reports Unknown command; unavailable commands don't appear in the menu at all. For similar messages, see troubleshooting errors.

Can I send a command while Claude is responding?

Yes. Claude Code queues it and runs it after the current turn finishes. Some commands, such as /status, /tasks and /usage, run immediately without interrupting the response.

My Option shortcuts do nothing on macOS. Why?

Your terminal needs Option configured as Meta; Anthropic's terminal config guide has the setting for each terminal. The doc notes that Option+T is the exception and works without it.

Sources