In this categoryClaude Code · 45
Claude CodeBeginner

How to Use Claude Code Slash Commands (Full List + Examples)

Every built-in Claude Code slash command explained with real examples, plus how custom commands and skills add your own.

8 minBeginner

Slash commands are shortcuts you type directly in the Claude Code prompt to trigger built-in behaviors without writing an instruction in plain English. Most developers use only /clear and /help; this guide covers the ones worth adding to your daily workflow, then shows how to add your own.

The built-in commands

The exact list depends on your version, and /help always prints what is available to you right now. These are the ones you will reach for most often.

  • /help — lists every command available in your version and your current config
  • /clear — wipes the conversation context so you start fresh without closing the session
  • /compact — condenses the current context into a summary, freeing space without losing the thread
  • /config — opens the settings UI to view or change the model, permissions, and other options
  • /model — switches the active model for the session
  • /memory — opens your CLAUDE.md so you can edit the project rules mid-session
  • /agents — create, edit, and list subagents
  • /mcp — show connected MCP servers and the tools they expose
  • /cost — prints token usage and estimated cost for the current session
  • /init — scans the repo and scaffolds a starter CLAUDE.md
  • /code-review — runs the bundled code-review skill on your current changes

The commands you will actually use daily

/clear vs /compact

These two are the most misunderstood. /clear is a hard reset: the model has no memory of anything you said. Use it when you are starting a completely different task and you do not want old context bleeding in. /compact is a soft reset: Claude summarizes what happened and keeps that summary as the new starting point. Use it when a session has grown long but you still need the model to know what it already built.

Rule of thumb
If you are switching to a different file or feature: /clear. If you are continuing the same task but the context is getting expensive: /compact.

/code-review

Running /code-review with no arguments reviews your current changes. The output is a list of findings with file path and line number. You can follow up with 'fix the first three' and it applies them in order. On older versions the same behavior lives under /review.

Claude Code
$/code-review
Reviewing current changes (3 files)...
src/api/auth.ts:42 — password compared before hash, timing attack risk
src/api/auth.ts:61 — JWT secret read from process.env without fallback check
src/utils/format.ts:18 — unused import (lodash/merge)
$

/memory

Opens CLAUDE.md in your editor mid-session. Useful when the agent keeps doing something wrong and you want to add a rule without interrupting the flow. Save the file and Claude picks up the new rule on the next message.

Checking what is available in your version

Claude Code
$/help
Claude Code 2.x — available commands:
/clear /compact /config /model /memory /agents /mcp /cost /code-review ...
The list varies by version — /help always shows what is available
$

Adding your own commands

You are not limited to the built-ins. A Markdown file at .claude/commands/deploy.md becomes /deploy, and the file content is the instruction Claude runs. In current versions these have merged into skills: a skill at .claude/skills/deploy/SKILL.md creates the same /deploy and adds optional frontmatter and supporting files. Your existing .claude/commands/ files keep working unchanged.

.claude/commands/security-review.md
---
argument-hint: [file]
allowed-tools: Read, Grep
---
Review $ARGUMENTS for auth, injection, and secret-leaking issues.
Group findings by severity and suggest a concrete fix for each.
Do not edit any files; only report.
Custom commands, in depth
The full walkthrough, including $ARGUMENTS, positional $1 arguments, and frontmatter fields, is in our guide on adding custom slash commands.

FAQ

How do I see every slash command?

Type /help inside a session. It prints the commands available in your installed version, which is more reliable than any static list because the set changes between releases.

Do slash commands work in the VS Code extension?

Yes. The extension drives the same CLI underneath, so the built-in commands and any custom commands or skills in your repo work exactly as they do in the terminal.

What is the difference between a command and a skill?

A file in .claude/commands/ is a plain prompt you invoke with a slash. A skill is the newer form: a folder with a SKILL.md, optional supporting files, and frontmatter that can let Claude load it automatically when relevant. Both create a slash command; skills just do more.

Watch related tutorials

Free weekly email

New guides in your inbox

Fresh step-by-step how-to guides as we publish them. One email a week, no more.

Tags
#claude code#claude code slash commands#slash commands#claude code commands#tips