Slash Commands
User-invoked shortcuts for common workflows
Prerequisites
- Basic Claude Code usage
What You'll Learn
- Understand how slash commands work
- Know the built-in commands available
- Create custom commands for your workflows
- Use command arguments effectively
Common Built-in Commands
/compactSummarize conversation to free up context space
/reviewCode review of changes with feedback and suggestions
/costShow current token usage and costs for the session
/modelSwitch between Claude models (Opus, Sonnet, Haiku)
/doctorDiagnose and fix common Claude Code issues
/clearClear conversation history and start fresh
Type /help to see all 35+ built-in commands including /agents, /hooks, /mcp, /plugin, /security-review, and more.
How Slash Commands Work
/deployYou type
.claude/commands/deploy.md
Expanded to Claude
Slash commands are user-invoked—you explicitly type them to trigger the workflow. This is different from Skills, which Claude automatically discovers and uses based on context.
Where Commands Come From
Claude Code core35+ commands that come with Claude Code.claude/commands/Your own commands for project workflows/plugin-name:commandCommands provided by installed plugins/mcp__server__promptPrompts exposed by MCP serversCreating Custom Commands
Create commands by adding markdown files to .claude/commands/:
# .claude/commands/deploy.md
---
description: Deploy to production
argument-hint: <environment>
---
Deploy to $ARGUMENTS (default: production):
1. Run tests to ensure everything passes
2. Build the production bundle
3. Deploy using the deploy script
4. Verify deployment is liveNow /deploy staging expands the full prompt with "staging" substituted for $ARGUMENTS.
⚡ Commands vs Skills
Slash Commands
- •User-invoked: You type /command
- •Location: .claude/commands/
- •Simple markdown files
- •You must remember the command
Skills
- •Model-invoked: Claude uses automatically
- •Location: .claude/skills/
- •Can include supporting files
- •Discovered by semantic matching
💡 Pro Tips
- 1.Type
/and wait—autocomplete shows all available commands with descriptions. - 2.Use
$ARGUMENTS,$1,$2in custom commands to accept parameters. - 3.Personal commands go in
~/.claude/commands/, project commands in.claude/commands/. - 4.Commands from plugins use the format
/plugin-name:command.
Master Claude Code faster
Get notified when new animated guides are released.
Subscribe to the newsletter