Skip to content

Slash Commands & Shortcuts

Claude Code has a set of built-in slash commands and keyboard shortcuts that make your workflow faster. These are worth memorizing early — they’ll save you time on every session.

Type / in the Claude prompt to see all available commands:

CommandDescription
/clearClear conversation history and start fresh
/compactCompress the conversation to save context window space
/continueContinue the last conversation
/costShow token usage and estimated cost for this session
CommandDescription
/modelSwitch the active model (Opus, Sonnet, Haiku)
/memoryView and manage Claude’s persistent memories
/helpShow help and available commands
CommandDescription
/commitStage and commit changes with an AI-generated message
/reviewReview code changes

Beyond built-ins, you can use Skills — custom slash commands that expand into full prompts. We’ll cover these in depth in the Skills module, but here’s a preview:

/commit → Stage and commit with a good message
/review-pr 123 → Review pull request #123
/simplify → Review changed code for quality issues
ShortcutAction
EnterSend message
Shift+EnterNew line
Up ArrowRecall previous message
TabAutocomplete file paths
Ctrl+CCancel current generation
Ctrl+DExit Claude Code
EscapeCancel current input

When Claude is executing tool calls:

ShortcutAction
y or EnterApprove the tool call
nDeny the tool call
EscapeStop generation

The /compact command deserves special attention. It compresses your conversation while preserving key context. Use it when:

  • Your session is getting long and responses slow down
  • Claude starts forgetting earlier context
  • You’ve changed topics within a session
  • You see a warning about approaching context limits

You can also add a message to guide the compression:

/compact focus on the authentication refactor we've been doing
  1. Start a Claude session
  2. Use /model to see available models
  3. Ask Claude to create a simple file
  4. Use /cost to check token usage
  5. Use /compact to compress the conversation
  6. Use /cost again — notice the reduced context