The Master Tutorial: Every Claude Code Slash Command Explained (April 2026 Edition)

Uncategorized

If you’ve ever opened Claude Code, typed /, and watched a long menu of commands appear, you’re not alone in feeling slightly overwhelmed. This guide is the complete map. Every built-in command, every bundled skill, what it does, when to use it, and the gotchas nobody tells you about.

This tutorial is current as of April 2026 and is based on Anthropic’s official Claude Code documentation. Your exact menu may vary slightly depending on your version, installed plugins, and connected MCP servers — when in doubt, type /help in your session to see what’s actually available to you.


Table of Contents

  1. What slash commands actually are
  2. Session and context management commands
  3. Project setup and memory commands
  4. Code review and quality commands
  5. Configuration and customization commands
  6. Model and execution control commands
  7. Extension and integration commands
  8. Bundled skills (the prompt-based commands)
  9. Custom commands and skills you create yourself
  10. MCP server commands
  11. Special syntax: @, !, and #
  12. Tips, gotchas, and best practices

1. What Slash Commands Actually Are

A slash command is a typed shortcut you use inside a Claude Code session. You hit /, an autocomplete menu appears, and you pick or type the command you want. They fall into a few buckets:

Built-in commands ship with Claude Code itself and run fixed logic — things like clearing your conversation or compacting context. They’re hardcoded and fast.

Bundled skills also ship with Claude Code, but they’re prompt-based. They give Claude a detailed playbook and let it orchestrate the work using its tools. They look like commands when you type /, but they’re really mini-instructions Claude executes intelligently.

Custom commands are anything you create yourself in .claude/commands/ or .claude/skills/. As of the 2026 update, these two have been unified — they both create a /your-command-name and work the same way.

MCP commands come from connected Model Context Protocol servers (GitHub, Slack, Atlassian, etc.) and appear as /mcp__servername__promptname.

Understanding which bucket a command falls into helps you predict its behavior. Built-ins are deterministic. Skills and custom commands are flexible but rely on Claude’s reasoning.


2. Session and Context Management Commands

These are the commands you’ll touch most often. Master them first.

/help

Shows every command available in your current session — built-ins, bundled skills, your custom commands, and any MCP server prompts. This is your “I forgot what’s possible” command. Use it whenever you want to see the actual live list rather than trusting any cheat sheet (including this one).

/clear

Wipes your conversation history and starts a fresh session. Use this when you switch tasks. Many experienced users describe /clear as the single biggest token-saver in their workflow — every time you start something new, clear the chat. You don’t need yesterday’s bug-hunt context polluting today’s feature work.

Rule of thumb: if your next prompt has nothing to do with the previous one, run /clear first.

/compact

Summarizes older messages while preserving important context. Use this when you want continuity but your context window is getting full. You can pass an argument telling Claude what to retain:

/compact retain the error handling patterns and the database schema

The general guidance is: use /compact when context usage exceeds about 80%, and /clear when switching tasks entirely.

/context

Shows current context window usage. Useful when you’re trying to decide whether to keep going, run /compact, or /clear and start over.

/cost

Displays token usage and cost for the current session. Good for keeping an eye on spend, especially if you’re on API billing rather than a Pro/Max subscription.

/usage

Shows your usage data more broadly — different from /cost in that it can cover usage across sessions, not just the current one.

/status

Quick view of session status: model in use, mode, current configuration, etc.

/export

Exports the current conversation. Great after solving a tricky problem — exported conversations become searchable documentation and learning resources for your future self.


3. Project Setup and Memory Commands

These commands deal with how Claude Code remembers and understands your project.

/init

Scans your project and auto-generates a CLAUDE.md file containing your directory structure, common commands, and coding conventions. Run this first in any new project. Setting up CLAUDE.md from the beginning saves countless correction cycles later — Claude won’t have to re-figure-out “is there a build command? a lint command?” every session.

/memory

Opens an editor interface to edit your CLAUDE.md files. Content written here persists across sessions. Use this when you want to add project conventions, architecture notes, or any context Claude should always know.

