/ Claude Code Reference

Claude Code Slash Commands —
The Complete Reference

Claude Code has 15+ built-in slash commands for clearing context, switching models, reviewing PRs, running memory audits, and more. Here’s what each one does.

/ Type a slash command at the start of a message — Tab-autocomplete shows all available options
See All Commands → Custom Skills
In this guide

All Built-In Slash Commands

Every command that ships with Claude Code. Type any of these at the start of a message. Tab-completion is available for all of them.

Command What it does
/help Show all available commands and their descriptions
/clear Clear conversation history and start fresh — keeps model settings
/compact Compact conversation history to save context tokens — summarizes prior messages while staying in the same task
/cost Show token usage and estimated cost for the current session
/doctor Run diagnostics — checks environment, permissions, config issues, and API key validity
/review Review code changes or a PR — shows diff with AI analysis
/init Initialize a CLAUDE.md file in the current project (or update existing)
/memory Open and edit Claude’s memory files — both project and global
/model Switch to a different Claude model mid-session
/status Show current session status — model, cost, files open, permissions
/bug Submit a bug report to Anthropic with session context attached
/login Authenticate or re-authenticate with your Anthropic account
/logout Log out of your Anthropic account
/terminal-setup Configure terminal integration — shell completion, keyboard shortcuts
/config Open Claude Code configuration settings
/pr-comments Fetch and display GitHub PR comments in the current session
/mcp List or manage MCP (Model Context Protocol) server connections
Tab-complete everything

Type / at the start of a message and press Tab. Claude Code shows a picker with all available commands — built-in and any custom skills you’ve added. You never need to memorize the exact names.

The Most Useful Commands Explained

Most Claude Code users use /clear and stop there. The commands below are what separates power users from everyone else.

/clear vs /compact — what’s the difference?

These two commands both deal with conversation history, but they do very different things. Choosing the wrong one wastes context or loses important session state.

/clear

Wipes everything and starts completely fresh. Use when you’re switching to a completely different task and the prior context is irrelevant or actively misleading.

/compact

Keeps the history but compresses it. Claude summarizes what happened and preserves the key context. Use when your session is getting long but you’re still on the same task.

Rule of thumb: switching tasks → /clear. Long session, same task → /compact.

/init — the first command to run in any new project

Run /init once in a new codebase and Claude inspects the repo, detects the tech stack, identifies conventions, and auto-generates a CLAUDE.md context file in the project root.

  • Detects language, framework, package manager, test runner
  • Reads existing README and config files for architecture notes
  • Creates a CLAUDE.md you can customize and commit to the repo
  • If a CLAUDE.md already exists, /init updates it with any new information it finds
See CLAUDE.md template examples →

/memory — managing what Claude knows between sessions

Claude Code has two memory files. /memory opens both in your editor so you can view and update them.

  • Project memoryCLAUDE.md in the current directory. Repo-specific instructions. Lives in git.
  • Global memory~/.claude/CLAUDE.md. Applies to every Claude Code session on your machine across all projects.

Global memory is the right place for things like your preferred coding style, communication preferences, and personal rules that apply everywhere. Project memory is for repo-specific context: tech stack, conventions, architecture decisions, off-limits files.

/model — switching models without restarting

Type /model and Claude Code presents a picker with available models. Switch on the fly without losing your session context.

  • claude-opus-4-6 — Strongest reasoning. Use for architecture decisions, complex refactors, and multi-file changes.
  • claude-sonnet-4-6 — Balanced speed and intelligence. Best for most day-to-day coding work.
  • claude-haiku-4-5 — Fast and cheap. Use for simple tasks, lookups, and anything where speed matters more than depth.

Switching to Haiku for a quick file rename and back to Opus for the architecture review is a legitimate cost-optimization strategy — /model makes it frictionless.

/review — instant AI code review

Three modes depending on what you pass after the command:

  • /review (no arguments) — reviews all uncommitted changes in the current repo
  • /review main — compares current branch against main
  • /review [PR URL] — pulls the PR from GitHub and reviews it with full diff context

Combined with /pr-comments to fetch existing reviewer comments, this turns Claude Code into a full code review assistant that knows both the diff and what humans already flagged.

/doctor — when something isn’t working

Run /doctor before filing a bug report or asking for help. It checks the full environment and surfaces the most common configuration issues.

  • Node.js version compatibility
  • Git configuration and credentials
  • API key validity and quota status
  • File system permissions in the current directory
  • settings.json syntax errors
  • MCP server connection status

