Claude Code commands come in three kinds: slash commands you type inside a session (like /clear or /plan), CLI commands and flags you pass when you launch claude, and keyboard shortcuts. This cheat sheet covers the ones worth learning, when to reach for each, which old commands were renamed or removed, and how to build your own custom commands.
- Type
/inside Claude Code to see every command available to you; a command only runs when it starts your message. - Learn
/init,/plan,/context,/compact,/clear,/rewind,/diffand/code-reviewfirst; they cover most daily work. Shift+Tabcycles permission modes,Escstops Claude without losing work, andEsctwice on an empty prompt opens the rewind menu.- At launch,
claude -ccontinues the last conversation,claude -pruns one task without the interactive UI, andclaude -w <name>starts in an isolated git worktree. - Custom commands are now skills: a
SKILL.mdin.claude/skills/<name>/becomes/<name>, and old.claude/commands/*.mdfiles still work.
What are Claude Code commands?
Claude Code commands are the controls you use to steer Anthropic's coding agent, and they come in three kinds: slash commands typed inside a session, CLI commands and flags passed when you start claude from your shell, and keyboard shortcuts. Knowing which kind does what saves you from hunting through menus mid-task.
| Kind | Where you type it | Example | Use it to |
|---|---|---|---|
| Slash command | Claude Code prompt | /compact | Control the current session |
| CLI command or flag | Your shell | claude -c | Choose how a session starts |
| Keyboard shortcut | Claude Code prompt | Shift+Tab | Act instantly without typing |
| Prompt symbol | In the prompt (! at the start) | !, @ | Run shell commands, mention files |
Type / at the prompt to see the commands available to you; letters after the slash filter the list. Per the official commands reference, a command is only recognized at the start of a message, and any text after the name becomes its arguments. If you send a command while Claude is still responding, it is queued until the turn ends, except for a few like /status, /tasks and /usage that run immediately.
Claude Code ships updates often, and this list reflects the docs as of November 2026. Availability depends on your plan, platform and version, so if a command is missing, run claude update and type / again.
If you have not installed Claude Code yet, start with our Claude Code tutorial and come back.
Which slash commands should you learn first?
Eight slash commands cover most daily work: /init, /plan, /context, /compact, /clear, /rewind, /diff and /code-review. The table below groups the most useful ones by when you need them in a session.
| Command | What it does | Use it when |
|---|---|---|
/init | Generates a starter CLAUDE.md for the project | First session in a repository |
/memory | Edits CLAUDE.md files and auto memory | Claude keeps forgetting a convention |
/permissions | Manages allow, ask and deny rules | You're tired of approving the same safe command |
/mcp | Manages MCP server connections and sign-in | A tool server failed or needs auth |
/plan [task] | Enters plan mode, optionally with a task | Any change bigger than one file |
/model [model] | Switches model and saves it as your default | The task needs more or less capability |
/effort [level] | Sets reasoning effort, from low to max | Hard bugs (up) or quick edits (down) |
/context | Shows what fills the context window | Answers get vague in a long session |
/compact [focus] | Summarizes the conversation to free space | You want to keep going on the same task |
/clear | Starts a fresh conversation | You switch to an unrelated task |
/btw [question] | Asks a side question that isn't saved to history | Quick lookup without derailing the task |
/diff | Shows working-tree changes, including Claude's edits | Before you accept or commit anything |
/code-review | Reviews the diff or a PR for bugs, --fix applies findings | Before you open a pull request |
/security-review | Checks your branch's diff for vulnerabilities | Changes touching auth, input or secrets |
/rewind | Rolls code and conversation back to a checkpoint | Claude went down the wrong path |
/resume [name] | Reopens an earlier conversation | Picking up yesterday's work |
/usage | Shows session cost, plan limits and stats | Checking how close you are to a limit |
/doctor | Diagnoses installation and settings problems | Something is broken after an update |
A few of these take arguments that save a step. /plan fix the auth bug enters plan mode and starts on the task in one go. /compact focus on the API changes tells the summary what to keep. /code-review high 1234 reviews pull request 1234 at high effort, and /review is an alias for the same command.
Commands for parallel and background work
Claude Code can now run work beyond the current conversation, and a handful of commands control that:
/taskslists background work in the session, including finished subagents./subtask <task>hands a side task to a background subagent that reports back here./fork [prompt]copies the conversation into a new background session while you keep working./branch [name]creates a branch of the conversation and switches you into it./backgrounddetaches the whole session so it keeps running and frees your terminal./batch <instruction>splits a large change into 5 to 30 units and runs each in its own git worktree./loop [interval] [prompt]reruns a prompt while the session stays open, for example/loop 5m check if the deploy finished.
/clear vs /compact vs /rewind vs /btw: which one do you need?
Use /clear for a new task, /compact to continue the same task with a shorter history, /rewind to undo a wrong turn, and /btw for a question that shouldn't touch the conversation. People mix these up more than any other commands, and picking the wrong one either throws away useful context or keeps stale context that makes answers worse.
| Situation | Command | What happens to context | What happens to code |
|---|---|---|---|
| Done with task A, starting unrelated task B | /clear | New, empty conversation; old one stays in /resume | Untouched |
| Same task, conversation getting long | /compact | Replaced by a summary | Untouched |
| Claude made a mess in the last few steps | /rewind or Esc Esc | Rolled back to the checkpoint you pick | Can be restored too |
| Quick question about the work so far | /btw | Not added to history | Untouched |
| Not sure why answers degrade | /context | Inspected, not changed | Untouched |
The interactive mode docs note that /btw answers only from what is already in the conversation, works while Claude is still responding, and shows the answer in an overlay you can dismiss. Our guide to the context window explains why a cleaner context produces better answers.
Which Claude Code keyboard shortcuts are worth memorizing?
Ten shortcuts do most of the work: Shift+Tab, Esc, Esc Esc, Ctrl+C, Ctrl+O, Ctrl+R, Ctrl+B, Ctrl+G, Ctrl+S and Ctrl+J. Press ? on an empty prompt to see the full shortcut panel in your own terminal.

| Shortcut | What it does |
|---|---|
Shift+Tab | Cycles permission modes: Manual (default), acceptEdits, plan, then bypassPermissions and auto when available |
Esc | Stops Claude mid-turn so you can redirect; work done so far is kept |
Esc Esc | Clears a typed draft, or on an empty prompt opens the rewind menu |
Ctrl+C | Interrupts; on an empty prompt, a second press exits |
Ctrl+O | Toggles the transcript viewer with full tool output |
Ctrl+R | Searches your prompt history |
Ctrl+B | Sends a running Bash command or agent to the background (press twice in tmux) |
Ctrl+G | Opens your prompt in your text editor |
Ctrl+S | Stashes the current draft, press again on an empty prompt to restore it |
Ctrl+T | Shows or hides Claude's task checklist |
Ctrl+V | Pastes an image from the clipboard (Cmd+V in iTerm2, Alt+V on Windows) |
Option+P / Alt+P | Switches model without clearing your prompt |
Ctrl+L | Redraws a garbled screen |
For multiline prompts, \ then Enter works in every terminal and Ctrl+J works without configuration. Shift+Enter works natively in iTerm2, WezTerm, Ghostty, Kitty, Warp, Apple Terminal and Windows Terminal; for VS Code, Cursor, Alacritty or Zed, run /terminal-setup once to install it.
Three prompt prefixes act like shortcuts too:
!at the start runs a shell command directly, such as! npm test, and adds its output to the conversation.@triggers file path autocomplete so you can point Claude at exact files./opens the command menu, and also completes commands partway through a prompt.
On macOS, shortcuts with Option or Alt such as Alt+B and Alt+F need your terminal set to use Option as Meta. To change any binding, run /keybindings, which opens ~/.claude/keybindings.json; changes apply without a restart.
Which Claude Code CLI commands and flags matter most?
At the shell, claude starts a session, claude -c continues the last one, claude -r <name> resumes a named one, and claude -p "<task>" runs a task without the interactive UI. Flags set the model, permission mode and working directories before the first prompt.
| Command or flag | What it does |
|---|---|
claude "query" | Starts a session with a first prompt |
claude -c | Continues the most recent conversation in this directory |
claude -r <id or name> | Resumes a specific session, or opens a picker |
claude -n <name> | Names the session so you can resume it by name |
claude -p "query" | Prints the answer and exits (headless mode) |
claude -w <name> | Starts in an isolated git worktree under .claude/worktrees/ |
claude --bg "task" | Starts a background agent and returns immediately |
claude agents | Opens agent view to watch background sessions |
--model <alias> | Picks a model: sonnet, opus, haiku, fable or a full name |
--permission-mode <mode> | Starts in plan, acceptEdits, auto, dontAsk and others |
--add-dir <path> | Gives Claude access to another directory |
--allowedTools "..." | Pre-approves tools, such as "Bash(npm test)" |
--max-turns <n> | Caps agentic turns in print mode |
--output-format json | Machine-readable output in print mode |
--safe-mode | Starts with CLAUDE.md, skills, hooks, MCP and plugins disabled, to debug config |
claude update | Updates to the latest version |
claude doctor | Prints install and settings diagnostics without starting a session |
Combined, these cover most scripted and parallel work:
# Pick up yesterday's work by nameclaude -n "auth-refactor"claude -r "auth-refactor" "Finish the remaining tests"# Start a careful session that can't edit until you approve a planclaude --permission-mode plan# One-shot task for a script or CI jobcat build.log | claude -p "Explain why this build failed" --output-format json --max-turns 3# Two features in parallel, each in its own worktreeclaude -w feature-loginclaude -w feature-billingThe permission modes page recommends --dangerously-skip-permissions (the same as --permission-mode bypassPermissions) only inside isolated containers and VMs. For more on -p, output formats and CI, read our guide to Claude Code headless mode.
Background sessions started with claude --bg or /background still run on your own computer, so they pause when it sleeps or shuts down. If you want agents to keep going overnight, Orkio rents an always-on, isolated cloud box where Claude Code runs on your own Claude account, and you check on it from your phone.
How do you create a custom slash command in Claude Code?
To create a custom command, add a SKILL.md file in a folder under .claude/skills/; the folder name becomes the command. The skills docs say custom commands have been merged into skills: .claude/commands/deploy.md and .claude/skills/deploy/SKILL.md both create /deploy, and existing command files keep working.
- Pick the scope. A project command goes in
.claude/skills/<name>/and is shared through git. A personal one goes in~/.claude/skills/<name>/and works in every project. - Create the folder, for example
mkdir -p .claude/skills/fix-issue. - Write
SKILL.mdwith YAML front matter and the instructions. - Use
$ARGUMENTSfor everything typed after the command, or$0,$1and so on for individual arguments. - Add
disable-model-invocation: trueif only you should trigger it, for anything with side effects such as deploys or commits. - Run
/reload-skillsif the new command doesn't appear in the/menu, then try it.
---description: Fix a GitHub issue by numberargument-hint: "[issue-number]"disable-model-invocation: trueallowed-tools: Bash(git status *) Bash(gh issue view *)---## Working tree right now!`git status --short`## Your taskFix GitHub issue #$0 following the conventions in CLAUDE.md.1. Read the issue with `gh issue view $0` and find the root cause before editing.2. Write a failing test, then make it pass.3. Run the full test suite and summarize what you changed.Running /fix-issue 123 replaces $0 with 123. The !`git status --short` line runs before Claude sees the prompt, so the current state of the working tree arrives already inlined, and allowed-tools pre-approves both commands so neither stops for a permission prompt. That dynamic context is what makes a custom command better than a pasted prompt.
| Front matter field | What it controls |
|---|---|
description | When Claude may load the skill on its own |
argument-hint | Hint shown in autocomplete, like [issue-number] |
disable-model-invocation | true means only you can run it |
allowed-tools | Tools pre-approved for the turn that runs the command |
name | Overrides the folder name as the command name |
A file in a subfolder of .claude/commands/, such as frontend/component.md, becomes /frontend:component. Plugin skills appear as /plugin-name:skill-name.
Workspace trust doesn't gate a project skill's allowed-tools, which applies even in a claude -p run in a folder you have never trusted. Read the skills inside .claude/skills/ of any repository you clone before running Claude Code there.
For supporting files, subagent execution and sharing skills across a team, see our full guide to Claude Code skills.
Which Claude Code commands were renamed or removed?
As of November 2026, several commands that older cheat sheets still list have changed: some are now aliases, and a few are gone. If a tutorial tells you to run one of these, use the replacement.
| Old command | Status now | Use instead |
|---|---|---|
/cost, /stats | Aliases | /usage |
/review | Alias since v2.1.223 | /code-review |
/vim | Removed in v2.1.92 | /config, then Editor mode |
/pr-comments | Removed in v2.1.91 | Ask Claude to read the PR comments |
/ultraplan | Removed | /plan or Shift+Tab into plan mode |
/extra-usage | Renamed | /usage-credits |
/agents | Prints a reminder, no longer an editor | Ask Claude to create subagents, or edit .claude/agents/ |
--enable-auto-mode | Removed in v2.1.111 | --permission-mode auto |
Aliases still worth knowing: /new and /reset for /clear, /undo and /checkpoint for /rewind, /continue for /resume, /settings for /config, and /bg for /background.
A copyable Claude Code command cheat sheet
Keep this block in a note or pin it next to your terminal. It holds the commands from this guide that you will use every week.
START claude new session claude -c continue last conversation here claude -r <name> resume a named session claude -p "task" run once, print, exit claude -w <name> new session in a git worktree claude --permission-mode planIN A SESSION /init create CLAUDE.md /memory edit memory /plan task plan before editing /model switch model /context what fills context /compact summarize, keep going /clear fresh conversation /resume reopen old one /btw q side question /rewind undo to checkpoint /diff see changes /code-review review the diff /usage cost and limits /doctor fix setup problemsKEYS Shift+Tab permission modes Esc stop Claude Esc Esc rewind menu Ctrl+O full transcript Ctrl+R search history Ctrl+B background a task Ctrl+G edit in $EDITOR Ctrl+J new line !cmd run shell command @file mention a fileHow to learn Claude Code commands this week
Learn commands by attaching them to moments in your workflow rather than memorizing the list. A week of this is enough for them to become habits.
- Day one: run
/initin your main repository, then/memoryto trim what it wrote. Our CLAUDE.md best practices show what belongs there. - Start every multi-file change with
/planorShift+Tabinto plan mode. - Run
/contextonce a day to see what fills the window, and/clearwhenever you change tasks. - Use
Escthe moment Claude heads the wrong way instead of waiting, andEsc Escto rewind. - End each task with
/diffand/code-reviewbefore you commit. - When you paste the same prompt a third time, turn it into a skill in
.claude/skills/. - Once a week, run
/release-notesto see what changed, since commands are added and retired often.
Frequently asked questions
How do I see all Claude Code commands?
Type a forward slash at the start of the prompt inside Claude Code and a menu lists every command, bundled skill, plugin command and MCP prompt available to you. Keep typing letters to filter it. The full official list lives on the Commands page of the Claude Code docs, and some commands only appear on certain plans or platforms.
What is the difference between /clear and /compact in Claude Code?
/clear starts a new conversation with an empty context, while the old one stays available through /resume. /compact keeps the same conversation but replaces the history with a summary to free space. Use /clear when you switch to an unrelated task and /compact when you want to continue the current one.
Can I run Claude Code commands from a script?
Yes. claude -p runs a prompt non-interactively and exits, and you can pipe input into it, set --output-format json, and cap work with --max-turns. A few slash commands, such as /config with key=value pairs, /rename and /color, also work in -p mode.
Where do custom slash commands go in Claude Code?
Put a SKILL.md file in .claude/skills/<name>/ inside your project to share the command with your team, or in ~/.claude/skills/<name>/ to use it in every project. The folder name becomes the command. Older Markdown files in .claude/commands/ still work but skills support extra files and more options.
Why does Claude Code say Unknown command?
The command is either misspelled, not available on your plan, platform or version, or was removed in a newer release. Run claude update to get the latest version, then type / to see what your installation offers. Some commands, such as /heapdump, stay hidden from the menu until you type the full name.
Is there a shortcut to undo what Claude Code did?
Press Esc twice on an empty prompt, or run /rewind, to open the checkpoint menu. From there you can restore the code, the conversation or both to an earlier point. Files changed only by shell commands are not tracked, so commit to git before risky work.


