Slash commands

Claude Code · Essentials · 8 min

Commands are the fastest way to manage context, models and configuration without leaving the conversation.

Text you type normally is a prompt for Claude. Text that starts with / at the beginning of a message is a command for Claude Code itself. Type / alone to see a filterable menu of everything available, including custom commands you or your plugins add.

Commands you will use constantly:

  • /help: list commands.
  • /init: generate a starter CLAUDE.md instruction file for the project.
  • /model: switch the model (for example a faster one for simple work, a stronger one for hard problems); /effort adjusts how much the model thinks.
  • /clear: start a fresh conversation with empty context.
  • /compact [focus]: summarize the conversation so far to free space, optionally saying what to keep.
  • /context: show what is filling the context window.
  • /usage (alias /cost): token usage, session cost estimate and plan limits.
  • /rewind: restore code and/or conversation to an earlier checkpoint.
  • /resume: reopen an earlier conversation.
  • /permissions, /memory, /mcp, /hooks, /plugin, /skills: open the manager for each feature covered later.
  • /diff: review changes in your working tree.
  • /doctor: diagnose installation and configuration problems.

Text after the command name becomes its argument: /compact keep the API decisions or /model sonnet. If you send a command while Claude is busy, it usually waits until the current turn ends, though some, like /usage, run right away.

You can also ask Claude about itself in plain language: "how do I add an MCP server?" It knows its own documentation.

Example

> /init                         # draft CLAUDE.md from the codebase
> /model                        # open the model picker
> /context                      # see what's using the context window
> /compact focus on the API changes and open TODOs
> /usage                        # tokens, cost estimate, plan limits
> /clear                        # fresh context for an unrelated task
> /resume                       # pick an earlier conversation

Remember

  • A / at the start of a message is a command for Claude Code, not a prompt
  • /clear, /compact and /context manage the context window
  • /model, /usage, /rewind and /resume cover models, cost and history

Watch out for

  • Typing a command in the middle of a sentence; it is only recognized at the start of the message.

Check yourself

  1. You finished a bug fix and want to start an unrelated feature with no leftover context. Which command?

Sign in to answer, see the explanations, and get this lesson back as a quick review later.

Official docs: code.claude.com/docs/en/commands