Claude Code Slash Commands: The Complete Cheat Sheet (2026)
Slash commands are the fastest way to steer Claude Code, Anthropic's agentic command-line coding tool. A slash command is a keyword you type at the start of the prompt, beginning with a forward slash — like /clear or /help — that triggers a specific action instead of being sent to the model as an ordinary message. Some are built in and ship with the CLI; others are custom commands you define yourself as Markdown files. This cheat sheet covers both: a quick-reference table of the built-in commands, then everything you need to write and install your own.
Built-in slash commands cheat sheet
These commands are available in any Claude Code session out of the box. Type a forward slash in the prompt to see the list with autocomplete, or scan the table below. The exact set can grow between releases, so run /help to confirm what your version supports.
| Command | What it does |
|---|---|
/help | List the available commands and show basic usage help for the current session. |
/clear | Wipe the conversation history and reset the context window for a clean start. |
/compact | Summarize the conversation so far into a compact form, keeping key facts while reclaiming context. Accepts optional focus instructions, e.g. /compact focus on the auth refactor. |
/init | Scan the project and generate a CLAUDE.md memory file documenting its structure and conventions. |
/memory | Open your CLAUDE.md memory files for editing. |
/config | Open the settings interface to view and change configuration such as theme and preferences. |
/model | Switch the model used for the session, for example between Opus, Sonnet, and Haiku. |
/cost | Show token usage and estimated cost for the current session. |
/agents | Create, edit, and manage subagents stored in .claude/agents. |
/mcp | View connected MCP servers, the tools they expose, and their authentication status. |
/add-dir | Add another working directory to the session so Claude can read files outside the original folder. |
/review | Ask Claude to review a pull request and report its findings. |
/pr-comments | Fetch and display comments from a GitHub pull request. |
/vim | Enable vim-style modal editing for the input prompt. |
/terminal-setup | Install key bindings such as Shift+Enter for newlines in supported terminals. |
/doctor | Check the health of your Claude Code installation and diagnose common problems. |
/login | Authenticate with your Anthropic account or API key. |
/logout | Sign out of your current account. |
/bug | Report a bug or send feedback about Claude Code to Anthropic. |
A few of these are worth committing to memory. /clear and /compact are your context-management workhorses: reach for /clear when you switch to an unrelated task, and /compact when a long session is filling the window but you still need its thread of reasoning. /init is usually the first thing to run in a new repository, because a good CLAUDE.md pays off in every later session.
Custom slash commands
Beyond the built-ins, you can define your own commands to replay a prompt you use often — generating a commit message, running a review pass, scaffolding a component, or writing tests for changed files. A custom slash command is nothing more than a Markdown file whose contents become the prompt when you invoke it.
Claude Code loads custom commands from two locations, and the scope decides where the command is available:
- Project commands live in
.claude/commands/at the root of your repository. Commit them and your whole team shares the same commands. - Personal commands live in
~/.claude/commands/in your home directory and follow you across every project on your machine.
The file name becomes the command name: a file called fix-tests.md is invoked by typing /fix-tests. Subdirectories act as namespaces, so .claude/commands/git/commit.md becomes /git:commit. No registration or restart is needed — Claude Code discovers the file the moment it exists.
Arguments and placeholders
Commands become far more useful when they accept input. Inside the Markdown body, the $ARGUMENTS placeholder is replaced by everything you type after the command name, so /fix-issue 123 high-priority passes 123 high-priority into the prompt. For finer control, use positional placeholders $1, $2, and so on to capture individual arguments separately — handy when the first token is an issue number and the second is a label.
An example command file
A command file can open with optional YAML frontmatter that configures how it runs, followed by the prompt itself. Save this as .claude/commands/review-diff.md:
--- description: Review the current git diff for bugs and style argument-hint: [optional focus area] allowed-tools: Bash(git diff:*), Read, Grep --- Review the staged changes below for correctness, readability, and security, focusing on $ARGUMENTS. Run git diff to see what changed, then list findings grouped by severity with concrete fixes.
The description shows up in the command list, argument-hint documents expected input for autocomplete, and allowed-tools pre-approves specific tool calls so the command runs without extra prompts. You can also reference files with the @ prefix and run shell commands whose output is injected into the prompt using a leading !, which lets a command gather live context before Claude acts on it.
Installing ready-made commands
You do not have to write every command from scratch. ToolZip's Claude Code commands catalog collects working, categorized commands you can install with a single line. Each listing shows the command's contents and a copy-paste install command that uses the open-source claude-code-templates CLI:
npx claude-code-templates@latest --command="git/commit-message" --yes
Replace git/commit-message with the category/name path shown on any command page, run it from your project root, and the Markdown file drops straight into .claude/commands/ ready to use. The --yes flag skips the confirmation prompt for non-interactive setup. A fast way to learn the format is to install a command close to what you need, then open the generated file and edit the prompt to fit your workflow.
Tips for working with slash commands
- Type a forward slash to browse. Autocomplete lists both built-in and custom commands, so you rarely need to memorize names.
- Manage context deliberately. Use
/clearbetween unrelated tasks and/compactwhen a long session is running low on room — both keep Claude sharp and responses fast. - Write action-oriented descriptions. A clear
descriptionin a custom command's frontmatter makes it easy to find later and easy for teammates to understand. - Scope tools with
allowed-tools. Pre-approving just the tools a command needs keeps it fast without handing it broad permissions. - Commit project commands to git. Storing them in
.claude/commands/gives your whole team the same shortcuts and versions them alongside the code. - Namespace with folders. Group related commands into subdirectories so
/git:commitand/test:unitstay organized as your collection grows.
Between the built-in commands in the table above and a handful of custom commands tuned to your project, slash commands turn repetitive instructions into single keystrokes. For a deeper walkthrough of the custom-command format, see the Claude Code commands guide, browse ready-made options in the commands catalog, or step back to the full Claude Code catalog to see how commands fit alongside agents, MCP servers, hooks, and skills.
Browse Claude Code Commands
Reusable slash commands that automate repeatable prompts.