How slash commands work
Slash commands are typed at the very start of a message in Claude Code. When you begin a message with /, Claude Code intercepts the input and either routes it to a built-in handler or loads the corresponding skill into context before passing your full message to the model.
Built-in commands are always available — no installation required. They are compiled into Claude Code itself and handle core session management tasks like clearing context, checking costs, or switching models.
Skill commands become available after you run npx skills add. Each installed skill registers its name as a slash command. When you type that command, Claude Code automatically prepends the skill's instructions to your message, shaping how the model responds.
The syntax is the same for both:
/command [optional args]
For example, /compact needs no argument, while /model claude-opus-4-5 takes the model name as an argument. Skill commands accept free-form natural language: /frontend-design build a dark dashboard layout.
Built-in slash commands
These commands ship with every Claude Code installation and are available in all sessions without any additional setup.
| Command | What it does | Example |
|---|---|---|
/help |
Shows available commands and shortcuts | /help |
/clear |
Clears conversation context entirely | /clear |
/compact |
Compresses context to save tokens while preserving key information | /compact |
/config |
Opens the Claude Code settings panel | /config |
/cost |
Shows token usage and estimated cost for the current session | /cost |
/doctor |
Diagnoses Claude Code installation issues and environment problems | /doctor |
/exit or /quit |
Ends the current session | /exit |
/init |
Creates a CLAUDE.md file for the current project with auto-detected context |
/init |
/memory |
Manages persistent memory entries across sessions | /memory |
/model |
Switches the AI model mid-session without restarting | /model claude-opus-4-5 |
/permissions |
Manages which tool permissions are active in the current session | /permissions |
/review |
Reviews the current pull request (requires GitHub access) | /review |
/status |
Shows session status: model, context usage, active tools | /status |
/vim |
Enables vim keybindings in the Claude Code input | /vim |
Skill slash commands
When you install a Claude Code skill using npx skills add, the skill's name is automatically registered as a slash command. The next time you open a Claude Code session, that command appears in /help and in autocomplete.
For example, installing the frontend-design skill makes /frontend-design available. Invoking it loads the skill's full instructions into context before Claude processes your request — giving you a specialized, focused response tuned to that workflow.
# 1. Install the skill globally
npx skills add anthropics/skills@frontend-design -g -y
# 2. In any Claude Code session, invoke it
/frontend-design build a responsive pricing page with dark mode
Here are eight popular skill slash commands from the directory:
Find the full list of curated skills — each with an install link — in the skills directory. See also: how to install skills.
Tips for effective slash command usage
Slash commands work best when combined with specific, contextual instructions. Here are the patterns that consistently produce better results.
Combine commands with context
Don't just invoke a skill — tell it what you're working on. Adding file names, function signatures, or a brief description of the problem means the skill instruction and your context arrive together in a single focused prompt:
# Less effective — vague
/systematic-debugging fix the bug
# More effective — specific context
/systematic-debugging the auth middleware in src/middleware/auth.ts
is returning 401 on valid tokens issued after the key rotation last week
Use /compact before long tasks
Before starting a multi-step task — refactoring a module, writing a full feature, or doing a thorough audit — run /compact first. This compresses earlier conversation turns into a summary, freeing up context window space for the work ahead without losing the thread of what you've discussed.
Use /model to switch to Opus for complex reasoning
Claude Code defaults to a fast model for everyday work, but some tasks benefit from the deeper reasoning of Claude Opus. Switch mid-session without losing context:
# Switch to Opus for a complex architectural decision
/model claude-opus-4-5
# Switch back to the default for faster iteration
/model claude-haiku-4-5
Chain commands across a session
You can use different slash commands at different points in the same session. Start with /writing-plans to produce a structured plan, then use /test-driven-development to implement it with proper test coverage, then run /security-review on the diff before committing. Each command shapes only the message it precedes.
Find more slash commands with /help
The /help command is always up to date. It shows every built-in command for your current Claude Code version plus every skill command registered in your environment. Skill commands appear automatically after install — there's no manual registration step.
To expand what appears in /help, install more skills from the directory. To build your own slash command, write a SKILL.md and follow the skill authoring guide.
FAQ
Where can I see all my installed skill commands?
Type /help in any Claude Code session. It shows a live list of every available command, including slash commands added by installed skills. The list updates automatically as you install or remove skills.
Can I create custom slash commands?
Yes. Write a skill with a SKILL.md file and place it in ~/.claude/skills/my-skill/ (global) or .claude/skills/my-skill/ (project). Claude Code registers /my-skill as a slash command automatically. See the guide on writing a Claude Code skill for full details.
Do slash commands work in VS Code extension?
Yes. Slash commands — both built-in and skill-based — work in the Claude Code VS Code extension's chat panel. Global skills installed via npx skills add -g are available automatically without any extra configuration.
What's the difference between /clear and /compact?
/clear wipes the conversation history entirely, starting a fresh context window. /compact compresses the existing conversation into a shorter summary, preserving useful context while reducing token usage. Use /compact before long tasks; use /clear when you want a completely fresh start.