Claude Code

Claude Code Slash Commands: The Complete Cheat Sheet (2026)

7 min read

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.

CommandWhat it does
/helpList the available commands and show basic usage help for the current session.
/clearWipe the conversation history and reset the context window for a clean start.
/compactSummarize 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.
/initScan the project and generate a CLAUDE.md memory file documenting its structure and conventions.
/memoryOpen your CLAUDE.md memory files for editing.
/configOpen the settings interface to view and change configuration such as theme and preferences.
/modelSwitch the model used for the session, for example between Opus, Sonnet, and Haiku.
/costShow token usage and estimated cost for the current session.
/agentsCreate, edit, and manage subagents stored in .claude/agents.
/mcpView connected MCP servers, the tools they expose, and their authentication status.
/add-dirAdd another working directory to the session so Claude can read files outside the original folder.
/reviewAsk Claude to review a pull request and report its findings.
/pr-commentsFetch and display comments from a GitHub pull request.
/vimEnable vim-style modal editing for the input prompt.
/terminal-setupInstall key bindings such as Shift+Enter for newlines in supported terminals.
/doctorCheck the health of your Claude Code installation and diagnose common problems.
/loginAuthenticate with your Anthropic account or API key.
/logoutSign out of your current account.
/bugReport 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 /clear between unrelated tasks and /compact when a long session is running low on room — both keep Claude sharp and responses fast.
  • Write action-oriented descriptions. A clear description in 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:commit and /test:unit stay 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.

Open catalog →

Frequently Asked Questions

What is a slash command in Claude Code?
A slash command is a keyword you type at the start of the prompt, beginning with a forward slash, that triggers a specific action instead of being sent to the model as an ordinary message. Some commands are built in and ship with the Claude Code CLI, such as /clear and /help, while others are custom commands you define yourself as Markdown files in a .claude/commands directory.
How do I see all available slash commands?
Type a forward slash in the Claude Code prompt to open an autocomplete list of every available command, including both built-in commands and any custom ones you have installed. You can also run /help to print the list along with basic usage information. The exact set of built-in commands can change between releases, so /help is the most reliable way to confirm what your version supports.
What is the difference between /clear and /compact?
/clear wipes the conversation history entirely and resets the context window for a clean start, which is ideal when you switch to an unrelated task. /compact instead summarizes the conversation so far into a shorter form, preserving the key facts and decisions while reclaiming context space. Use /clear to start fresh and /compact when a long session is filling the window but you still need its earlier reasoning.
How do I create a custom slash command?
Create a Markdown file in .claude/commands/ inside your project (or ~/.claude/commands/ for a personal command available everywhere). The file name becomes the command name, so review.md is invoked by typing /review, and the file's contents become the prompt. Add optional YAML frontmatter for a description, an argument-hint, and allowed-tools, and use the $ARGUMENTS placeholder to accept input passed after the command name.
How do I install a ready-made Claude Code command?
Open any command page in the ToolZip commands catalog and run its install line, for example: npx claude-code-templates@latest --command="git/commit-message" --yes. The value after --command is the category/name path shown on the page, and --yes skips the confirmation prompt. The command writes the Markdown file into your project's .claude/commands directory, where it is available immediately with no restart required.