Commands
Every slash command in Claude Code — what it does, when to reach for it, and an example.
Slash commands are typed straight into the Claude Code prompt — start with / and the list filters
as you type. They aren’t sent to the model as ordinary text; the CLI itself runs them.
The ones you’ll use most
/init
Creates a CLAUDE.md for the project.
/clear
Resets the context between tasks.
/compact
Collapses a long session into a summary.
Context and session
| Command | What it does | Example |
|---|---|---|
/init |
Analyzes the codebase and generates a CLAUDE.md describing the project, its build/test commands, and its conventions. Run it once, then maintain it by hand. |
/init |
/clear |
Wipes the conversation history and starts fresh. The fastest way to get quality back when Claude is buried under stale context. | /clear |
/compact |
Summarizes the conversation into a short recap and frees up context while keeping the thread. Also takes instructions about what to preserve. | /compact keep the API decisions |
/context |
Breaks down what is actually occupying the context window — system prompt, CLAUDE.md, file contents, each MCP server’s tools — as a share of the total. The tool for diagnosing bloat instead of guessing at it. |
/context |
/rewind |
Rolls the conversation back to an earlier point without starting over. Cheaper than /clear when only the last few turns went wrong. Its menu also offers Summarize from here, which writes a handoff note before dropping the tail. |
/rewind |
/btw |
Asks a quick side question in an overlay, without it entering the conversation history. For the unrelated thing you’d otherwise wedge into the middle of a working session. | /btw what does --autocompact do? |
/resume |
Opens a list of previous sessions and continues the one you pick — with all of its context. | /resume |
/memory |
Opens the memory files (project- and user-level CLAUDE.md) for editing in your editor. |
/memory |
/cd |
Moves the session to a new working directory — every tool call and relative path resolves from there. Handy for hopping between projects without restarting. | /cd ../claude-library |
Settings and model
| Command | What it does | Example |
|---|---|---|
/config |
Opens Claude Code’s settings — theme, notifications, editor behavior, and more. | /config |
/model |
Shows or switches the model for the session. With no argument it opens a picker. | /model opus |
/status |
Prints diagnostics: account, active model, version, working directory, connected services. | /status |
/statusline |
Sets up the line at the bottom of the terminal. Describe what you want on it — model, context percentage, cost, branch — and it generates the script. A permanent readout instead of running /context and /cost by hand. |
/statusline show model, context % and cost |
/cost |
Shows the tokens used and the cost of the current session. | /cost |
/login |
Sign in or switch Anthropic accounts. | /login |
/help |
Lists every available command with a one-line description. | /help |
/checkup |
Audits and tunes your whole setup: removes unused skills/MCPs/plugins to save context, dedups and splits CLAUDE.md into nested files + skills, turns off slow hooks, updates Claude Code, and pre-approves frequently denied read-only commands. Confirms every change first. |
/checkup |
Extensions and permissions
| Command | What it does | Example |
|---|---|---|
/agents |
Manages subagents — creating, editing, and reviewing the definitions in .claude/agents/. |
/agents |
/hooks |
Configures hooks — commands that run automatically before or after certain events. | /hooks |
/mcp |
Manages MCP servers: connection status, available tools, OAuth authentication. | /mcp |
/permissions |
Review and edit the permission rules — what’s allowed, what asks, and what’s denied. | /permissions |
/review |
Reviews a pull request and leaves comments on the code. | /review 271 |
/loop |
Reruns a prompt on an interval inside the same session, interrupting you only when something needs attention. Also takes one-off reminders in plain language. | /loop 5m check the deployment |
/goal |
Sets a condition Claude checks before it’s allowed to stop. If the condition isn’t met it keeps going, counting iterations. /goal alone shows the active goal, elapsed time, turns, and tokens; /goal clear ends it early. Needs a trusted workspace. |
/goal all tests pass and the linter is clean |
/workflows |
Browses running and completed dynamic workflows — live per-agent token usage, tools, and elapsed time, with the option to stop a run or save it as a command. | /workflows |
Habits worth forming
Run /init right after cloning a new project
CLAUDE.md is the first thing Claude reads. Five minutes up front saves the same explanations
in every session that follows.
/compact with instructions beats /compact without
Tell it what to keep and the summary stays useful. Otherwise you risk losing exactly the detail you’ll need ten minutes later.
/context when a session starts feeling slow or dumb
Don’t guess at what’s eating the window. The breakdown usually points at one thing — an
oversized CLAUDE.md, or an MCP server whose tool definitions are resident whether you use
them or not.
/cost before a long session
A quick sense of how expensive your way of working is — especially if you spin up a lot of subagents.