Claude Code slash commands are shortcuts starting with / that control your session or run common tasks in one go. There are dozens of built-in commands like /help, /clear, and /compact, and you can save frequently used prompts as Markdown files to build your own custom commands. (As of June 2026 · Official: docs.anthropic.com/claude-code/slash-commands)
What slash commands are
Slash commands are /-prefixed shortcuts that control Claude's behavior in an interactive session. There are two kinds — built-in commands that ship with Claude Code, and custom commands you define. Just type / in the input and available commands appear as autocomplete.
Common built-in commands
There are dozens of built-in commands depending on version (see the full list with /help). Common ones:
/help— list available commands with descriptions/clear— clear conversation context/compact— summarize and compress a long context/model— choose the model to use/config— view/change settings/init— analyze the codebase and generate CLAUDE.md/review— review code/cost— check token usage/cost/mcp— connect/manage MCP servers/agents— manage sub-agents
Creating custom commands
Save a frequently used prompt as a Markdown file and it becomes a command. The filename (without .md) is the command name. There are two locations:
- Project commands —
.claude/commands/. Stored in the repo and shared with your team via git (shown as "(project)" in /help). - Personal commands —
~/.claude/commands/. Available across all projects on your machine.
For example, put "Analyze this code for performance issues and suggest optimizations" in .claude/commands/optimize.md, and call it later with /optimize. You can also namespace via directory structure (e.g., /test/add-edge-cases).
Passing arguments
To pass values, use placeholders. $ARGUMENTS captures all arguments; $1, $2 capture by position. For example, with "Fix issue #$ARGUMENTS" in the file, /fix-issue 123 expands to "Fix issue #123" and runs.
Frontmatter options
You can add metadata wrapped in --- at the top of a command file. Key fields are description, allowed-tools, argument-hint, and model. Pinning a model on critical commands keeps behavior stable when defaults change (though specific model IDs themselves can change over time).
Things to know
- They use tokens — slash commands aren't free shortcuts; they consume tokens when run.
- Merged into Skills (in progress) — per recent guidance, custom slash commands have been merged into Skills. Files in
.claude/commands/still work, but.claude/skills/(Skills) is now the recommended approach (in progress, subject to change). - MCP & plugin commands — prompts from connected MCP servers appear as
/mcp__server__prompt, and plugin commands as/plugin:command. - Name collisions — built-in commands take precedence over a same-named custom one. Pick names that don't collide.
Related
- How-to-use guide — using it after install
- Claude Code Skills — extend with SKILL.md
- CLAUDE.md guide — generated by /init
- What is Claude Code? — intro
Disclaimer: This article is based on Anthropic's official Claude Code docs (docs.anthropic.com·code.claude.com). The number and list of built-in commands vary by version — check with /help. Structural changes such as custom slash commands merging into Skills are reportedly in progress (subject to change), and model IDs and exact syntax may change over time. Check the official docs for the latest. This site is not affiliated with Anthropic.