You can also use the # prefix in normal chat for quick memory adds — just type # always use single quotes in JS and it gets added.


4. Code Review and Quality Commands

/review

Runs a code review on your changes. Claude analyzes the diff and gives you feedback on quality, readability, potential bugs, and so on.

/security-review

Same idea but laser-focused on security: SQL injection risks, XSS vulnerabilities, exposed credentials, insecure configurations, authentication issues. Run this before merging anything sensitive.

/install-github-app

Installs the Claude GitHub app so Claude automatically reviews your PRs. This is genuinely useful — Claude tends to find actual logic errors and security issues rather than nitpicking variable names like human reviewers sometimes do. After install, customize the review prompt in claude-code-review.yml to keep it concise.


5. Configuration and Customization Commands

/config

Edit your configuration. Changes persist to ~/.claude/settings.json with project/local/policy override precedence — meaning project settings can override personal ones, and managed/policy settings can override both.

/permissions

Manage allow/deny rules for tools. Pre-approve common operations so Claude isn’t asking permission every five minutes when it wants to run git status. Save your attention for the important decisions.

Example permission setup:

  • Allow Bash(git *) so all git commands run without prompts
  • Deny Read(./.env) and Read(./.env.*) so secrets stay safe
  • Deny Write(./production.config.*) so production configs can’t be edited accidentally

/hooks

Opens an interactive menu to configure hooks — scripts that run at specific lifecycle events (before tool use, after file writes, etc.). Examples: run Prettier after every file write, run a type check after every edit, send a desktop notification when a long task finishes.

/keybindings

Create or edit ~/.claude/keybindings.json to customize keyboard shortcuts. Changes take effect immediately without restarting Claude Code.


6. Model and Execution Control Commands

/model

Lists available models and lets you switch. As of April 2026 the main options inside Claude Code are:

  • Claude Sonnet 4.6 — the daily-driver default. Strong on most prompts.
  • Claude Haiku 4.5 — fast and cheap, great for easy tasks.
  • Claude Opus 4.6 — the most capable, save for hard reasoning and complex multi-step coding.
  • Claude Opus 4.7 — the newest and most advanced model in the Claude 4.7 family.

Most Pro/Max users default to Sonnet and only reach for Opus on hard problems.

/effort

Sets the effort level for the current session. Options: low, medium, high, max. Higher effort = more thinking, better results, more tokens. The max level is Opus-only.

/plan

Toggles plan mode. In plan mode, Claude proposes an approach before doing anything destructive. Useful for big refactors. You can also cycle plan mode on/off with Shift+Tab.

/agents

Manage subagents — specialized Claude instances with their own context windows and personas. Use them for domain-specific tasks (code review, debugging, architecture exploration) so your main conversation stays focused and you save tokens.

Built-in agent types include Explore (read-only codebase exploration), Plan (planning without executing), and general-purpose. You can also define your own in .claude/agents/.

/todos

View the current TODO list Claude is tracking for the task at hand.


7. Extension and Integration Commands

/mcp

Manage connected Model Context Protocol servers. MCP is how Claude Code talks to external tools — GitHub, Slack, databases, browsers, design tools, anything with an MCP integration. Use this to list, add, remove, or troubleshoot connections.

Add servers from the CLI:

claude mcp add --transport http github https://mcp.github.com

Then manage them inside a session with /mcp.

/plugin

Add plugin marketplaces and install plugins. A plugin is a bundle of related slash commands, agents, skills, and hooks distributed together as a public Git repo. Anthropic hosts an official Claude Code Plugins marketplace, and the community has built many more.

Example flow:

/plugin marketplace add https://github.com/wshobson/agents
/plugin install claude-code-plugin

/skills

Manage installed skills — list them, see what’s available, debug skills that aren’t triggering. Skills are the prompt-based extensions that live in .claude/skills/<name>/SKILL.md.


8. Bundled Skills (Prompt-Based Commands)

These ship with Claude Code but are skills under the hood. They’re listed alongside built-ins in the commands reference (marked “Skill” in the Purpose column) and you invoke them like any other command.

