Claude Code Commands Cheat Sheet: Slash Commands and CLI Flags
The slash commands, CLI flags and keyboard shortcuts you will actually use, grouped by job and one line each, with a link to the guide that goes deep on every group.
7 min read
Claude Code has two kinds of command. Slash commands such as /clear or /model are typed inside a session; CLI flags such as -p or --permission-mode are passed when you start claude from a terminal. The ones worth knowing by heart are below, grouped by the job they do, one line each. For the complete list on your machine, type / in a session, which shows only the commands available to your plan, platform and version, and run claude --help for flags. Anthropic’s CLI reference (opens in a new tab) warns that --help does not list every flag, so the reference is the place to check.
Everything here matches Anthropic’s commands reference (opens in a new tab) as of late September 2026. Claude Code changes most weeks, so if a command is missing on your machine, run claude update before assuming it has gone. Commands are only recognised at the start of a message, and anything after the name is passed as its arguments.
Starting and resuming sessions
claude start an interactive session claude "explain this repo" start with a first prompt claude -c continue the latest conversation in this folder claude -r auth-refactor resume a session by name or ID claude -n auth-refactor name the session as it starts claude -w feature-auth start in an isolated git worktree claude --add-dir ../api also give it access to another directory claude update update to the latest version claude doctor installation diagnostics, no session
/rename <name>names the current session so you can find it again in/resume./resumeopens the session picker, or resumes one by name or ID (alias/continue)./branchbranches the conversation at this point so you can try another direction and come back./cd <path>moves the session to another directory and keeps the conversation;/add-dir <path>adds a directory instead./exitleaves Claude Code (alias/quit).
Names matter more than they look: a session called pay-retry is one you can pick up tomorrow, which is the habit handing work between AI agents and people builds on. Working across several repositories at once is covered in Claude Code across multiple projects.
Context and usage
/contextshows what is filling the context window as a coloured grid, with suggestions;/context allexpands the breakdown./compact [focus]summarises the conversation to free space, keeping what you name, for example/compact keep the API changes./clearstarts a new conversation with empty context (aliases/reset,/new); the old one stays in/resume./btw <question>asks a side question whose answer never enters the conversation history./memoryopens your CLAUDE.md files and turns auto memory on or off;/initdrafts a starter CLAUDE.md./autocompact 500ksets how full the window gets before Claude Code compacts on its own;/autocompact autoresets it./usageshows session cost, plan usage limits and activity (aliases/costand/stats).
How each of these changes what Claude sees is the subject of context engineering for Claude Code. What they cost, and how to spend less, is in how to reduce Claude Code token usage.
Planning, review and undo
/plan [task]enters plan mode, optionally starting on the task you give it:/plan fix the auth bug./diffreviews the changes in your working tree, including the edits Claude has made so far./code-reviewreviews the current diff for correctness bugs (alias/review); add--fixto apply the findings, or pass a PR number to review a pull request./simplifyreviews changed code for reuse and cleanup; it does not look for bugs./security-reviewchecks the changes on your branch for vulnerabilities, and needs anoriginremote to compare against./rewindrolls code, conversation or both back to a checkpoint, or summarises part of the conversation (aliases/checkpoint,/undo).
One limit to remember: according to Anthropic’s checkpointing documentation (opens in a new tab), checkpoints track only edits made through Claude’s file tools, not files changed by shell commands, so /rewind is not a replacement for git. Claude Code plan mode covers planning in depth, and how to stop a Claude Code task covers interrupting and undoing.
Models, permissions and configuration
/model [alias]switches model and saves it as your default; in the picker, pressson a row to switch for this session only./effort [level]sets reasoning effort:low,medium,high,xhigh,maxorauto, where the model supports them./permissionsmanages allow, ask and deny rules by scope (alias/allowed-tools)./sandboxtoggles the Bash sandbox on supported platforms./configopens the settings panel;/config theme=darksets a key directly (alias/settings)./statusshows version, model, account and connectivity, and works while Claude is responding./doctorruns a setup checkup that reports problems and offers fixes before changing anything./hooksshows configured hooks;/statuslinesets up the status line;/keybindingsopens your shortcuts file./skillslists skills and can sort them by token cost;/plugininstalls and manages plugins.
--model sonnet model for this session only --effort high reasoning effort for this session --permission-mode plan default | acceptEdits | plan | auto | dontAsk | bypassPermissions --allowedTools "Bash(npm test *)" calls that run without a prompt --disallowedTools "Bash(rm *)" deny rules for this session --append-system-prompt "..." add text to the default system prompt --settings ./ci-settings.json extra settings that override your files --verbose full turn-by-turn output --debug debug logging
Which permission mode to run in, and how to write rules that approve the safe commands and nothing else, is covered in auto-approve in Claude Code. Where settings files live, and which to commit, is in Claude Code project structure.
MCP servers
claude mcp add --transport http <name> <url> add a remote server claude mcp add --scope user ... add it for every project claude mcp list list configured servers claude mcp get <name> details for one server claude mcp remove <name> remove a server claude mcp login <name> run a server's sign-in without /mcp
/mcpin a session lists servers, shows their status and runs browser sign-in for servers that need it./mcp reconnect <server>reconnects one server;/mcp disable <server>or/mcp disable allswitches servers off without opening the list.
A task board is a typical first server. For fenbs it is one line, claude mcp add --transport http fenbs https://fenbs.ai/api/mcp, then /mcp to sign in and choose the scopes the assistant gets. From then on Claude Code can call tools such as fenbs_list_items and fenbs_comment, and each change it makes is recorded in the board’s history as “Claude via” you. The Claude Code integration page has the steps, and a task-tracking workflow for Claude Code shows what to put in CLAUDE.md so it uses the board without being asked.
Headless runs and scripts
claude -p "list the API endpoints" answer once, then exit cat error.log | claude -p "explain" pipe content in claude -p "..." --output-format json text | json | stream-json claude -p "..." --max-turns 10 stop after 10 agentic turns claude -p "..." --max-budget-usd 5 stop at a spending cap claude -p "..." --permission-mode dontAsk deny anything not pre-approved claude -p "..." --bare skip hooks, skills, MCP and CLAUDE.md claude -p "..." --no-session-persistence do not save the session
--max-turns, --max-budget-usd, --json-schema and --no-session-persistence apply in print mode only. Putting these together into a safe unattended run is covered in how to automate Claude Code tasks, and running them on a timetable in Claude Code scheduled tasks.
Background and parallel work
/taskslists background work in this session, including finished subagents (alias/bashes)./background [prompt]detaches the whole session to keep running as a background agent (alias/bg);claude agentsshows them all./fork [prompt]copies the conversation into a new background session while you keep working here./batch <instruction>splits a large change into independent units, each run by a subagent in its own worktree, after you approve the plan.Ctrl+Bsends a running shell command or agent to the background.
Seeing and stopping background work is covered in Claude Code background tasks, and keeping several sessions from colliding in running Claude Code tasks in parallel.
Keyboard shortcuts
The interactive mode reference (opens in a new tab) lists these among the defaults. On macOS, the Alt shortcuts are Option, and some need Option set as Meta in your terminal.
Esc interrupt Claude; work so far is kept Esc Esc on an empty prompt, open the rewind menu Shift+Tab cycle permission modes (Alt+M on some Windows setups) Ctrl+C interrupt, or clear input; twice to exit Ctrl+O transcript viewer with full tool output Ctrl+R search your prompt history Ctrl+G open the prompt, or a proposed plan, in your editor Ctrl+B background the running command or agent Ctrl+T show or hide Claude's to-do checklist Ctrl+S stash the prompt; press again to restore it Alt+P switch model without clearing the prompt \ then Enter new line (Ctrl+J works in any terminal) ! at the start: run a shell command directly @ mention a file, with autocomplete ? on an empty prompt: shortcut help
Shortcuts can be rebound with /keybindings. If a shortcut does nothing in your terminal, /terminal-setup installs a Shift+Enter binding for newlines in terminals such as VS Code’s, and in Apple Terminal turns on Option+Enter instead.
Related
Habits that make these commands pay off are in Claude Code best practices. To give Claude Code a board it reads at the start of a session and updates as it works, connect it on the Claude Code integration page; MCP explains the protocol it uses.