Skip to content

Claude Code commands: slash commands, CLI flags, shortcuts

The Claude Code commands worth knowing, from /init, /compact and /model to CLI flags such as -p and -c, keyboard shortcuts and your own commands.

Updated November 1, 2026Markdown version

Claude Code has two kinds of built-in commands. Slash commands such as /init, /compact and /model run inside a session; type / to list them. CLI commands and flags such as claude -p, claude -c and --model run in your terminal. Keyboard shortcuts and your own commands, written as skills, complete the set.

Slash commands or CLI commands?#

KindWhere you type itExample
Slash commandIn the Claude Code prompt, at the start of a message/compact
CLI command or flagIn your terminal, before Claude Code startsclaude -c
Keyboard shortcutIn the Claude Code promptShift+Tab
Your own command (skill)In the Claude Code prompt, like a slash command/fix-issue 123

A slash command works only at the start of a message, and any text after its name becomes its arguments. If you send one while Claude is still answering, it waits in a queue, though some, such as /status, /tasks and /usage, run right away. The list depends on your platform, plan and version, so a bare / or /help is the reliable way to see yours.

Which slash commands should you know?#

The ones you'll use most, by when you need them.

Set up a project#

  • /init: Claude reads the project and writes a starter CLAUDE.md, a file of instructions it loads at the start of every session.
  • /memory: opens your CLAUDE.md files and auto memory for editing.
  • /permissions: shows and edits the allow, ask and deny rules for tools.
  • /mcp: lists your MCP servers and their status. See MCP in Claude Code.
  • /config: opens the settings. You can also set one value directly, such as /config theme=dark.

During a task#

  • /plan: asks Claude to plan before it edits anything. Add the task after it, such as /plan fix the auth bug.
  • /model: switches the model and saves it as the default for new sessions. If ANTHROPIC_MODEL is set, as in the setup below, the next launch returns to that model.
  • /effort: sets how much the model thinks before it answers.
  • /context: shows how full the context window is, as a colored grid.
  • /compact: summarizes the conversation to free up context. Add instructions to say what to keep, such as /compact keep the API changes.
  • /btw: asks a quick side question. The answer doesn't enter the conversation history, and Claude can't use tools to answer it.

Review and undo#

  • /diff: opens a viewer of your uncommitted changes.
  • /rewind: goes back to an earlier point in the conversation, the code, or both. Pressing Esc twice on an empty prompt opens the same menu, and /undo and /checkpoint are other names for it.
  • /review: asks Claude to review your changes or a pull request, such as /review 1234. It's another name for /code-review.
  • /security-review: checks the pending changes on your branch for security problems. It needs a Git remote named origin.

Sessions and status#

  • /clear: starts a new conversation with empty context; /reset and /new do the same.
  • /resume: reopens an earlier session by name or from a list.
  • /rename: gives the current session a name you can find later.
  • /status: shows the version, model, account and connection.
  • /usage: shows the session's cost and your plan's usage limits. /cost and /stats are other names for it.
  • /doctor: a built-in skill that checks your setup and proposes fixes, which Claude applies once you confirm.
  • /help: lists the commands available to you.

Which CLI commands and flags matter?#

CommandWhat it does
claudeStarts an interactive session in the current folder
claude "query"Starts a session with a first prompt
claude -p "query"Answers once in print mode, then exits
claude -cContinues the most recent conversation in this folder
claude -r "name" "query"Resumes a session by name or ID
claude updateUpdates Claude Code to the latest version
claude doctorChecks the install and settings without starting a session
claude mcpConfigures MCP servers

The flags you'll reach for most:

  • --model: picks the model for this session. It wins over the model setting and over ANTHROPIC_MODEL.
  • --permission-mode: starts in a given mode, such as plan or acceptEdits.
  • --add-dir: lets Claude work in more folders, such as claude --add-dir ../apps ../lib.
  • -n or --name: names the session, such as claude -n "auth-refactor", so claude -r "auth-refactor" finds it later.
  • --output-format json: returns print-mode output as JSON for scripts.
  • --max-turns: caps how many agent turns print mode takes, such as claude -p --max-turns 3 "query".
  • --allowedTools: lists tools that run without asking, such as "Bash(git diff *)" "Read".

Which keyboard shortcuts save time?#

KeyWhat it does
/Opens the list of commands and skills
!Runs a shell command (shell mode)
@Mentions a file, with path completion
EscStops Claude and keeps the work done so far
Esc EscClears the draft, or opens the rewind menu on an empty prompt
Shift+TabCycles the permission modes
Ctrl+CClears the input or interrupts; press twice to exit
Ctrl+RSearches your prompt history
Ctrl+OOpens the transcript viewer
?Shows the shortcuts, on an empty prompt

For a new line without sending, Ctrl+J works in any terminal, and Shift+Enter works natively in Windows Terminal, iTerm2, Apple Terminal, WezTerm, Ghostty, Kitty and Warp. On some Windows setups the permission-mode key is Alt+M instead of Shift+Tab.

