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.
Built-in Slash Commands
Section titled “Built-in Slash Commands”Type / in the Claude prompt to see all available commands:
Session Management
Section titled “Session Management”| Command | Description |
|---|---|
/clear | Clear conversation history and start fresh |
/compact | Compress the conversation to save context window space |
/continue | Continue the last conversation |
/cost | Show token usage and estimated cost for this session |
Configuration
Section titled “Configuration”| Command | Description |
|---|---|
/model | Switch the active model (Opus, Sonnet, Haiku) |
/memory | View and manage Claude’s persistent memories |
/help | Show help and available commands |
Workflow
Section titled “Workflow”| Command | Description |
|---|---|
/commit | Stage and commit changes with an AI-generated message |
/review | Review code changes |
Custom Slash Commands (Skills)
Section titled “Custom Slash Commands (Skills)”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 issuesKeyboard Shortcuts
Section titled “Keyboard Shortcuts”In the Prompt
Section titled “In the Prompt”| Shortcut | Action |
|---|---|
Enter | Send message |
Shift+Enter | New line |
Up Arrow | Recall previous message |
Tab | Autocomplete file paths |
Ctrl+C | Cancel current generation |
Ctrl+D | Exit Claude Code |
Escape | Cancel current input |
During Tool Execution
Section titled “During Tool Execution”When Claude is executing tool calls:
| Shortcut | Action |
|---|---|
y or Enter | Approve the tool call |
n | Deny the tool call |
Escape | Stop generation |
The Power of /compact
Section titled “The Power of /compact”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 doingExercise
Section titled “Exercise”- Start a Claude session
- Use
/modelto see available models - Ask Claude to create a simple file
- Use
/costto check token usage - Use
/compactto compress the conversation - Use
/costagain — notice the reduced context