/simplify

Simplifies code. Claude reads what you point it at and refactors for clarity — fewer abstractions, clearer names, less cleverness.

/batch

Runs batched operations. Useful for “do X to all files matching Y” kinds of tasks where you want predictable, repeated handling rather than improvisation.

/debug

Debugs a problem. Claude takes a structured approach: reproduce, isolate, hypothesize, test, fix. This is much better than just describing your bug in chat because the skill enforces a real debugging methodology.

/loop

Runs iterative loops. Claude works on something repeatedly until a specification is met or a condition is satisfied. Pairs well with autonomous coding workflows.

/claude-api

Helps with the Anthropic/Claude API itself — writing code that calls the API, debugging API issues, exploring features like tool use, batch processing, MCP, and so on.


9. Custom Commands and Skills You Create

Beyond the built-ins, you can create your own. As of the 2026 update, custom commands and skills have been unified — they both create a /your-command and work the same way.

Creating a custom command (the simple way)

Create a markdown file in one of two locations:

  • Project-scoped: .claude/commands/my-command.md (shared via git, project-specific)
  • Personal: ~/.claude/commands/my-command.md (available across all your projects)

The file becomes /my-command. The contents are the prompt Claude follows when you invoke it. Use $ARGUMENTS to capture whatever you type after the command name.

Example .claude/commands/optimize.md:

Analyze this code for performance issues:

$ARGUMENTS

For each issue you find, suggest a specific fix with example code.

Now /optimize src/api/users.ts runs that prompt with the file path inserted.

Creating a skill (the more powerful way)

A skill is a directory rather than a single file. It can include supporting files like reference docs, scripts, and templates.

~/.claude/skills/explain-code/
├── SKILL.md           # Main instructions (required)
├── examples.md        # Loaded only when needed
└── scripts/
    └── visualize.py   # Script Claude can execute

SKILL.md has YAML frontmatter that controls behavior:

---
name: explain-code
description: Explains code with visual diagrams and analogies. Use when explaining how code works.
disable-model-invocation: false
allowed-tools: Read Grep
---

When explaining code, always include an analogy, an ASCII diagram,
a step-by-step walkthrough, and a common gotcha.

Key frontmatter fields:

  • name — becomes the slash command. Lowercase letters, numbers, hyphens only.
  • description — what the skill does. Claude uses this to decide when to load it automatically. Front-load the key use case; descriptions get truncated past 250 characters.
  • disable-model-invocation: true — only you can invoke it. Use for /deploy, /commit, /send-slack-message — anything with side effects you don’t want Claude triggering on its own.
  • user-invocable: false — only Claude can invoke it. Use for background knowledge that isn’t a meaningful action for users.
  • allowed-tools — tools Claude can use without per-use approval when this skill is active.
  • model — the model to use when this skill runs.
  • effort — effort level when active (low/medium/high/max).
  • context: fork — runs the skill in an isolated subagent context.
  • agent — which subagent type to use when forking (Explore, Plan, general-purpose, or a custom one).
  • paths — glob patterns that limit when the skill activates.
  • argument-hint — autocomplete hint for expected arguments, e.g. [issue-number].

Where skills live

Higher-priority locations override lower ones when names collide:

LocationPathApplies to
Enterprise(managed settings)All users in the org
Personal~/.claude/skills/<name>/SKILL.mdAll your projects
Project.claude/skills/<name>/SKILL.mdThis project only
Plugin<plugin>/skills/<name>/SKILL.mdWherever the plugin is enabled

Precedence: enterprise > personal > project. Plugin skills use a plugin-name:skill-name namespace so they can’t conflict.

String substitutions inside skill content

  • $ARGUMENTS — everything you typed after the command name
  • $ARGUMENTS[0], $ARGUMENTS[1], etc. — individual arguments by index
  • $0, $1, etc. — shorthand for the above
  • ${CLAUDE_SESSION_ID} — current session ID
  • ${CLAUDE_SKILL_DIR} — directory containing the SKILL.md

So /migrate-component SearchBar React Vue with content Migrate $0 from $1 to $2 becomes Migrate SearchBar from React to Vue.

