Claude Code Commands Cheat Sheet: Every Slash Command, Shortcut and CLI Flag
Claude Code Commands Cheat Sheet: Every Slash Command, Shortcut and CLI Flag Type / in Claude Code and the menu scrolls past a hundred entries. Most people learn six of them, never look at the rest, and wonder why their sessions feel slow and expensive. The commands are not hard. The list is just l

Posted on Oct 26 • Originally published at alexcloudstar.com
Type / in Claude Code and the menu scrolls past a hundred entries. Most people learn six of them, never look at the rest, and wonder why their sessions feel slow and expensive. The commands are not hard. The list is just long, badly sorted for a newcomer, and changing every few weeks.
This is the cheat sheet I wanted when I started: slash commands grouped by what you are trying to do, the keyboard shortcuts that matter on macOS and Windows, the CLI commands and flags you run from your shell, how custom commands work now, and the commands that were removed so you stop looking for them. I checked it against the official commands, interactive mode and CLI reference pages on October 24, 2026. Claude Code ships updates constantly, so treat the docs as the source of truth if a command here has drifted.
Claude Code commands fall into three layers. Slash commands are typed at the start of a message inside a session, such as /clear or /compact. Keyboard shortcuts and prefixes are typed in the prompt, such as Shift+Tab,! for a shell command, and @ for a file. CLI commands and flags are typed in your terminal before or while launching, such as claude -c or claude --model.
Two details save confusion. A slash command is only recognized at the very start of your message, and anything after the name becomes its arguments. And some entries in the menu are not built in at all: /batch, /loop, /simplify, /code-review and others are bundled skills. They behave like commands, but they are prompts Claude follows, which is why they can do multi-step work.
If you only learn ten things, learn these. They cover most of what separates a smooth session from a messy one.
Two shortcuts belong on that list: Shift+Tab cycles permission modes, and pressing Esc twice rewinds. Both are covered below. If you want the guided version of this list, with an install and a first session, start with my Claude Code tutorial and come back here for the full reference.
The official page lists them alphabetically. That is fine for lookup and bad for learning, so these are grouped by the moment you need them. Aliases are noted because the same command often has two or three names.
The order the docs suggest for a first session is /init, then /memory to refine the file, then /mcp for any servers, then /permissions. The CLAUDE.md part is the one that pays off most, and I walk through what belongs in it in the tutorial. For MCP specifically, see the MCP server developer guide.
Context is the budget you spend every turn, so this group matters more than it looks. I wrote about the bigger picture in context engineering for AI coding. The commands themselves are simple.
/clear versus /compact is the decision people get wrong. /clear throws the conversation away and keeps project memory, so use it when the next task is unrelated. /compact keeps a summary and continues the same task. Running /context first tells you whether compaction is even worth it. /btw is the quiet winner of this group: you get an answer without paying for it in the main thread's history.
If you are weighing models by price and capability, my cache pricing review of Fable 5.1 covers what switching mid-session costs. There is a catch the docs call out: changing model or effort mid-conversation can invalidate your prompt cache, and Claude Code warns you before it does.
Plan mode is the habit I would push hardest. Having Claude write the approach before it edits anything catches a wrong turn while it is still cheap, and /plan gets you there without remembering the keyboard cycle. For multi-file work in parallel, /batch leans on git worktrees, and the review commands pair with the problems in the AI code review bottleneck.
The /agents row is a good example of why a cheat sheet goes stale. If an older tutorial tells you /agents opens a manager, check your version. Subagents are covered properly in the subagents guide, and the broader idea of delegating work to run unattended is in background AI coding agents.
Old blog posts still list these. They no longer work the way they describe.
Some commands are also hidden from the menu until you type the full name, such as /setup-bedrock and /setup-vertex. That is the closest thing to a secret command. Run /help or type / and keep typing to filter, and you will see everything your plan and platform allow.
Shortcuts are where Claude Code feels fast. The ones worth learning first are Shift+Tab, Esc, Ctrl+O and the! prefix. A note first: on macOS, any shortcut that uses Option as Alt ( Alt+B, Alt+F, Alt+D, Alt+Y, Alt+P ) needs your terminal set to treat Option as Meta. Without that setting they do nothing, and it is the most common reason a shortcut seems broken.
The! prefix is underrated. Typing! npm test runs it right away, puts the output in the conversation, and lets Claude respond to the result, with no approval step and no model tokens spent deciding to run it. It supports Ctrl+B backgrounding too.
On Windows, if Shift+Tab does not cycle modes because your Node or Bun runtime does not enable VT input mode, use Alt+M. Customizing any of these goes through /keybindings.
These run in your shell, outside the session. The docs list around 85 flags, and you will use about fifteen. Here are the commands first.
A few invocations I would actually save:
claude -c claude -r "auth-refactor" "finish this PR" claude -w feature-auth claude --permission-mode plan git diff main | claude -p "review this diff for bugs" claude -p "list every TODO" --output-format json --max-turns 5 Enter fullscreen mode Exit fullscreen mode If you script with -p, the Agent SDK guide is the next step. For worktree-based parallel work, see the worktree guide.
You can still write your own commands, but the mechanism changed. The docs say custom commands have been merged into skills: a file at.claude/commands/deploy.md and a skill at.claude/skills/deploy/SKILL.md both create /deploy and work the same way. Existing command files keep working. Skills add a folder for supporting files, frontmatter that controls whether you or Claude can invoke them, and automatic loading when relevant. If a command file and a skill share a name, the skill wins.
A minimal custom command is a markdown file:
--- description: Review a file for bugs and missing tests --- Review $ARGUMENTS for correctness bugs and missing tests. List findings by severity, most serious first. Enter fullscreen mode Exit fullscreen mode Save it as.claude/commands/review-file.md and run /review-file src/auth.ts. $ARGUMENTS expands to everything after the command name. You can also address arguments by position with $0, $1 and so on, counting from zero, and wrap multi-word values in quotes. Put files in.claude/ to share them with a project, or ~/.claude/ to keep them personal.
For anything you will reuse or share, write a skill instead. I cover the full format in the skill developer guide, and the plugin marketplace guide shows how to package and install them.
People search for "claude code allow all commands" because the prompts get old. There are four sane answers, from narrowest to widest.
Blanket allow-all is the option I would avoid, and the reason is practical: one bad command in an unattended session is hard to undo. The least-privilege guide for coding agents goes through how to scope permissions without drowning in prompts, and a PreToolUse hook can block the dangerous commands while allowing the rest.
You do not need to memorize any of this. A short daily loop covers most of it:
The same pattern applies to the less common commands. Learn them when a problem shows up. /rewind makes sense the first time a refactor goes sideways, and /btw makes sense the first time you want a quick answer without polluting a long thread. For a full worked example of how far this loop can go, see the 32,784-line workflow post.
What are some useful commands in Claude Code? Start with /init, /clear, /compact, /context, /model, /plan, /rewind, /resume, /permissions and /usage. Add the! shell prefix, @ file mentions, Shift+Tab and double Esc.
Are there secret commands in Claude Code? Not really. A few are hidden from the menu until you type their full name, such as /setup-bedrock and /setup-vertex, and several useful ones are just overlooked, like /btw, /recap and /powerup. /help and /skills list what is available to you.
How do I run a command in Claude Code? Type / at the very start of a message, then the command name and any arguments. To run a shell command instead, start the message with!. A slash command is only recognized at the start of the message.
How do I allow commands in Claude Code? Use /permissions to add allow rules, press Shift+Tab to change the permission mode, or pass --allowedTools when you launch. Avoid --dangerously-skip-permissions outside a sandbox.
What are the Claude Code keyboard shortcuts on Windows? Most match macOS with Alt in place of Option: Alt+P switches model, Alt+T toggles extended thinking and Alt+O toggles fast mode. Use Alt+V to paste an image, and Alt+M for the mode cycle if Shift+Tab does not work in your runtime.
What does Ctrl+O do in Claude Code? It toggles the transcript viewer, which shows detailed tool usage and timestamps, and expands lines that collapse by default. Ctrl+G is a different shortcut: it opens your prompt in your default text editor.
What is the difference between a command and a skill? Custom commands have been merged into skills. A markdown file in.claude/commands/ and a skill in.claude/skills/ both create the same /name command. Skills add supporting files, invocation controls and automatic loading, and the docs recommend them for new work.
Where do I see every command? Type / and keep typing to filter, run /help, or run /skills for the skills list. The full reference is the official commands page.
Sources: Claude Code commands, Interactive mode, CLI reference and Skills, checked October 24, 2026.