Claude Code Commands Cheat Sheet (2026): Slash Commands and Shortcuts

Blog / Developer tools

Claude Code Commands Cheat Sheet (2026): Slash Commands and Shortcuts

Claude Code's everyday commands fall into four groups: session (/clear, /resume), context (/compact, /context), permissions (/permissions, Shift+Tab), and configuration (/model, /config, /doctor). Type / in a session to list every command your current version supports. The cheat sheet below covers the ones you will use most often.

These commands are built into Claude Code and may be added, removed, or renamed between versions. For exact behavior, check the official docs and the output of /help on your machine. This article does not list model version names or any parameters I am not sure about.

How should I group these commands?

It is easier to remember them by the problem you are trying to solve than alphabetically:

  • The conversation is a mess, or you want to switch topics: session commands
  • The conversation is long, slow, or the model is forgetting things: context commands
  • You are tired of confirming every step, or you want to tighten permissions: permission commands
  • You need to switch models, diagnose a problem, or change settings: configuration commands

Which session commands are there?

CommandWhat it doesWhen to use it
/clearClears the current conversation history and starts a new sessionYou are moving to an unrelated task and don't want old context interfering
/resumeLists past sessions so you can pick one to resumeYesterday's task isn't finished and you want to continue it
/rewindRolls back the conversation (in some versions, code changes too)The model went off track and you want to return to an earlier step
/exportExports the current conversation (check /help for availability)You want a record, or want to share how you debugged something
/exitExitsYou are done

From the terminal you can also run claude --continue to pick up the most recent session, or claude --resume to choose from past sessions. Those are launch flags, not in-session commands.

Which context commands are there?

Context is the total amount of content the model can "see" at once. The longer the conversation, the more of it is used up, and responses usually get slower and more expensive.

CommandWhat it doesWhen to use it
/compactCompresses the existing conversation into a summary to free up spaceThe task isn't done, but the conversation is already long
/contextShows how much context is in useYou want to know what is taking up the space
/costShows usage for this session; whether a dollar amount appears depends on how you logged inEstimating consumption
/memoryEdits memory files (such as CLAUDE.md)You want project conventions to persist
/initGenerates an initial CLAUDE.md for the current projectYou just entered a new project

Should I use /compact or /clear?

  • The same task is still going and you need to keep the key information: use /compact.
  • The task is finished and the next one is unrelated: use /clear.

You can add a note after /compact to tell it what to keep in the summary, for example:

/compact Keep the confirmed API design and the list of unfinished tests

Compression loses detail. Write important decisions into CLAUDE.md instead of relying on the conversation to remember them. To estimate monthly consumption, see "How to estimate Claude Code token usage: work out your monthly cost from your own usage". If your quota is tight, see "Claude Code quota not enough: check consumption first, then decide whether to upgrade or change billing".

How do the permission commands and shortcuts work?

Before reading or writing files or running commands, Claude Code asks for confirmation. These are the controls for adjusting that behavior:

ActionWhat it doesWhen to use it
/permissionsView and adjust the allow and deny rules for toolsA certain kind of command (such as git status) asks for confirmation every time and you want to allow it
Shift+TabSwitches between permission modes (such as plan mode)You want it to produce a plan only, without touching files
EscInterrupts the operation currently runningIt is heading the wrong way and you want it to stop now
Esc twiceJumps back to an earlier message so you can edit itYou want to rewrite your previous prompt

Be careful with allow rules: don't add commands like delete or force-push to the auto-allow list. For the exact rule syntax, see the official docs.

Which configuration commands are there?

CommandWhat it doesWhen to use it
/modelShows and switches the modelUse a lighter model for simple tasks and a stronger one for complex tasks
/configOpens the settings UIAdjust theme, notifications, and other options
/statusShows version, account, API endpoint, and other statusConfirm what you are actually connected to
/doctorChecks for installation and configuration problemsCommands misbehave, or behavior is wrong after an upgrade
/login, /logoutSwitches loginChange accounts or authentication method
/mcpManages MCP serversConnect or inspect external tools
/agentsManages subagentsDefine your own specialized agents
/hooksConfigures hooksYou want scripts to run automatically before or after tool calls

For more detail: switching models is covered in "How to switch models in Claude Code: /model and config files", config file precedence in "Claude Code settings.json levels, precedence, and env configuration", and login problems in "Claude Code won't log in? Troubleshoot by authentication method".

What symbols and shortcuts help in the input box?

InputWhat it does
@file-pathReferences a file or directory so it reads it directly
!commandEnters shell mode: runs a shell command directly and brings the output into the conversation
\ then EnterInserts a newline (some terminals support Shift+Enter; run /terminal-setup if needed)
Ctrl+CCancels the current input or operation
Ctrl+DExits
Ctrl+LClears the screen
Ctrl+RSearches input history

Terminals handle key combinations differently. If a key does nothing, first check whether the terminal itself has claimed it.

A daily workflow you can follow

  1. Go to your project directory and run claude. The first time, use /init to generate CLAUDE.md.
  2. For a complex task, press Shift+Tab to switch to plan mode first, and confirm the plan before letting it make changes.
  3. Every so often, check usage with /context. If it is high, run /compact and say what to keep.
  4. If it goes off track, press Esc to interrupt, then use /rewind to go back.
  5. When the task is done, run /clear, then start the next one.
  6. When something goes wrong, run /doctor and /status first, then look at the network and authentication.

Commands work but the connection fails. What now?

The commands themselves don't need the network, but the requests that call the model do. If you see timeouts or 401 errors, first check whether the API service is healthy. cdnping's /en/status/anthropic probes the official API entry point from the Cloudflare edge every 5 minutes, and /en/down/claude-code pulls together the status page, probes, and user reports. After that, work through "Troubleshooting Claude Code connection timeouts and errors: a four-layer network checklist" layer by layer.

What if I don't have a Claude account or can't easily pay?

Claude Code can connect to a third-party gateway through a custom API endpoint, so logging in with a Claude account is not strictly required. See "Custom API endpoints for Claude Code, Codex, and OpenCode" for the approach.

AGI Plan is a multi-provider LLM aggregation gateway. It is billed monthly, settled in RMB, and does not require an overseas credit card. A single subscription includes capability groups such as frontier reasoning, balanced general-purpose, Chinese flagship models, and fast lightweight models. To use Claude Code or Codex, you only change the API endpoint to its address. Note that the service states clearly that it is not an officially authorized channel, and some models are marked "overseas only"; check agiplan.dev/models for specifics. AGI Plan is a commercial partner of cdnping. To learn how to connect, see agiplan.dev/startup.

Before connecting, also read "Is a Claude API relay reliable? Four main risks and self-checks you can run" and then decide whether to use any relay service.

Next steps

Type /help in the terminal and compare the output with this article to check the commands in your version. Get comfortable with the most common ones: /compact, /clear, /rewind, and Shift+Tab. If you haven't finished installing yet, start with "Claude Code installation guide (macOS / Linux / Windows)", then continue with "How to use Claude Code: from installation to your first code change".

Related articles

Keep reading