Claude Code Slash Commands Explained: The Essentials

Claude Code Slash Commands Explained: The Essentials

Claude Code slash commands are short instructions that start with a forward slash, like /help or /clear, and they control the tool itself instead of asking Claude to do a task. With them you can switch models, free up memory, rename a session, ask a quick side question or start over without leaving your terminal. Once you know a dozen of them, every session feels faster and more under your control.

This guide covers the essential commands you will use every day. We ran each one in a real session on a Mac, inside a tiny demo folder, so every screenshot shows what Claude Code actually printed.

This is Part 8 of 53 in our Claude Code tutorials series. In the previous part we covered interactive mode shortcuts, where the slash first showed up as one of the input prefixes. This part goes deeper into the commands behind it.

Tested with Claude Code v2.1.309 on October 24, 2026, on macOS, in a throwaway demo folder with two small files. Which commands you see depends on your plan, platform and installed plugins, so your menu may look a little different.

Quick Summary: Claude Code Slash Commands at a Glance

CommandWhat it doesWhen to use it
/helpShows help and available commandsWhen you forget a key or command
/modelSwitches the AI modelHarder task or faster answers
/effortSets how much reasoning Claude appliesTough problems or quick checks
/btwAsks a side question without adding it to historyQuick off-topic questions
/contextShows what fills the context windowBefore a long session gets slow
/compactSummarizes the chat to free spaceSame task, long conversation
/clearStarts a new conversation with empty contextSwitching to a new task
/resumeReopens an earlier conversationComing back to old work
/renameNames the current sessionFinding it later in /resume
/rewindRolls code and chat back to a checkpointWhen an edit went wrong

What Are Claude Code Slash Commands and Why Do They Exist?

When you type a normal message, it goes to Claude as a prompt. When your message starts with a slash, Claude Code reads it first and treats it as a command. Anthropic’s commands reference describes them as a quick way to switch models, manage permissions, clear context and run workflows from inside a session.

There are two kinds. Built-in commands, like /clear or /model, are coded into the tool. Bundled skills, like /code-review or /loop, are prompts handed to Claude, and they work the same way as skills you write yourself.

A slash command talks to Claude Code. A normal message talks to Claude.

Two simple rules matter most. A command is only recognized at the start of your message, and any text after the command name becomes its argument. So /rename tip-calculator renames the session to tip-calculator, while “please /rename this” is just a normal prompt.

Required and optional arguments

The official reference uses angle brackets for required arguments and square brackets for optional ones. For example, /add-dir <path> needs a path, while /compact [instructions] works fine on its own.

  • /model with no argument opens a picker, or /model sonnet switches directly.
  • /compact alone summarizes everything, or /compact keep the test results focuses the summary.
  • /clear alone starts fresh, or /clear old-bug labels the previous chat in the /resume list.

Step 1: Open the Command Menu With a Slash

Start Claude Code in a project folder and type a single slash on an empty prompt. A menu appears with every command available to you, each with a one-line description. If you are new to starting sessions, our guide to your first session walks through launch and the trust prompt.

Claude Code command menu opened by typing a slash, listing commands such as add-dir, advisor, artifacts, autocompact and background with descriptions
Typing / on an empty prompt opened the full command menu.

Our list also shows skills from plugins installed on this Mac, so yours will look different. Use the arrow keys to move through the list, and press Enter to run the highlighted command.

Step 2: Filter the List by Typing Letters

The full menu is long, so keep typing. Each letter after the slash narrows the list to commands whose names or descriptions match. In our test, typing /co showed /copy, /color, /config, /compact, /context and /code-review right at the top.

Claude Code slash menu filtered by the letters co, showing copy, color, config, compact, context and code-review commands
Typing /co narrowed the menu to matching commands.

Aliases find the same command

Many commands have aliases, which are other names that run the same thing. The docs list /new and /reset as aliases for /clear, and our test confirmed it: typing /new highlighted /clear with “new” shown in brackets.

Claude Code menu showing clear highlighted with the alias new in brackets after typing slash new
Typing /new found /clear through its alias.

The menu also ignores dashes. When we typed /adddir with no dash, it still highlighted /add-dir, which matches how the docs say highlighting works in recent versions.

What happens after a typo

If your letters match nothing, Claude Code shows a “No commands match” message. When we pressed Enter on /clr anyway, it replied with an Unknown command notice and suggested a close match.

Claude Code showing Unknown command: /clr. Did you mean /cd? after submitting a mistyped command
A mistyped /clr returned an Unknown command message.

