Skip to main content

Slash Commands Overview

Module: Navigation & Shortcuts | Lesson: 2 of 4 | Time: ~10 minutes

What You Will Learn

  • What slash commands are in Claude Code
  • How to invoke slash commands
  • How to discover available commands with /help

Prerequisites

What Are Slash Commands?

In the previous lesson, you learned keyboard shortcuts — key combinations that speed up your workflow. Slash commands are the next level. They are special instructions that start with a forward slash (/) and trigger specific actions inside Claude Code.

Think of the difference this way:

  • A regular prompt: You describe what you want in natural language, and Claude figures out how to do it.
  • A slash command: You give Claude a direct instruction to perform a specific, built-in action.

For example, instead of saying "Can you clear our conversation history and start fresh?", you can simply type:

/clear

Slash commands are faster, more predictable, and always do exactly the same thing.


How Slash Commands Differ from Regular Prompts

Regular PromptSlash Command
Starts withAny textA / character
Interpreted byClaude's AIClaude Code's built-in system
ResultVaries based on Claude's understandingAlways performs the same action
Example"Show me how much this session costs"/cost
When to use which

Use a regular prompt when you want Claude to think, create, or problem-solve. Use a slash command when you want to trigger a specific built-in action like clearing the screen, checking costs, or compacting the conversation.


How to Invoke a Slash Command

Using a slash command is simple:

  1. Type / at the beginning of your input.
  2. Type the command name (for example, help).
  3. Press Enter.
/help

That is it. No extra words needed — just the slash, the command name, and Enter.

Some slash commands accept additional arguments after the command name. For example:

/compact Focus on the JavaScript functions we discussed

This tells the /compact command to focus its summary on a specific topic.


Discovering Available Commands

The easiest way to see what slash commands are available is to type / by itself and pause. Claude Code will show you a list of available commands with brief descriptions.

You can also type /help to see a list of commands with more detail:

/help
Commands may evolve

Claude Code is actively developed, so new slash commands may be added over time. Use /help periodically to discover new ones. The commands covered in this tutorial are the stable, core set.


Categories of Slash Commands

Slash commands fall into a few broad categories:

Session Management

Commands that control your current session — clearing the conversation, compacting it, or exiting.

Examples: /clear, /compact, /exit

Information and Diagnostics

Commands that show you useful information about your current session or configuration.

Examples: /help, /cost, /config

Memory and Configuration

Commands that interact with Claude Code's memory and project settings.

Examples: /memory, /init

Development Workflow

Commands that help with code review, pull requests, and other developer tasks.

Examples: /review, /pr-comments

Custom Commands

You can even create your own slash commands that run prompts you define. You will learn about these in Lesson 4: Advanced Slash Commands.


Try It Yourself

Let us explore slash commands hands-on:

  1. Open Claude Code in any folder.
  2. Type / and pause. Look at the list of available commands that appears.
  3. Run /help and read through the output. Note which commands look familiar and which are new to you.
  4. Run /cost to see your current session's token usage.
  5. Try an invalid command — type /notarealcommand and press Enter. Notice what happens (Claude will let you know the command does not exist).
  6. Ask Claude about a command: Type What does the /compact command do? as a regular prompt. Notice how Claude can explain slash commands even through regular conversation.

What You Learned

  • Slash commands start with / and trigger specific, built-in actions in Claude Code.
  • They are different from regular prompts — they always perform the same action, rather than being interpreted by Claude's AI.
  • Type / by itself to see a list of available commands.
  • /help gives you detailed information about all available commands.
  • Commands fall into categories: session management, information, memory, development workflow, and custom commands.

Help Us Improve

How was this lesson? Take 2 minutes to share your feedback — it helps us make the tutorials better for everyone.

Give Feedback →

Next Up

Next: Essential Slash Commands