How to Use Slash Commands in Claude Code
Slash commands are your shortcuts to everything in Claude Code. Type one character and access session management, configuration, analytics, and custom automations.
Slash commands in Claude Code are shortcuts you trigger by typing / followed by a command name. The most essential ones are /init (create project memory), /model (switch AI models), /cost (check usage), /clear (reset conversation), and /resume (continue a previous session). You can also create custom slash commands using Skills.
This guide covers every built-in slash command organized by what you're trying to do, so you can stop copy-pasting and start working faster.
How Slash Commands Work
Type / at the start of a line. A menu appears with all available commands. Start typing to filter, then press Enter to select.
That's it. No special syntax to memorize.
Quick tip: You don't need to type the full command. /res followed by Enter will run /resume if it's the first match in the list.
The 5 Commands Everyone Should Know
If you learn nothing else, learn these five:
/init
Creates a CLAUDE.md file for your project. Claude reads this file automatically and remembers your preferences across sessions. Run this once per project.
/model
Switch between AI models. Use sonnet for everyday work, haiku for quick questions, opus for complex reasoning. Example: /model haiku. With Opus 4.6, you can also use left/right arrows to adjust the effort level after selecting the model.
/cost
See how many tokens you've used and what it costs. Essential for tracking usage if you're on a paid plan.
/clear
Reset your conversation without exiting Claude Code. Useful when you're starting a completely different task.
/resume
Continue a previous conversation. Opens a picker where you can search, preview, and select past sessions.
All Slash Commands by Category
Session Management
| Command | What It Does |
|---|---|
/resume |
Open picker to browse and resume past sessions |
/resume name |
Resume a specific session by name |
/continue |
Resume your most recent session (same as claude --continue) |
/rename name |
Give current session a memorable name |
/clear |
Clear conversation history, keep session ID |
/export |
Export conversation to file or clipboard |
/rewind |
Undo changes, go back in conversation or summarize from a point |
/teleport |
Resume a remote session from claude.ai (subscribers only) |
/exit |
Exit Claude Code |
Session naming tip
Use /rename early when starting a distinct task. Names like "auth-refactor" or "payment-bug" make it easy to find sessions later with /resume.
Configuration
| Command | What It Does |
|---|---|
/config |
Open settings interface |
/model |
Switch AI model (sonnet, opus, haiku) |
/theme |
Change terminal color theme |
/permissions |
View or update tool and file permissions |
/allowed-tools |
Configure tool permissions interactively |
/vim |
Enable vim-style text editing |
/terminal-setup |
Install terminal shortcuts (Shift+Enter, etc.) |
/install-github-app |
Set up GitHub Actions integration for Claude |
Development Tools
| Command | What It Does |
|---|---|
/init |
Create CLAUDE.md for your project |
/memory |
Edit your CLAUDE.md files |
/plan |
Enter plan mode (read-only analysis) |
/mcp |
Manage MCP server connections and OAuth authentication |
/agents |
Create, edit, list, and manage subagents |
/hooks |
View, add, and delete hooks interactively |
/debug |
Troubleshoot the current session by reading the debug log |
Monitoring & Analytics
| Command | What It Does |
|---|---|
/cost |
Show token usage and costs |
/usage |
Show plan limits (subscribers only) |
/stats |
Daily usage, session history, streaks |
/context |
Visual display of context usage |
/status |
Version, model, account, and connectivity info |
/statusline |
Set up Claude Code's status line UI in your terminal |
Utilities
| Command | What It Does |
|---|---|
/compact |
Compress conversation to free context |
/copy |
Copy last response to clipboard |
/help |
Show help information |
/doctor |
Check installation health |
/todos |
List current TODO items |
/tasks |
List background tasks |
Commands That Take Arguments
Most commands work by themselves, but some accept parameters:
/resume auth-project # Resume specific session
/rename payment-integration # Name current session
/model opus # Switch to Opus model
/export notes.md # Export to specific file
/compact Keep test details # Compact with instructions
The /compact command is especially useful. It compresses your conversation history to free up space, and you can tell it what to preserve:
/compact Keep the implementation approach, summarize exploration
Creating Your Own Slash Commands
This is where Claude Code gets powerful. You can create custom commands that run your own instructions.
Skills and commands are now unified: As of Claude Code v2.1.3, custom slash commands have been merged into the skills system. A file at .claude/commands/review.md and a skill at .claude/skills/review/SKILL.md both create /review and work the same way. Your existing .claude/commands/ files keep working, but skills are recommended since they support additional features like supporting files and auto-invocation by Claude.
Step 1: Create a Skills Folder
mkdir -p ~/.claude/skills/my-command
The folder name becomes your command. So my-command creates /my-command.
Step 2: Create SKILL.md
Inside that folder, create a file called SKILL.md:
---
name: my-command
description: What this command does
---
Instructions for Claude go here.
When someone runs /my-command, Claude follows these instructions.
Step 3: Use It
That's it. Type /my-command in Claude Code and it runs.
Real Example: Code Review Command
Create ~/.claude/skills/review/SKILL.md:
---
name: review
description: Review recent code changes for quality issues
---
Review the most recent changes:
1. Run `git diff main` to see changes
2. Check for security issues (hardcoded secrets, input validation)
3. Check for performance problems (N+1 queries, missing indexes)
4. Verify test coverage
Report findings as:
- Critical (must fix)
- Warnings (should fix)
- Suggestions (nice to have)
Now /review runs your custom code review process.
Passing Arguments to Custom Commands
Use $ARGUMENTS or $0, $1 etc. in your SKILL.md:
---
name: fix-issue
description: Fix a GitHub issue by number
---
Fix GitHub issue #$0:
1. Read the issue
2. Implement the fix
3. Write tests
4. Create a commit
Use it: /fix-issue 123
Keyboard Shortcuts
Related shortcuts that work alongside slash commands:
| Shortcut | Action |
|---|---|
/ |
Open slash command menu |
@ |
Reference a file in your prompt |
! |
Run a shell command directly |
Shift+Tab |
Cycle through permission modes (Normal, Auto-Accept, Plan) |
Ctrl+C |
Cancel current operation |
Ctrl+D |
Exit Claude Code |
Ctrl+G |
Open prompt in your default text editor |
Ctrl+O |
Toggle verbose output (detailed tool usage) |
Ctrl+B |
Background running tasks (agents, bash commands) |
Ctrl+T |
Toggle task list view |
Ctrl+R |
Reverse search through command history |
Esc Esc |
Rewind or summarize from a selected message |
Option+P |
Switch model without clearing your prompt |
Option+T |
Toggle extended thinking mode |
Common Mistakes
- Forgetting /init: Always run
/initwhen starting a new project. It creates your CLAUDE.md and saves you from repeating context. - Not naming sessions: Use
/renameearly. You'll thank yourself when you need to find that session later. - Ignoring /context: Your conversation has limited space. Check
/contextregularly and use/compactbefore hitting the limit. - Using wrong model: Use
/model haikufor quick questions and/model opusfor complex problems. Default to sonnet. The latest models are Claude Opus 4.6, Claude Sonnet 4.5, and Claude Haiku 4.5. - Custom command not showing: Check that your folder is in
~/.claude/skills/and the file is exactly namedSKILL.md. Also check that you haven't exceeded the skill description budget (2% of context window).
FAQ
How do I see all available commands?
Type / and the menu shows everything—built-in commands, your custom commands, and MCP commands from connected servers.
Can I run slash commands from the command line?
Some have CLI equivalents. claude --continue is the same as /continue. claude --model opus sets the model. Check claude --help for options.
What's the difference between /clear and /compact?
/clear erases everything and starts fresh. /compact compresses the history while keeping a summary. Use /compact when you want to preserve context but free up space.
My custom command doesn't appear. What's wrong?
Four things to check: (1) folder is in ~/.claude/skills/ or .claude/skills/, (2) file is named exactly SKILL.md, (3) folder name uses lowercase and hyphens (no spaces), (4) you haven't exceeded the skill description character budget. Run /context to check for a warning about excluded skills.
Related Guides
- How to Use CLAUDE.md Files — the configuration /init creates
- How to Use Plan Mode — what /plan does
- What Is Claude Code? — the basics
Like Claude Code? Meet Your Chief AI Officer
Watch me build a complete website using only plain English—no coding required. Then try it yourself.
Get the Free Blueprint href="/blueprint">Watch the Free Setup Video →rarr;