Note the suggestion was /cd, not /clear, so read it before you accept. The safe habit is to wait for a highlighted match before pressing Enter.

Step 3: Get Help With /help

The /help command opens a panel with three tabs: General, Commands and Custom commands. The General tab lists the most useful shortcuts, including the slash for commands, the exclamation mark for shell mode and /btw for side questions.

Claude Code help panel with General, Commands and Custom commands tabs, listing shortcuts for shell mode, commands, file paths and side questions
The /help panel opened on its General tab.

The panel itself says to press Esc to close it. It’s the fastest way to check a shortcut without leaving your terminal.

Step 4: Switch Models With /model and /effort

Before we tried more commands, we sent one normal prompt so the session had something to work with. Claude read our tiny tip.py file and answered in one sentence that it works out a restaurant tip, 15% by default.

Next, /model with no argument opened a picker with the models available to our account. The docs say your pick becomes the default for new sessions, and the picker itself reminded us that pressing s switches for this session only.

Claude Code Select model picker listing available Claude models with a note that Enter sets the default and s uses the model for this session only
The /model picker with its Enter and s options at the bottom.

The picker also showed the effort level with left and right arrows to adjust it. You can check the level directly with /effort status, which printed “auto (currently medium)” in our session. The model configuration docs explain each level in detail.

Step 5: Ask a Side Question With /btw

Sometimes you want a quick fact without cluttering the main conversation. That’s what /btw is for, so we used it to ask which default percent tip() uses and got a short answer in a separate panel.

Claude Code btw side question panel answering that tip uses 15 percent by default with options to scroll, copy, fork or close
/btw answered a side question in its own panel.

According to the docs, the side question is not added to the conversation. The panel offered keys to copy the answer, fork it or close it with Esc.

Step 6: Organize the Session With /rename and /color

If you run several sessions, names and colors help you tell them apart. We ran /rename tip-calculator and then /color blue, and both changes showed up on the prompt bar right away.

Claude Code output confirming Session renamed to tip-calculator and Session color set to blue, with the name shown on a blue prompt bar
/rename and /color labeled the session on the prompt bar.

The available colors are red, blue, green, yellow, purple, orange, pink and cyan, and /color default resets it. A named session is also much easier to spot later in the /resume picker.

Step 7: Free Up Context With /compact and /clear

Long chats fill Claude’s context window, which is its working memory. Running /context shows a colored grid of what is using that space, and in our demo it also listed every skill with its token cost. If you want the background on context, our guide on the agent loop explains it.

To free space on the same task, use /compact. We ran /compact keep only the tip.py facts, and Claude Code replaced the earlier turns with a summary while keeping what we asked for.

Claude Code showing compact with focus instructions and the result Compacted, with ctrl+o to see the full summary
/compact summarized the chat using our focus instructions.

When you move on to something unrelated, /clear is the better choice. It starts a new conversation with empty context, and the docs say you can return to the old one with /resume.

Claude Code screen after running clear, showing an empty conversation with the session name still on the prompt bar
After /clear the conversation was empty again.

Diagrams: Which Slash Command to Use and When

The official reference groups commands by where they fit in a typical workflow. Here is our own version of that idea as a quick visual guide.

Diagram matching session stages like setting up a project, during a task, long chat, before shipping, between sessions and when something goes wrong to the right Claude Code slash commands
Our map of which commands fit each stage of a session.

The three commands people mix up most are /btw, /compact and /clear. They all deal with the conversation, but they do very different things to it.

Diagram comparing btw, compact and clear: btw adds nothing to history, compact replaces earlier turns with a summary, clear starts an empty conversation
How /btw, /compact and /clear treat your conversation.

Real Examples of Slash Commands in Daily Work

Here is how these commands fit into ordinary days with Claude Code. Each one maps to a moment you will likely recognize.

SituationCommand to tryWhy it helps
First time in a new repo/initCreates a starter CLAUDE.md guide
Big change ahead/plan fix the login bugEnters plan mode and starts on the task
Quick syntax question mid-task/btwKeeps the main chat focused
Chat feels slow and long/context then /compactSee the problem, then free space
Done with one feature/clearNew task, clean memory
Want to see what Claude changed/diffReviews edits in your working tree
An edit broke something/rewindRolls code and chat back to a checkpoint
Setup feels off/doctorRuns a setup checkup and proposes fixes