Most “Claude Code is broken” reports turn out to be a misconfigured settings.json or an expired API key. /doctor finds these in seconds.

/mcp — managing MCP server connections

MCP (Model Context Protocol) servers extend what Claude Code can do — connecting it to databases, APIs, browser automation, and custom tools. /mcp lists all configured servers, their connection status, and the tools each one exposes.

  • See which MCP servers are connected and which are failing
  • Inspect available tools from each server
  • Diagnose connection issues without leaving the session
Full MCP Servers guide →

Custom Slash Commands — Skills

Beyond built-in commands, Claude Code supports custom slash commands called skills. Skills are Markdown files stored in a specific directory. The filename becomes the command name.

~/.claude/commands/

Global skills

Available in every Claude Code session on your machine. Good for personal workflows that apply across all projects.

.claude/commands/

Project-level skills

Available only in this project directory. Commit them to git so your whole team shares the same custom commands.

The Markdown file content becomes the prompt that runs when you invoke the skill. A file named commit.md creates the /commit command. Whatever is in the file is what Claude runs.

~/.claude/commands/commit.md invoked as /commit
# /commit Look at my staged changes. Write a clear, concise commit message following conventional commits format (type: description). Suggest 3 options ranked by clarity. Use these prefixes: - feat: new feature - fix: bug fix - docs: documentation - refactor: code restructure without behavior change - chore: tooling, deps, config Keep the subject line under 72 characters.
Skills ship with Brainfile

Brainfile members get a library of production-tested skill files for common workflows: /commit, /review-ready, /explain, /test-coverage, /deploy-check, /changelog, and more. Each is tuned for the role profile you select.

Some examples of useful custom skills to build or get:

📝

/standup

Summarizes today’s git commits into a standup-ready bullet list with context on what changed and why.

🧪

/test-this

Writes unit tests for the current file or a specified function. Adapts to your test framework automatically.

📄

/pr-ready

Checks if changes are PR-ready: tests passing, no debug code, no TODOs, clean diff, description drafted.

📈

/perf-review

Reviews staged changes specifically for performance issues: N+1 queries, missing indexes, blocking calls.

📋

/changelog

Generates a CHANGELOG entry for the current branch by reading all commits since the last tag.

🔒

/security-check

Scans staged changes for common security issues: exposed secrets, SQL injection patterns, unvalidated input.

Keyboard Shortcuts

Slash commands are the explicit interface. These shortcuts control the session at the terminal level.

Terminal Shortcuts
Tab
Autocomplete slash commands — shows all available options including custom skills
↑ / ↓
Navigate through command history — cycle previous messages you sent
Ctrl+C
Cancel current operation — stops Claude mid-task without closing the session
Ctrl+L
Clear the terminal screen without clearing conversation context (visual reset only)
Ctrl+R
Search through command history — find a prompt you sent earlier in the session
Esc
Interrupt Claude mid-response — stops generation and returns to the prompt
Configure your shortcuts

Run /terminal-setup to configure shell completion and additional keyboard shortcuts for your specific shell (bash, zsh, fish). This sets up Tab-complete so it works before you even open Claude Code.

Slash Commands + Brainfile

Slash commands control the session.
Brainfile controls what Claude knows.

Two layers of the same workflow. Most engineers only use one.

Slash Commands

Session management

Clear context, switch models, review PRs, check costs, run diagnostics. Everything about controlling the active session.

Brainfile

Persistent context

Tell Claude who you are, what you’re building, your coding standards, team conventions, and architecture constraints. Survives across every session.

Together: optimal AI workflow from first keystroke to final commit. /init creates the file — Brainfile templates fill it with everything Claude needs to work like a senior member of your team.

Get Brainfile Templates — $149/mo →

30-day money-back guarantee · Instant access · Cancel anytime

Complete Claude Code Stack

The commands are free.
Knowing what to put in CLAUDE.md is the edge.

150+ role-specific templates: CLAUDE.md, .cursorrules, settings.json hooks, memory files, and custom skill libraries. Preconfigured for your profession. Updated monthly.

$149 /month

30-day money-back guarantee · Instant access · Cancel anytime

Need team setup? Enterprise at $299/mo →

Free: Claude Code Tips & Workflow Guides

New slash command tips, CLAUDE.md patterns, and AI workflow guides. Free weekly digest.

No spam. Unsubscribe anytime.