A slash command is an instruction like /clear or /compact, typed at the start of a Claude Code message. Some of them are skills bundled with the tool, and you can write your own in the same format. Type / to see the ones available to you. This reference covers version 2.1.330.
Claude Code slash commands: a practical reference
Thomas Poulain · · Updated
How Claude Code reads a slash command
Claude Code only recognizes a command at the very start of your message. Whatever follows the name becomes its arguments, as in /compact keep the API decisions. If you write /deploy in the middle of a sentence, nothing runs directly. The name then counts as permission, and Claude may run that skill while it responds.
A command you send while Claude is responding waits until the turn ends. Some, such as /status, /tasks and /usage, run right away.
Bundled skills such as /code-review, /simplify or /loop are prompts that Claude carries out with its tools. The official commands reference tags them “Skill”. Since v2.1.326, /help <command> shows the usage of one specific command.
Which commands keep your context clean?
| Command | What it does in v2.1.330 |
|---|---|
/context [all] | Shows context usage as a colored grid, with suggestions for trimming it |
/compact [instructions] | Summarizes the conversation to free up room, following your focus instructions if you give any |
/clear [name] | Starts a new, empty conversation. The name labels the old one in /resume. Aliases /reset and /new |
/rewind | Rolls code and conversation back to a checkpoint, or summarizes from a chosen message. Aliases /checkpoint and /undo |
/btw [question] | Asks a side question without adding it to the history |
/autocompact [size] | Sets how full the context gets before auto-compaction, for example 500k (v2.1.221 or later) |
A typical sequence in the middle of a task looks like this:
/context
/compact keep the architecture decisions and the list of files changed
/clear auth-refactor
When you move on to something unrelated, prefer /clear over /compact, which is meant for carrying on with the same task. Since v2.1.299, Claude Code also compacts a conversation over 200K tokens on its own after about 54 idle minutes. The post on idle compaction explains how it works and how to tune it.
Resume, name and copy a session
/resume [session]picks up a conversation by name or ID, or opens the session picker. Alias/continue./rename [name]renames the current session. Without a name, Claude Code generates one from the history./branch [name]branches the conversation so you can try another direction. The original stays available through/resume./fork [prompt]copies the conversation into a new background session while you keep working here./subtask <task>hands a side task to a subagent that inherits the whole conversation. Its result comes back into your session./taskslists the session’s background work, finished subagents included.
Set up a project
/init
/memory
/permissions
/mcp reconnect all
/config model=sonnet
/init generates a starter CLAUDE.md from your codebase. With CLAUDE_CODE_NEW_INIT=1 set, it also walks you through skills, hooks and personal memory files. /memory edits your CLAUDE.md files and manages auto memory. The post on the CLAUDE.md file covers what to put in it.
/permissions manages your allow, ask and deny rules. /mcp manages MCP servers, and /mcp reconnect all retries every server that failed or needs authentication. /config opens the settings, or sets a key directly with key=value. /hooks shows your hooks. /doctor, alias /checkup, checks your setup and proposes fixes that Claude applies once you confirm.
Model, effort and cost
/model [model]switches model and saves it as the default for new sessions. In the picker, presssto switch for the current session only./effort [level]sets effort fromlowtoxhigh,maxorauto./effort statusprints the current level, andmaxonly lasts for the session./usageshows session cost, plan limits and activity stats. Since v2.1.118,/costand/statsopen the matching tab of/usage.
Review before you ship
/diff shows the changes in your working tree, including Claude’s edits. /code-review looks for bugs in the current diff, or in a pull request when you pass its number. --fix applies the findings, and ultra runs a deeper review in the cloud. /review has been an alias for it since v2.1.223.
/code-review
/code-review high 1234
/code-review --fix
/simplify looks for cleanup opportunities and applies them, without hunting for bugs. /security-review checks your branch’s changes for security vulnerabilities and needs an origin remote. The post on code review in Claude Code covers the effort levels and flags of /code-review.
Write your own slash commands
A command of your own is a skill. By default, the skill’s folder name, or the file name in the older .claude/commands/ format, becomes the command you type. The skills documentation lists every case.
| File | Command you type |
|---|---|
.claude/skills/fix-issue/SKILL.md (project) | /fix-issue |
~/.claude/skills/fix-issue/SKILL.md (all your projects) | /fix-issue |
.claude/commands/fix-issue.md (older format) | /fix-issue |
.claude/commands/frontend/component.md | /frontend:component |
my-plugin/skills/review/SKILL.md | /my-plugin:review |
This skill fixes a GitHub issue from its number:
---
description: Fix a GitHub issue from its number
argument-hint: [issue-number]
disable-model-invocation: true
---
Fix GitHub issue $ARGUMENTS following the project's conventions.
1. Read the issue with `gh issue view $ARGUMENTS`
2. Write a test that reproduces the problem
3. Fix the code and run the tests again
You run it with /fix-issue 123. $ARGUMENTS receives everything typed after the name. $0, $1 and so on pick single arguments, counting from zero. Quotes group several words into one argument. If no placeholder receives your arguments, Claude Code appends them to the prompt as ARGUMENTS: <text>.
By default, Claude can also run your command on its own when the description matches what you asked. That includes files in .claude/commands/. disable-model-invocation: true keeps the command for you alone, which suits anything with side effects. With user-invocable: false, the command leaves the / menu and only Claude can load it.
At the terminal prompt, you can stack up to six skills in one message, such as /write-tests /fix-issue 123. The trailing text goes to each of them. With claude -p or the Agent SDK, only the first skill loads.
Traps to know about
- After a typo, the menu highlights nothing.
Enterthen sends your text as typed, and Claude Code replies “Unknown command”. Pick the command withTabor the arrow keys. - One of your skills can share its name with a built-in command. In a local terminal session it replaces the command, but not its aliases. A project
usageskill replaces/usage, while/coststill runs the built-in. - The same goes for bundled skills. Your own
code-reviewskill replaces/code-review, but/reviewstill runs the bundled version. - When a skill and a
.claude/commands/file share a name, the skill runs. - A misspelled frontmatter field is ignored with no error. Claude Code only reads the frontmatter when
---is the very first line of the file. - A
.claude/commands/file accepts the same fields as a skill, exceptnameandpaths. - If a skill you added mid-session doesn’t show up in the menu, run
/reload-skills(v2.1.152 or later).
What changed, version by version
From the Claude Code changelog:
- v2.1.3: custom commands and skills merged, with no change in behavior.
- v2.1.118:
/costand/statsbecome shortcuts into/usage. - v2.1.152:
/reload-skillsarrives, to re-scan skill folders without a restart. - v2.1.198: the
/agentswizard is gone. Ask Claude to create the subagent, or write its file in.claude/agents/. The post on subagents covers that file format. - v2.1.212:
/forkcopies the conversation into a background session. The in-session subagent it used to start is now/subtask. - v2.1.222: ultraplan is removed. The docs point to plan mode instead, which
/planopens. - v2.1.223:
/reviewbecomes an alias of/code-review. - v2.1.326:
/help <command>is added.
Section 4.1 of module 4, Skills, commands and plugins walks you through writing your first skill and running it as a slash command. Sections 4.3 to 4.5 go through arguments, the @ and ! syntaxes, then the frontmatter.