Claude Code Built-in Slash Commands Reference for 2026
Last updated: April 15, 2026
Claude Code Built-in Slash Commands
Quick answer
Claude Code ships with about a dozen built-in slash commands that control session state, context, cost, and model choice. Type / at the start of any prompt to see the full list. The most used commands are /help, /compact, /clear, /cost, /status, /model, /memory, and /doctor. Custom skills appear alongside built-ins in the same menu.
How slash commands work
Slash commands are intercepted by the Claude Code client before the prompt is sent to the model, which means they run locally without consuming any tokens and without a network roundtrip to the Anthropic API, so /clear is instant, /model switches models without a call out, /status works even when your internet is down, and /cost reads from local session logs rather than polling a billing endpoint; this local-first design is also why custom skills at ~/.claude/skills/ load in under 50 milliseconds and why the completion menu appears before you finish typing the slash.
Once a command finishes, the next prompt you type resumes normal conversation. Some commands like /compact produce output that becomes part of the new context; others like /status print to your terminal only.
Command-by-command reference
/help
Lists every available command, built-in and custom. The output includes the command name, a short description, and any required arguments.
/help
Useful when you forget a command name or want to discover new ones after an update.
/compact
Summarizes the current conversation into a short context block and starts fresh with that summary as the new baseline. The full history is replaced by the summary, so token cost per turn drops back to near-zero.
/compact
When to use it:
- Context has grown above 80,000 tokens and turns feel slow.
- You are switching to a related but distinct task in the same session.
- You want to preserve key decisions but discard exploration noise.
The summary itself costs one model call, usually 1,000-3,000 output tokens depending on conversation length.
An optional argument focuses the summary:
/compact focus on the database schema changes
Everything not related to the focus is dropped.
/clear
Wipes the conversation context without summarizing. The session is identical to a fresh claude launch but keeps your settings, model choice, and permission mode.
/clear
Use /clear instead of /compact when you are starting a completely unrelated task. No summarization cost, no stale context.
/memory
Manages the persistent memory file at ~/.claude/memory/MEMORY.md. Memory is a set of facts Claude carries across every session.
Subcommands:
/memory: shows the current memory file./memory add: appends a fact. Example:/memory add My primary editor is Neovim with LazyVim./memory clear: removes entries matching a string./memory edit: opens the file in $EDITOR.
Memory is for stable preferences: editor choice, test runner, deployment tool, keyboard layout. For session-specific context, use the prompt.
/cost
Shows token usage and estimated cost for the current session. Output format:
Input tokens: 124,000
Output tokens: 8,200
Cache hits: 92,000
Estimated cost: $0.51
Cost is computed from the current model's published rates. If you switched models mid-session, the total reflects each segment separately.
/status
Prints session metadata: current model, permission mode, loaded CLAUDE.md files, attached MCP servers, and active hooks. Useful for diagnosing "why does Claude not know about X" issues.
/status
/model
Switches the active model for the rest of the session. Pass the model ID as an argument.
/model claude-opus-4-5
/model claude-sonnet-4-5
/model claude-haiku-4-5
Typing /model without an argument shows the current model and a menu of available models.
Switching mid-session is common: use Opus for planning a hard task, then switch to Sonnet for execution. Cost savings can be 70-80% over running Opus the whole way.
/permissions
Shows the active permission configuration: allowedTools, deniedTools, and the current permission mode. Combines values from ~/.claude/settings.json, project settings.json, and any command-line flags.
/permissions
If you want to adjust permissions at runtime, edit settings.json or relaunch with --allowedTools and --deniedTools flags.
/doctor
Runs a diagnostic check on your setup. Reports:
- Installed Claude Code version and whether it is the latest.
- Node.js version.
- Presence and validity of
ANTHROPIC_API_KEY. - Reachability of the Anthropic API endpoint.
- MCP server startup success.
- settings.json syntax errors.
/doctor
Run /doctor first whenever something feels broken. It usually surfaces the cause within seconds.
/init
One-shot helper that scans your repo and writes a starter CLAUDE.md based on what it finds. Safe to run in any repo; it shows a diff before writing.
/init
Good for the first session in a new repo. Review the generated file and tighten rules afterward.
/review
Reviews a PR by number or URL. Fetches the diff, loads the context, and outputs structured feedback.
/review 123
/review https://github.com/org/repo/pull/123
The default review checklist covers correctness, edge cases, tests, and naming. Customize by editing the skill at ~/.claude/skills/review.md.
/insights
Summarizes your Claude Code usage over recent sessions: most used tools, total cost, average session length, and common themes in prompts. Good for budget reviews.
/insights
Data is read from local session logs at ~/.claude/logs/. No data leaves your machine.
/compact versus a fresh session
Both reset context, with different tradeoffs:
/compact: preserves the spirit of the conversation by producing a summary. Costs one extra model call. Best when you want to keep going on the same problem with less baggage.- Fresh session (
claudeagain, or/clear): wipes everything. Zero cost. Best when the next task is unrelated.
A quick heuristic: if the next prompt would benefit from the summary, use /compact. If the next prompt stands on its own, use /clear.
The /memory workflow
Memory is a hand-maintained list of facts about you or your setup. Treat it like a personal CLAUDE.md that applies across every project.
Starter memory entries worth adding:
- Primary editor and any plugins Claude should know about.
- Package manager preference (pnpm, npm, yarn, bun).
- Default test runner.
- Time zone for any date-sensitive task.
- Git identity (name and email) so Claude generates the right
Author:lines.
Review memory every few months with /memory. Remove stale entries with /memory clear . Old memory can silently bias decisions long after the underlying context has changed.
Custom skills in the same menu
Any markdown file in ~/.claude/skills/ or .claude/skills/ shows up in the / menu next to built-ins. The sort is alphabetical; built-ins and custom commands are not visually separated. Name your skills clearly so they do not conflict with future built-in names.
The skills page covers file format and argument passing in detail.
Commands in headless mode
When launching with --print for CI or scripts, slash commands still work but only a few make sense:
--print "/cost": print the session cost and exit.--print "/status": print session info and exit.
Most commands assume an interactive session and produce no useful output in --print mode.
Three quick tips
- Put the commands you use every day into muscle memory.
/cost,/compact,/status,/modelcome up multiple times per session. - Run
/doctorfirst when something feels off. It catches 80% of setup issues. - Do not over-rely on memory. Per-repo rules belong in that repo's CLAUDE.md, not in your global memory file, because team members benefit when rules are shared in the repo.
Frequently asked questions
How do I see all available slash commands?
Type `/` at the start of any prompt to open the completion menu, or run `/help` to print the full list. Built-in commands and custom skills appear together, sorted alphabetically.
What is the difference between /clear and /compact?
/clear wipes the context entirely and costs nothing. /compact summarizes the conversation first, then resets with the summary as the new baseline, costing one model call but preserving key decisions.
How does memory persist across sessions?
Memory is stored in `~/.claude/memory/MEMORY.md` and read into every session automatically. Manage it with `/memory add <fact>`, `/memory clear <pattern>`, or `/memory edit` to open the file in your editor.
Does /cost include all messages in the session?
Yes. /cost reports cumulative input tokens, output tokens, cache hits, and the estimated dollar cost based on the current model's rates. Model switches are accounted for separately in the total.
How do I switch models mid-session?
Run `/model <model-id>`, for example `/model claude-opus-4-5` or `/model claude-sonnet-4-5`. Typing `/model` with no argument shows the current model and a menu of options.
Do slash commands work in headless mode?
Some do. `--print "/cost"` and `--print "/status"` return useful output and exit. Most interactive commands like `/compact` or `/model` assume a running session and produce no meaningful output in print mode.