← back to posts

Claude Code Slash Commands: The Complete Reference

Inside a Claude Code REPL, anything you type starting with / is a slash command. These are not prompts to the model — they are direct instructions to the harness. Some configure the session, some manage memory, some invoke installable skills. Knowing the catalog is the difference between fighting Claude and conducting it.

Built-in Slash Commands

Type / at the prompt to see the full list. The essentials:

  • /init — Scans the repo and generates a CLAUDE.md with build commands, architecture notes, and conventions. Run this once per project.
  • /clear — Wipes conversation history and starts fresh. Use when switching tasks to keep context clean and costs down.
  • /compact [instructions] — Summarizes the current conversation into a shorter form so you can keep going without hitting context limits. Optional instructions tell Claude what to preserve.
  • /resume — Open a picker of past sessions in this directory and jump back into one.
  • /cost — Shows token usage and cost for the current session. Surprisingly grounding.
  • /model — Switch between Opus, Sonnet, and Haiku mid-session. Drop to Haiku for fast small edits, escalate to Opus for hard reasoning.
  • /permissions — Manage the allow/deny lists for tools and shell commands.
  • /config — Open settings (theme, model, editor preferences).
  • /login / /logout — Re-authenticate or sign out.
  • /help — In-CLI documentation.
  • /bug — File feedback to Anthropic without leaving the terminal.
  • /review — Trigger a code review on the pending diff.
  • /pr — Create a pull request from the current branch using the in-session changes as PR body context.

Memory and Plan Commands

  • /memory — Edit Claude’s persistent memory store. Useful for long-running facts about how you like to work.
  • /remember <fact> — Append a single durable note to memory.
  • # at the start of a message — Quick way to add to CLAUDE.md directly. Claude will ask which level (project or user) to write it to.

Custom Slash Commands

This is where Claude Code stops being a tool and becomes your tool. Drop a Markdown file in either of these locations:

  • .claude/commands/<name>.md — Project-scoped, checked into git, shared with the team.
  • ~/.claude/commands/<name>.md — User-scoped, personal across all projects.

The filename becomes the command. Inside, you write a prompt template:

1
2
3
4
5
6
7
8
---
description: Run the test suite and fix any failures
allowed-tools: Bash, Edit, Read
---

Run `npm test`. If anything fails, read the failing files,
identify the root cause, fix the code (not the tests unless
the test is wrong), and re-run until green.

Save as .claude/commands/fix-tests.md, then in any session type /fix-tests and Claude executes the workflow. Arguments are supported via $ARGUMENTS:

1
Generate a TypeScript interface for the JSON shape: $ARGUMENTS

Now /typegen { "id": 1, "name": "x" } does what you would expect.

Skills vs. Commands

Anthropic also ships skills — bundled, model-aware capabilities like caveman, simplify, security-review, and init. Skills are richer than commands (they can include reference files and trigger conditions) but you invoke them the same way: /security-review, /simplify, /review. The list of available skills appears in your session’s system context.

Tips From Real Use

  • Build a /standup command that runs git log --since=yesterday and asks Claude to write your daily update.
  • Build a /triage command that reads the latest GitHub issue and proposes a fix branch.
  • Use /clear aggressively between unrelated tasks. Stale context degrades quality and burns tokens.
  • /compact before long debugging sessions so you do not hit a wall mid-investigation.

Slash commands turn Claude Code from a chat box into a programmable agent runtime. Spend an afternoon writing four or five of your own and the tool starts feeling bespoke.