Shell mode adds the command and its output to the conversation, and Claude replies to it automatically, which costs the same as a normal prompt. To turn the reply off, set respondToBashCommands to false in your settings.

How do the commands fit together?#

  1. Start in your project#

    Open a terminal in the project folder and run claude. Run /init once, so Claude writes a CLAUDE.md that describes the project.

  2. Plan the change#

    Type /plan and the task. Claude proposes a plan before it edits any file, and starts once you approve it.

  3. Keep the context small#

    Check /context on long tasks. Run /compact when it fills up, or /clear when you move to an unrelated task.

  4. Check and ship#

    Look over the edits with /diff, ask for a /review, and use /rewind if a change went wrong.

Print mode for scripts#

Print mode answers once and exits, so it fits scripts, Git hooks and CI. You can pipe text into it:

Terminal
git diff | claude -p "Write a commit message for these changes"
cat error.log | claude -p "Explain the likely cause" --output-format json
claude -c -p "Check for type errors"

Print mode reads the same settings file as a normal session, so it uses the same key and model.

How do you add your own commands?#

Your own command is a skill: a folder with a SKILL.md file inside. The folder name becomes the command, so .claude/skills/fix-issue/SKILL.md creates /fix-issue.

  • Personal: ~/.claude/skills/<name>/SKILL.md works in every project.
  • Project: .claude/skills/<name>/SKILL.md lives in the repository, so your team gets it through Git.
  • Older format: files such as .claude/commands/deploy.md keep working and create /deploy too.

Save this as .claude/skills/fix-issue/SKILL.md for a command that fixes a GitHub issue:

Text
---
description: Fix a GitHub issue by number
disable-model-invocation: true
---

Fix GitHub issue $ARGUMENTS.

Read the issue, find the cause, make the fix, add a test, then run the test suite.

Type /fix-issue 123 and Claude Code puts 123 where $ARGUMENTS stands; $0 and $1 pick single arguments in order. With disable-model-invocation: true, the command runs only when you type it. Without it, Claude can also start the skill by itself when a task fits its description. /skills lists everything you have, and MCP servers can add their own prompts as commands.

Do the commands work with an API key?#

Yes. 5abeer is an independent service compatible with the Anthropic Messages API, so every command above runs exactly as Anthropic ships it. Only the base URL and the key change, in ~/.claude/settings.json:

{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.5abeer.ai",
    "ANTHROPIC_AUTH_TOKEN": "YOUR_5ABEER_API_KEY",
    "ANTHROPIC_MODEL": "claude-sonnet-5.5"
  }
}

~/.claude/settings.json

Create the key in your dashboard first (how to create a key). Then run /status: the Anthropic base URL line should show the 5abeer address.

Two things work differently with a key:

  • Spend: /usage shows Claude Code's own estimate. Your real charges are in the dashboard (usage and balance).
  • Account commands: /login, /logout and claude setup-token are for Claude accounts, and claude setup-token needs a Claude subscription. With a key in the settings file, you don't need them.

You can run Claude Code on 5abeer in two ways:

  • An API key, paid as you go. Pay per token from your balance, and give every key a spend limit, an expiry date and an IP allow-list (key controls). Claude prices are on the Claude API page.
  • A 5abeer plan. The 5abeer AI app turns on Claude Code for your plan (what each plan runs). Plans are for the supported apps. To call the models from your own code, create an API key. See the pricing page and the Claude Code app page.

If a request is refused with a code, INVALID_API_KEY means the key is wrong or deleted, and INSUFFICIENT_BALANCE means your balance doesn't cover the request. Every code is in Errors and fixes, and every setting is on the Claude Code docs page.

Questions#

How do I see every command?#

Type / at the start of the prompt, or run /help. Both show the commands and skills in your version. For terminal flags, run claude --help, and check the CLI reference for the flags it leaves out.

What is the difference between /clear and /compact?#

/clear starts a new conversation with empty context, and the old one stays available in /resume. /compact keeps the same conversation but replaces its history with a summary. Use /compact to keep going on a long task, and /clear when you switch to something unrelated.

How do I undo a change Claude made?#

Run /rewind, or press Esc twice on an empty prompt, and pick the point to go back to. You can restore the code, the conversation or both. Treat it as a quick undo and keep using Git for your history.

How do I return to an earlier session?#

Run claude -c to continue the latest conversation in the folder, or claude -r "name" to open a named one. Inside Claude Code, /resume shows a list.

Which commands use my balance?#

Anything that sends a prompt to the model: your messages, /init, /compact, /review, /btw, /doctor, your own skills and Claude's reply after a ! shell command. Settings and viewer commands such as /config, /diff and /help run on your machine.

Which model should I pick?#

Start with the default model, claude-sonnet-5.5, which handles most coding tasks. Move to claude-opus-5.5 or claude-fable-5.1 for the hardest problems. Switch inside Claude Code with /model, or for one session with --model. The full list with prices is on the models page.

Sources#

Checked on 2026-11-01:

Get started#

Set up the editor version in Claude Code in VS Code, install it with Install Claude Code on Windows, or compare costs in The cheapest way to use Claude Code.