What Are Slash Commands in Claude Code?

You’re in the middle of a coding session with Claude Code and you realize you need to ask it to review your code the same way you always do — same format, same checklist, same tone. So you type it all out. Again. For the fifth time this week.

There’s a better way.

Slash commands are shortcuts that let you trigger a pre-written set of instructions with a single line of text. Instead of typing a paragraph every time you want Claude Code to do something specific, you type /review — and Claude knows exactly what to do.

📋 TL;DR
– Slash commands are reusable shortcuts you type into Claude Code to trigger specific instructions
– They start with a / and can be built-in (created by Anthropic) or custom (created by you)
– They live in .md files inside your .claude/commands/ folder
– They save you from typing the same prompts over and over
– You can use them for code review, git commits, documentation, and anything else you repeat regularly

This is part of our complete Claude Code Slash Commands & Skills — Full Guide, which covers everything from basic commands to advanced skill workflows.


What Is a Slash Command in Plain English?

Think of slash commands like text expanders for your coding workflow. You know how some people set up a keyboard shortcut so typing omw auto-expands to “On my way!”? Slash commands work the same idea — except instead of expanding a phrase, they send a full set of instructions to Claude Code.

When you type /review in the Claude Code prompt, Claude reads a pre-written .md file you created, follows every instruction in it, and applies those to whatever code you’re working on. The whole thing happens in one keystroke instead of you retyping a 10-line prompt.

If you’re brand new to Claude Code itself, start with What is Claude Code? first — it’ll give you the foundation you need before commands make full sense.


The Two Types of Slash Commands

There are two kinds of slash commands in Claude Code: built-in commands and custom commands.

Built-in Slash Commands

Built-in slash commands come pre-installed with Claude Code. Anthropic created them. You don’t need to set anything up — they just work from day one.

Examples include:

  • /help — shows you what Claude Code can do
  • /clear — clears the conversation and context
  • /compact — summarizes your conversation to free up context space
  • /memory — lets you view and edit Claude’s memory of your project

These are covered in full detail in Built-in Claude Code Slash Commands — Full Reference.

Custom Slash Commands

Custom slash commands are ones you build yourself. You write a plain text instruction file, save it with a .md extension in the right folder, and Claude Code makes it available as a command.

This is where the real power is. You can build commands that match your workflow exactly — the way you like code reviewed, the specific git commit format your team uses, or the documentation style your company requires.

Custom commands are the focus of How to Create Your First Custom Slash Command.


How Do Slash Commands Actually Work?

Here’s the mechanics, step by step.

Step 1: You Create an Instruction File

You write a Markdown file containing instructions for Claude. This is just a plain text file — no coding required.


# What this file does: instructions for a /review command

Review the code I share with you using this checklist:

1. Check for any obvious bugs or logic errors
2. Flag any variables that are named unclearly
3. Suggest one improvement to readability
4. Keep your response under 200 words

Be direct. Skip the pleasantries.

Step 2: You Save It in the Right Folder

You save that file as review.md inside .claude/commands/ — either in your project folder or globally on your machine. The file name becomes the command name.


# This is the path structure for a project-level slash command
your-project/
└── .claude/
    └── commands/
        └── review.md   ← typing /review will trigger this file

Step 3: You Type the Command in Claude Code

In your Claude Code session, you type:


# How you call your slash command in the terminal
/review

Claude Code finds the file, reads every instruction in it, and applies them to your current task.

That’s the whole system. Write instructions → save in the right place → call with /commandname.

The Claude Code terminal prompt with /review typed, showing command auto-completion dropdown appearing


Why Slash Commands Matter (The Practical Version)

If you’re a developer, here’s the honest value proposition: slash commands eliminate repetitive prompting.

Every developer has prompts they type over and over. “Review this for security issues.” “Write a git commit message following conventional commits format.” “Add JSDoc comments to these functions.” Once you turn each of those into a slash command, you never type them again.

If you’re a non-technical founder using Claude Code to build or manage a product: slash commands are how you turn Claude into a teammate who always follows your preferences. You write the instructions once, in plain English, and Claude follows them perfectly every time you call the command.

💡 Pro Tip: The best time to create a slash command is the second time you type the same long prompt. If you typed it twice, you’ll type it a hundred times. Make it a command.


A Real Example: Before and Without a Slash Command

Here’s what the same task looks like with and without a slash command.

Without a slash command — you type this every time:


# What you type manually every time you want a code review
Please review this code. Check for bugs, unclear variable names, 
and suggest one readability improvement. Keep the response under 
200 words. Be direct, skip the preamble.

With a slash command — you type this:


# What you type after setting up a /review command
/review

Same result. Every time. In two characters.

Now multiply that by every repeated task in your workflow. That’s the value.


Where Slash Commands Live on Your Computer

Slash commands are stored as .md files inside a .claude/commands/ directory. There are two places this folder can live:

Project-level — inside your specific project:


your-project/
└── .claude/
    └── commands/
        └── your-command.md

Global level — on your machine, available in every project:


~/.claude/
└── commands/
    └── your-command.md

Project-level commands are only available when you’re inside that project. Global commands follow you everywhere.

Choosing between these isn’t complicated, but it’s worth understanding. Where to Store Slash Commands (Project vs Global) covers the decision in full.


What’s the Difference Between Slash Commands and Skills?

You might have seen the word Skills mentioned alongside slash commands. They’re related but not the same thing.

A Skill in Claude Code is a more structured, automated version of a slash command. Skills use a special file called SKILL.md and can be triggered automatically by Claude — without you typing anything — when it detects you’re doing a certain kind of task.

Slash commands are always manually triggered. You type /commandname. Skills can be triggered for you.

The full comparison is in Skills vs Slash Commands — What’s the Difference?. For now, just know that slash commands are the simpler starting point, and skills are what you graduate to.


Common Misunderstandings

“Do I need to know how to code to use slash commands?”

No. The instruction files are plain English. If you can write clear instructions for a person, you can write a slash command.

“Will my slash commands work on every computer?”

Project-level commands only work in that project’s folder. Global commands work everywhere on your machine — but not on your teammate’s machine unless they copy the file.

“Are slash commands the same as prompts?”

They’re stored prompts with a shortcut. The underlying content is instructions in plain language. The slash command is just how you call them quickly.

⚠️ Warning: Don’t confuse Claude Code slash commands with slash commands in other tools like Slack or Discord. They use the same / syntax but are completely different systems.


Key Takeaways

  • A slash command is a reusable shortcut that triggers a pre-written instruction file in Claude Code
  • They start with / followed by the command name (which matches the filename)
  • Built-in commands like /help and /clear come with Claude Code; custom commands** are ones you write yourself
  • Command files are plain .md files stored in .claude/commands/ — no coding required
  • They exist at the project level (one project) or global level (all projects on your machine)

Next Steps

Now that you know what slash commands are, here’s where to go next:

Return to Claude Code Slash Commands & Skills — Full Guide for the full picture.