Dynamic context injection

Use !`<command>` syntax to run shell commands before the skill content reaches Claude. The output replaces the placeholder.

## PR context
- Diff: !`gh pr diff`
- Comments: !`gh pr view --comments`

## Your task
Summarize this pull request...

Each !`...` runs first; Claude sees the actual PR data, not the command.


10. MCP Server Commands

When you connect an MCP server, its prompts appear as slash commands automatically:

/mcp__github__create-issue
/mcp__slack__send-message
/mcp__atlassian__find-jira-ticket

The format is always /mcp__<server>__<prompt>. They’re discovered dynamically — connect a new server and its commands show up; disconnect and they vanish.

Common MCP servers people connect:

  • GitHub — issues, PRs, code search
  • Slack — read/send messages, search channels
  • Google Drive / Calendar — files and events
  • Atlassian (Jira/Confluence) — tickets and docs
  • Miro — diagrams and boards

11. Special Syntax: @, !, and #

Not technically slash commands, but they live in the same input box and worth knowing.

@ — file/directory mentions

Type @ and Claude Code autocompletes file and directory paths from your project. Use it to give precise context without copy-paste:

Refactor @src/auth/login.ts to use the patterns in @src/auth/signup.ts

You can also @ URLs and Git references in modern versions.

! — direct shell commands

Prefix with ! to run a shell command directly, bypassing Claude’s conversational mode:

!ls -la src/
!npm test

This is more token-efficient than asking Claude “can you list the files in src” because Claude doesn’t need to think about it — it just runs.

# — quick memory adds

Prefix with # to add something to CLAUDE.md instantly:

# Always use TypeScript strict mode in this project
# The staging API is at staging-api.example.com

Future you (and future Claude) will be grateful.


12. Tips, Gotchas, and Best Practices

A few hard-won lessons from people who use Claude Code daily:

Start every project with /init. Generating CLAUDE.md upfront prevents Claude from re-discovering your project conventions every session. The token savings alone pay for it.

Use /clear aggressively. When you switch tasks, clear. There’s no benefit to dragging old context into a new problem, and Claude will spend tokens running auto-compaction trying to summarize it.

/compact for continuity, /clear for clean slates. Different tools, different jobs.

Add disable-model-invocation: true to anything with side effects. You don’t want Claude deciding to deploy because your code “looks ready.”

Pre-approve safe tools in /permissions. Routine git commands, common build tools, read operations on code files. Reserve permission prompts for things that actually matter.

Skill descriptions are loaded into context — keep them tight. Front-load the key use case. Anything past 250 characters gets truncated in the skill listing.

Skills get re-attached after compaction, but only the most recent invocation of each. If a skill’s behavior fades after a long session, re-invoke it.

Use /agents and subagents for big exploration. Forking to a subagent keeps your main conversation clean and prevents context pollution. The Explore agent is especially good for “go read the codebase and tell me how X works.”

/help is the source of truth. This article is current as of April 2026, but Anthropic ships updates frequently. When in doubt, /help shows you what’s actually in your version.

Set SLASH_COMMAND_TOOL_CHAR_BUDGET if you have many skills. The default budget is 1% of the context window with an 8,000 character fallback. If your skill descriptions are getting truncated and Claude isn’t matching them well, raise this limit.


Closing Thoughts

Claude Code’s slash command system is genuinely well-designed — there’s a clear separation between deterministic built-ins, prompt-based skills, custom extensions, and external integrations via MCP. Once you internalize that taxonomy, the tool stops feeling like a black hole and starts feeling like a programmable environment.

The commands you’ll use 90% of the time are a small subset: /clear, /compact, /init, /memory, /model, /review. Master those first. The rest are there when you need them.

For the live, always-current reference, the official docs are at:

  • Slash commands: https://code.claude.com/docs/en/slash-commands
  • Commands reference: https://code.claude.com/docs/en/commands
  • Claude Code overview: https://docs.claude.com/en/docs/claude-code/overview

Happy coding.

Leave a Reply