Getting startedGuide 3 of 12
Essential commands and shortcuts
Commands and shortcuts for everyday work with Claude Code, plus how to pick a model based on the task.
Updated 6 min read
// on this page
This is the quick reference: the most frequently used commands and shortcuts, grouped by what they solve.
Context management
| Command | What it does |
|---|---|
/compact | Summarizes the conversation history to free up space, without losing the thread of what you’re doing. |
/clear | Wipes the whole history and starts from scratch. Use it when you switch tasks completely. |
/context | Shows you what’s taking up your context window — useful for deciding whether to compact. |
Planning and change control
| Command | What it does |
|---|---|
/plan | A mode where Claude explores and puts together a plan without touching your code yet. Ideal before a large task. |
/diff | Shows the changes made, so you can review them at a glance before committing. |
/rewind (or double Esc Esc) | Undoes code and conversation changes, returning to an earlier point. Useful when the current approach isn’t working and it’s better to back out. |
Permissions
| Command / shortcut | What it does |
|---|---|
/permissions | Opens the panel for viewing and editing which commands/tools are allowed, denied, or require confirmation. |
Shift+Tab | Cycles through the permission modes without typing anything (see Permissions in Claude Code). |
Everyday work / repo
| Command | What it does |
|---|---|
/init | Generates an initial CLAUDE.md by analyzing your repo. Ideal when starting a new project. |
/memory | Lists and opens your memory files, and turns auto memory on or off. See Memory and context. |
/agents | Manages subagents: creating, editing, and invoking them. |
/mcp | View and manage the connected MCP servers. |
/security-review | Runs a security review over the changes on your current branch. See Security when working with Claude Code. |
Model and effort
| Command | What it does |
|---|---|
/model | Switches between models (Sonnet, Opus, Haiku) depending on the complexity of the task. |
/effort | Adjusts how much the model “thinks” before answering (low to xhigh, plus max and auto) — more effort helps with complex debugging, but burns more quota. |
How to choose a model based on the task
/model accepts aliases (haiku, sonnet, opus) that always resolve to the latest version of that family — it’s the most stable way to refer to a model in settings.json or in a subagent, because it doesn’t break every time Anthropic ships a new version. The logic for choosing between families holds even as the specific versions change:
- Haiku → consider it for high-frequency, low-risk tasks: quick file exploration, linting, subagents running in a loop, or when you’re about to hit your usage limit. Don’t use it for architecture decisions or for debugging a non-obvious root cause.
- Sonnet → the reasonable default for 80% of daily work: implementing features, contained refactors, writing tests. It’s the starting point until you have a concrete reason to switch.
- Opus → save it for problems where the cost of a bad decision is high: architecture design, a bug that has already survived a couple of attempts, a security review. Avoid it for repetitive or low-risk work — it’s the most expensive and slowest of the three.
There are two axes, independent of each other, that are worth not confusing: the model (how capable it is) and /effort (how much reasoning time it spends before answering). You can run Sonnet at high effort for a one-off debugging session without escalating to Opus, and it’s almost always cheaper than moving up a family.
Start on Sonnet as your default. Move up to Opus only once Sonnet has already given you an unconvincing answer on a genuinely hard problem, not preemptively. Drop to Haiku for mechanical, high-volume work — an exploration subagent invoked twenty times in the same session is a good candidate.
Navigation
| Command / shortcut | What it does |
|---|---|
/add-dir | Gives it access to another folder besides the current one — useful in monorepos. |
/cd | Moves the session to another directory without losing the conversation. |
@ | Attaches a specific file to your message (autocompletes with the file explorer). |
! | Starting a message with ! runs a shell command directly, without going through Claude. |
Esc | Interrupts Claude while it’s working. |
Related documentation: this is a curated selection — the complete command reference includes several more, among them /doctor, /code-review, and the ones added by the SDK or by installed plugins.