If you are still choosing how to sign in or which plan to use, our page on plans and login explains why some commands appear only for certain accounts.

Try It Yourself

Make a small practice folder with one short script, start Claude Code there, and run this practice round. It uses only one or two prompts, so it stays cheap.

  1. Type / and scroll the menu, then type /co to filter it.
  2. Run /help and look through the three tabs.
  3. Send the prompt below, then try /btw with a follow-up question.
  4. Run /rename practice and /color green.
  5. Run /compact, then /clear, and finally /resume to find your named session.
In one short sentence, what does the script in this folder do?

If you need help creating the folder and launching Claude Code, the install guide covers the setup steps.

Common Mistakes With Slash Commands

  • Putting the command in the middle of a sentence. Claude Code only recognizes it at the start of a message.
  • Pressing Enter on a typo. If nothing is highlighted, Enter submits your text as typed and returns Unknown command.
  • Using /clear when you meant /compact. /clear starts a new conversation, so Claude no longer has the earlier details in context.
  • Expecting /btw answers to stick. Side questions are not added to the conversation, so ask normally if Claude needs to remember it.
  • Changing the model by accident. Pressing Enter in the /model picker saves your pick as the default for new sessions, while s keeps it to this session.
  • Assuming every command exists for everyone. The docs note that availability depends on platform, plan and environment.

Pro Tips for Claude Code Slash Commands

  • Pass focus text to /compact, such as /compact keep the failing test names, so the summary keeps what matters.
  • Give a name with /clear, like /clear auth-work, to label the old chat in the /resume picker.
  • Use /plan with a description to enter plan mode and start the task in one step.
  • Run /context before a long session gets sluggish, not after.
  • Check /release-notes after updating to see what new commands arrived.
  • Some commands, such as /status and /usage, run immediately even while Claude is responding, according to the docs.

Many shortcuts pair well with commands. Our earlier part on terminal setup helps make sure keys like Shift+Enter work in your terminal.

Claude Code Slash Commands Cheat Sheet

Save or bookmark this card for your next session. It covers the essentials from this guide.

Claude Code slash commands cheat sheet listing commands to find and run, such as help, model, effort, plan and init, and commands to manage the session, such as btw, context, compact, clear, resume, rename, rewind and diff
The essential slash commands on one card.

Frequently Asked Questions

How do I see all Claude Code slash commands?

Type a single slash on an empty prompt to open the menu, or run /help and open its Commands tab. The full list also lives in Anthropic’s official command reference.

What is the difference between /clear and /compact?

/compact keeps the same conversation but replaces earlier turns with a summary. /clear starts a brand new conversation with empty context, and you can return to the old one with /resume.

Can I create my own slash commands?

Yes. The docs point to skills as the way to add your own commands, and they show up in the menu next to the built-in ones. We will cover that in a later part of this series, and you can read the skills docs now.

Why don’t I see a command mentioned in a tutorial?

Claude Code leaves commands you can’t use out of the menu. Availability depends on your platform, plan, version and environment, and a few commands such as /heapdump are hidden until you type the full name.

Can I run a slash command while Claude is still answering?

Yes. The docs say Claude Code queues most commands until the current turn finishes, while a few, such as /status, /tasks and /usage, run immediately.

Conclusion

Claude Code slash commands give you direct control over the tool itself. Type a slash to open the menu, add letters to filter it, and lean on a small core set: /help when you’re stuck, /model and /effort to tune Claude, /btw for side questions, /compact and /clear to manage memory, /rename and /resume to keep sessions organized, and /rewind when something goes wrong. Start with the ten commands in the summary table and add more as your projects grow. To learn more about the models behind the tool, visit our Claude AI page, or read our Claude Code overview if you’re new to the series.

Previous in the series: Part 7: Claude Code Interactive Mode: Shortcuts and Input Tricks

Next in the series: Part 9: Advanced Claude Code Slash Commands You Should Know.

Newsletter

New AI tools in your inbox

The best new tools and the AI news that matters, in one short email. Unsubscribe any time.

Free · No spam · Unsubscribe any time

✓ Looks like you’re subscribed

Loading Google’s sign-up form…

Looks like you’re already subscribed

Thanks for reading! New AI tools and the AI news that matters will land in your inbox.

Not subscribed yet? Refresh the page to load the sign-up form.

The sign-up form couldn’t load. If you use an ad or content blocker, allow news.google.com and reload the page.

Free instant check before you pay. Takes a few seconds.

Scroll to Top