Claude Code Slash Commands: The Hidden Shortcuts That Speed Up Your Workflow

Learn how to use Claude Code's built-in slash commands to skip repetitive typing, manage your session, and get more done with less friction.

I Ignored These for Way Too Long

When I first started using Claude Code seriously, I was basically treating it like a fancy chat window. Type a question, read the answer, type another question. It worked, but something felt clunky about it — like I was doing extra work I shouldn't have to do.

Then one day I accidentally typed a forward slash and noticed a little menu pop up. Slash commands. They'd been there the whole time and I'd been completely ignoring them.

Turns out these aren't just shortcuts — some of them fundamentally change how you interact with Claude Code. Once I started using them consistently, my whole workflow got tighter. Less repetition, better context management, faster debugging sessions. This article is the explainer I wish I'd had on day one.

What Slash Commands Actually Are

Slash commands are built-in shortcuts that trigger specific behaviors in Claude Code. You type them directly into the chat input, starting with a /, and Claude handles the rest without you having to explain yourself in plain English every time.

Think of them like keyboard shortcuts in your code editor. You could click through menus to format your code — or you could just hit the hotkey. Slash commands are the hotkey version of common Claude Code actions.

The key difference from just typing instructions? Slash commands are deterministic. When you type /clear, Claude clears the context. Every time. No interpretation, no variation. That predictability is actually really useful once you understand when to lean on it.

The Commands You'll Actually Use

There are quite a few slash commands available, but honestly, a handful cover about 90% of real-world usage. Let me walk through the ones that changed how I work day-to-day.

/clear — Your Fresh Start Button

This one clears the conversation context completely. When I first learned about context windows (basically, how much Claude can "remember" in a session), I started treating /clear like a reset valve.

The classic mistake: you've been debugging one function for 45 minutes, the conversation is long and tangled, and now Claude keeps referencing old broken code when you ask something new. Just clear it and start fresh with a clean problem statement. Your token usage will thank you too.

claude code
# When your session has gone off the rails
/clear
→ Conversation context cleared. Starting fresh.

# Now give Claude a clean, focused problem statement
Here's the function I'm trying to fix. It should...

/compact — Summarize Without Losing the Thread

This is the smarter sibling of /clear. Instead of wiping everything, /compact asks Claude to summarize the conversation so far and continue with that compressed context.

I use this when I'm in the middle of a long feature build and I'm hitting the point where the conversation is getting heavy, but I don't want to lose all the decisions we've already made. Claude condenses everything into a tight summary, frees up context window space, and we keep going.

/memory — Reading and Setting Persistent Instructions

This one pairs directly with your CLAUDE.md file. Running /memory shows you what persistent instructions Claude is currently working with. If you've ever wondered why Claude keeps using a certain style or seems to remember a preference from a previous session — /memory is how you check.

Memory vs. Context

Memory (CLAUDE.md) persists between sessions. Context is only what's in your current conversation. Use /memory to manage the long-term stuff, /clear or /compact for the short-term stuff. They solve different problems.

/doctor — Quick Health Check

Running into weird behavior? /doctor runs a diagnostic on your Claude Code setup — checks that your configuration looks right, your tools are connected, and nothing obvious is broken. I learned about this one the hard way after a weird afternoon where Claude kept failing on file operations and I couldn't figure out why. Ran /doctor and it pointed me straight at a permissions issue I'd have spent another hour debugging on my own.

/help — Don't Forget This One Exists

Obvious, but genuinely useful. /help lists all available commands with a quick description of each. The slash command list does get updated as Claude Code evolves, so checking /help occasionally is worth doing even once you feel comfortable — there might be something new in there.

Building a Rhythm Around Slash Commands

Here's the thing — knowing the commands is one thing, but knowing when to reach for them is what actually changes your workflow. After a few months of using Claude Code regularly, I've settled into a rhythm that looks something like this:

workflow pattern
# Starting a new task after working on something else
/clear
→ Clean slate for a fresh problem

# 30+ minutes into a complex session, context getting heavy
/compact
→ Compressed — key decisions preserved, tokens freed up

# Something feels off about how Claude is responding
/memory
→ Check if old instructions are interfering

# Tools or file access acting weird
/doctor
→ Diagnose config or permission issues fast

The pattern I'd suggest if you're just getting started: use /clear liberally at first. Seriously. It costs you nothing but a moment of reorientation, and it prevents so many of those "why is Claude being weird right now" situations that come from a cluttered conversation history.

Custom Slash Commands (Yes, You Can Make Your Own)

This is where it gets genuinely fun. Claude Code lets you define custom slash commands in your project's .claude/commands/ directory. Each command is just a markdown file — the filename becomes the command name, and the content becomes the prompt that fires when you run it.

terminal
# Create the commands directory in your project
mkdir -p .claude/commands

# Create a custom command file
touch .claude/commands/review.md

# This becomes available as /project:review

Inside that review.md file, you write whatever prompt you want to fire every time you run /project:review. Something like:

.claude/commands/review.md
# Content of your custom command file
Review the code I'm about to paste. Check for:
- Any obvious bugs or edge cases I've missed
- Functions that are doing too much and should be split
- Variable names that aren't descriptive enough
- Missing error handling
Give me a short summary first, then details.

I have a few of these set up for my common workflows — one for reviewing database queries, one for checking API endpoints before I push them, one that reminds Claude of my project's specific naming conventions before we start a new file. Once they're set up, it's one slash command instead of retyping the same prompt over and over.

Project vs. Global Commands

Commands in .claude/commands/ are project-specific and show up as /project:commandname. You can also create global commands in your home directory at ~/.claude/commands/ — those show up as /user:commandname and work across every project.

One Habit That Made All of This Click

There's one small habit that tied all of this together for me: I started keeping a short note in my CLAUDE.md file listing the custom commands I'd created and what they do. Not because I forget — but because when I come back to a project after a few weeks, I can run /memory, see the list, and immediately remember what tools I built for that project.

It sounds like overkill, but that kind of self-documentation compounds. Three months later when you're back in a project and wondering why you made certain decisions, having that trail is genuinely useful.

Start simple: just try using /clear at the start of each new task for one week. See if it changes how your sessions feel. Then build from there. Once you start noticing which prompts you type over and over, you'll naturally want to turn them into custom commands — and that's when Claude Code really starts feeling like it was built specifically for you.

Keep going

More tutorials in this category, or explore the full field guide.

More Claude Code Tutorials Official Docs ↗