~/academy $ claude learn commands-and-shortcuts
The commands and shortcuts worth knowing
The essential Claude Code slash commands and keyboard shortcuts for managing context, switching models, resuming work and stopping or undoing Claude. 8 min
Watch it done: steer a session with commands and shortcuts
Step 1 of 7
Check how much of the context window the conversation is using before it gets crowded.
- Check how much of the context window the conversation is using before it gets crowded. Type: /context. Claude Code shows how full the context is as a coloured grid, with suggestions where something is taking a lot of space.
- Free up space without starting over. The words after /compact tell the summary what to keep. Type: /compact keep the API changes and the test commands. The conversation so far is summarised, with the summary focused on what you named, and the session carries on.
- Starting an unrelated task? Clear the conversation, and give the old one a name so it is easy to find. Type: /clear invoice-fix. A new conversation starts with empty context. The old one is labelled invoice-fix in the /resume picker.
- Change model by alias. The aliases include sonnet, opus, haiku and fable. Type: /model sonnet. The model switches and is saved as your default for new sessions. Run /model on its own for a picker, where pressing s switches for this session only.
- Ask a quick side question about the session without adding to the conversation. Type: /btw what was the name of that config file again?. The answer appears in an overlay you can dismiss. The question and answer never enter the conversation history.
- Pick up the earlier task by name, with all its history. Type: /resume invoice-fix. Claude Code switches back to the conversation you labelled invoice-fix. Run /resume on its own to pick from a list.
- Forgotten a key? Press ? on an empty prompt. Esc stops Claude mid-action, and Esc twice on an empty prompt opens the rewind menu. Type: ?. On an empty prompt, ? toggles the shortcut help panel. If you have already typed something, it just adds the character.
Commands from the official Claude Code docs, checked 18 November 2026. Lines marked Note describe what happens and are not real output.
$ Read
Keep the conversation focused
Every message sends the whole conversation, so old, unrelated history costs you on every turn. /clear between unrelated tasks is free and keeps answers sharp. Give it a name, such as /clear invoice-fix, to label the old conversation so you can find it in /resume.
/compact summarises the conversation so far and keeps going. Add a focus: /compact keep the API changes and the test commands. /context shows how full the context is as a coloured grid, with suggestions. /usage (also /cost) shows cost and plan usage.
Lesson notes: The commands and shortcuts worth knowing
Everything in this lesson as text, for revision or to read without the interactive steps. By the end you will be able to: You can steer a Claude Code session from the keyboard without reaching for the docs.
Step 1 of 6 · Read
Keep the conversation focused
Every message sends the whole conversation, so old, unrelated history costs you on every turn.
/clearbetween unrelated tasks is free and keeps answers sharp. Give it a name, such as/clear invoice-fix, to label the old conversation so you can find it in/resume./compactsummarises the conversation so far and keeps going. Add a focus:/compact keep the API changes and the test commands./contextshows how full the context is as a coloured grid, with suggestions./usage(also/cost) shows cost and plan usage.Step 2 of 6 · Read
Models, effort and picking up later
/modelopens a picker, or switch directly with/model sonnet,/model opus,/model haikuor/model fable(aliases checked 18 November 2026). It saves your choice as the default for new sessions; in the picker, pressson a row to switch for this session only./effortsets how hard Claude thinks, fromlowup tomax./resumeopens a list of past conversations, or takes a name or ID. From your shell,claude --continuereopens the most recent one in this folder andclaude --resumeshows the list./renamenames the current session so it is easy to find./btwasks a quick side question without adding it to the conversation history.Step 3 of 6 · Read
The keys that matter
Press
?on an empty prompt to see the shortcut panel at any time. These are the ones to learn first.Esc Stop Claude mid-action. Work done so far is kept, so you can redirect.
Esc Esc Empty prompt: open the rewind menu. With text typed: clear it (Up brings it back).
Shift+Tab Cycle permission modes (Manual, accept edits, plan, auto).
Ctrl+R Search your earlier prompts. Tab to edit the match, Enter to send it.
Ctrl+C Interrupt, or clear the input. Pressed again on an empty prompt, exits.
Ctrl+G Open your prompt (or a plan) in your text editor.
Ctrl+O Toggle the detailed transcript of tool calls.
Ctrl+V (Alt+V on Windows) Paste an image from the clipboard.
Alt+P (Option+P on Mac) Switch model without losing what you typed.
\ then Enter, or Ctrl+J New line in your prompt, in any terminal.
! and @ ! runs a shell command directly. @ mentions a file.
Step 4 of 6 · Try it in the terminal
Fresh start, nothing lost
The invoice bug is fixed and your next task has nothing to do with it. Start a fresh conversation and label the old one invoice-fix so you can find it later.
Hint: The command that starts a new conversation, followed by the name.
Show the command
$ /clear invoice-fix Conversation cleared. Previous conversation saved as "invoice-fix". Use /resume to return to it.
Step 5 of 6 · Quiz
Check your understanding
Claude has just made edits you do not like over the last two prompts. Your prompt box is empty. What is the quickest way to the rewind menu?
- Press Ctrl+C twice.
- Press Esc twice.
- Type /clear.
Show the answer
Press Esc twice. Right. Double Esc on an empty prompt opens the rewind menu, where you can restore the code, the conversation or both. /rewind does the same.
Step 6 of 6 · Quiz
Check your understanding
Yesterday you wrote a long, careful prompt in another project. You want it back today. What do you press?
- Ctrl+O
- Ctrl+G
- Shift+Tab
- Ctrl+R
Show the answer
Ctrl+R Right. Reverse search looks through your earlier prompts. Type a few words to find it.