Claude Code commands: 2026 cheat sheet of slash commands, flags, keys

Claude Code commands: 2026 cheat sheet of slash commands, flags, keys

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.

In shortTL;DR
  • 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, /diff and /code-review first; they cover most daily work.
  • Shift+Tab cycles permission modes, Esc stops Claude without losing work, and Esc twice on an empty prompt opens the rewind menu.
  • At launch, claude -c continues the last conversation, claude -p runs one task without the interactive UI, and claude -w <name> starts in an isolated git worktree.
  • Custom commands are now skills: a SKILL.md in .claude/skills/<name>/ becomes /<name>, and old .claude/commands/*.md files 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.

KindWhere you type itExampleUse it to
Slash commandClaude Code prompt/compactControl the current session
CLI command or flagYour shellclaude -cChoose how a session starts
Keyboard shortcutClaude Code promptShift+TabAct instantly without typing
Prompt symbolIn 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.

Note

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.

CommandWhat it doesUse it when
/initGenerates a starter CLAUDE.md for the projectFirst session in a repository
/memoryEdits CLAUDE.md files and auto memoryClaude keeps forgetting a convention
/permissionsManages allow, ask and deny rulesYou're tired of approving the same safe command
/mcpManages MCP server connections and sign-inA tool server failed or needs auth
/plan [task]Enters plan mode, optionally with a taskAny change bigger than one file
/model [model]Switches model and saves it as your defaultThe task needs more or less capability
/effort [level]Sets reasoning effort, from low to maxHard bugs (up) or quick edits (down)
/contextShows what fills the context windowAnswers get vague in a long session
/compact [focus]Summarizes the conversation to free spaceYou want to keep going on the same task
/clearStarts a fresh conversationYou switch to an unrelated task
/btw [question]Asks a side question that isn't saved to historyQuick lookup without derailing the task
/diffShows working-tree changes, including Claude's editsBefore you accept or commit anything
/code-reviewReviews the diff or a PR for bugs, --fix applies findingsBefore you open a pull request
/security-reviewChecks your branch's diff for vulnerabilitiesChanges touching auth, input or secrets
/rewindRolls code and conversation back to a checkpointClaude went down the wrong path
/resume [name]Reopens an earlier conversationPicking up yesterday's work
/usageShows session cost, plan limits and statsChecking how close you are to a limit
/doctorDiagnoses installation and settings problemsSomething 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:

  • /tasks lists 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.
  • /background detaches 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.

SituationCommandWhat happens to contextWhat happens to code
Done with task A, starting unrelated task B/clearNew, empty conversation; old one stays in /resumeUntouched
Same task, conversation getting long/compactReplaced by a summaryUntouched
Claude made a mess in the last few steps/rewind or Esc EscRolled back to the checkpoint you pickCan be restored too
Quick question about the work so far/btwNot added to historyUntouched
Not sure why answers degrade/contextInspected, not changedUntouched

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.

A monitor full of terminal windows with green and white text in a dark room
Most of Claude Code's speed comes from a few shortcuts you stop thinking about.
ShortcutWhat it does
Shift+TabCycles permission modes: Manual (default), acceptEdits, plan, then bypassPermissions and auto when available
EscStops Claude mid-turn so you can redirect; work done so far is kept
Esc EscClears a typed draft, or on an empty prompt opens the rewind menu
Ctrl+CInterrupts; on an empty prompt, a second press exits
Ctrl+OToggles the transcript viewer with full tool output
Ctrl+RSearches your prompt history
Ctrl+BSends a running Bash command or agent to the background (press twice in tmux)
Ctrl+GOpens your prompt in your text editor
Ctrl+SStashes the current draft, press again on an empty prompt to restore it
Ctrl+TShows or hides Claude's task checklist
Ctrl+VPastes an image from the clipboard (Cmd+V in iTerm2, Alt+V on Windows)
Option+P / Alt+PSwitches model without clearing your prompt
Ctrl+LRedraws 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.
Tip

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 flagWhat it does
claude "query"Starts a session with a first prompt
claude -cContinues 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 agentsOpens 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 jsonMachine-readable output in print mode
--safe-modeStarts with CLAUDE.md, skills, hooks, MCP and plugins disabled, to debug config
claude updateUpdates to the latest version
claude doctorPrints install and settings diagnostics without starting a session

Combined, these cover most scripted and parallel work:

terminal
# 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-billing

The 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.

  1. 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.
  2. Create the folder, for example mkdir -p .claude/skills/fix-issue.
  3. Write SKILL.md with YAML front matter and the instructions.
  4. Use $ARGUMENTS for everything typed after the command, or $0, $1 and so on for individual arguments.
  5. Add disable-model-invocation: true if only you should trigger it, for anything with side effects such as deploys or commits.
  6. Run /reload-skills if the new command doesn't appear in the / menu, then try it.
.claude/skills/fix-issue/SKILL.md
---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 fieldWhat it controls
descriptionWhen Claude may load the skill on its own
argument-hintHint shown in autocomplete, like [issue-number]
disable-model-invocationtrue means only you can run it
allowed-toolsTools pre-approved for the turn that runs the command
nameOverrides 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.

Warning

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 commandStatus nowUse instead
/cost, /statsAliases/usage
/reviewAlias since v2.1.223/code-review
/vimRemoved in v2.1.92/config, then Editor mode
/pr-commentsRemoved in v2.1.91Ask Claude to read the PR comments
/ultraplanRemoved/plan or Shift+Tab into plan mode
/extra-usageRenamed/usage-credits
/agentsPrints a reminder, no longer an editorAsk Claude to create subagents, or edit .claude/agents/
--enable-auto-modeRemoved 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.

claude-code-cheatsheet.txt
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 file

How 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.

  1. Day one: run /init in your main repository, then /memory to trim what it wrote. Our CLAUDE.md best practices show what belongs there.
  2. Start every multi-file change with /plan or Shift+Tab into plan mode.
  3. Run /context once a day to see what fills the window, and /clear whenever you change tasks.
  4. Use Esc the moment Claude heads the wrong way instead of waiting, and Esc Esc to rewind.
  5. End each task with /diff and /code-review before you commit.
  6. When you paste the same prompt a third time, turn it into a skill in .claude/skills/.
  7. Once a week, run /release-notes to 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.

SOURCES

  1. Claude Code docs: Commands
  2. Claude Code docs: Interactive mode
  3. Claude Code docs: CLI reference
  4. Claude Code docs: Extend Claude with skills
  5. Claude Code docs: Permission modes
  6. Claude Code docs: Customize keyboard shortcuts
  • #claude code
  • #cheat sheet
  • #slash commands
  • #terminal
  • #ai coding
Orkio team

The team building Orkio. We write about putting AI to work: coding agents that run overnight, always-on boxes and pull requests ready by morning.

Keep reading

All posts

07:06 · YOU MERGED #128

Go to sleep. Wake up to pull requests.

Start for $19 a month
© 2026 Orkio · Hosted in Europe TürkçeStatus