Skip to main content

Claude Code Slash Commands: The Complete Guide

Learn Claude Code slash commands, from built-in ones like /clear and /model to creating your own custom commands with arguments and namespacing.

Hosna Kachooee By Hosna Kachooee Updated August 2026

Slash commands are how you steer Claude Code without typing a full request. You start a line with a forward slash, pick a command, and Claude Code either runs a built-in action or loads instructions you wrote yourself. Learning the common ones and creating a few of your own is one of the fastest ways to speed up your workflow. Here is how they work in August 2026.

If you have not set up the tool yet, start with installing Claude Code and browse the full Claude Code hub for related guides.

What slash commands are

A slash command is a shortcut typed into the Claude Code prompt. Type / and you get an autocomplete menu of everything available in your session. There are two broad kinds:

  • Built-in commands and bundled skills that ship with Claude Code, like /help or /clear.
  • Custom commands you create, which are just Markdown files with instructions Claude follows when you invoke them.

Some built-ins run fixed logic directly (for example, /clear wipes the context). Others, called bundled skills, hand Claude a set of instructions and let it do the work. You invoke both the same way.

The built-in commands worth knowing

You do not need to memorise all of these. Type / in Claude Code any time to see the current list, since availability depends on your platform and plan. These are the ones you will reach for most:

CommandWhat it does
/helpShow help and the available commands.
/clearStart a new conversation with empty context. Aliases: /reset, /new.
/compactSummarise the conversation so far to free up context without losing the thread.
/modelSwitch the model and save it as the default for new sessions.
/configOpen the settings interface for theme, model, output style, and preferences. Alias: /settings.
/initScan the project and create a CLAUDE.md guide for it.
/memoryEdit CLAUDE.md files and manage what Claude remembers.
/agentsCreate and manage subagents.
/mcpManage MCP server connections and authentication.
/permissionsManage the allow, ask, and deny rules for tools. Alias: /allowed-tools.
/code-reviewReview the current diff, a PR, a branch, or a path for bugs and cleanup. Alias: /review.
/contextVisualise how much of the context window is in use.
/costShow usage and cost for the session. Alias: /usage.
/resumeReturn to an earlier conversation.
/add-dirGrant file access to another directory during the session.
/doctorRun a setup checkup to diagnose and fix issues.

A few of these connect to bigger topics. /mcp pairs with setting up MCP servers, /agents with subagents, /memory and /init with memory and CLAUDE.md, and /permissions with managing permissions.

Creating your own commands

The real power comes from custom commands: your own repeated instructions saved once and triggered with a slash. In recent versions of Claude Code, custom commands have merged into skills, but the simple approach still works exactly as before.

The quickest way is a Markdown file in a commands folder:

  • Project command: .claude/commands/<name>.md in your repo. Shared with anyone who works in that project.
  • Personal command: these now live as skills in ~/.claude/skills/<name>/SKILL.md and follow you across every project.

The file name (or skill folder name) becomes the command. A file at .claude/commands/deploy.md gives you /deploy. When a personal and a project command share a name, the personal one wins.

A real example

Say you keep asking Claude to write a conventional commit for your staged changes. Turn it into a command. Create .claude/commands/commit.md:

---
description: Write a conventional commit message for the staged changes
argument-hint: [optional scope]
---

Write a conventional commit message for the currently staged changes.

- Use the format type(scope): summary
- Keep the summary under 60 characters
- If a scope was provided, use it: $ARGUMENTS
- List the key changes as bullet points in the body

Now typing /commit runs those instructions, and /commit auth passes auth in as $ARGUMENTS. The description and argument-hint fields show up in the autocomplete menu so you remember what the command does and what it expects.

Passing arguments

The $ARGUMENTS placeholder is replaced by whatever you type after the command name. You can also grab individual arguments by position with $0, $1, $2 and so on (or the longer $ARGUMENTS[0] form). For example, a migrate.md command containing:

Migrate the $0 component from $1 to $2. Preserve existing behaviour and tests.

lets you run /migrate SearchBar React Vue, and each placeholder fills in from your input. Wrap multi-word values in quotes to keep them as one argument.

Namespacing with folders

Subdirectories let you group related commands. A file at .claude/commands/frontend/component.md still becomes /component, and the folder shows up as a namespace label in the menu, which keeps things tidy once you have a lot of commands.

Skills: the newer, fuller version

If you want more than a single file, use a skill instead. A skill is a folder with a SKILL.md file. It supports the same arguments and frontmatter as a command file, plus a few extra abilities: supporting files kept alongside it, control over whether Claude can trigger it on its own, and the option to run it in a separate context. Skills live in the same places:

  • Personal: ~/.claude/skills/<name>/SKILL.md
  • Project: .claude/skills/<name>/SKILL.md

The description field matters here, because Claude reads it to decide when to load the skill automatically. If you want a command that only you trigger, and never Claude on its own, add disable-model-invocation: true to the frontmatter. That is the right choice for anything with side effects, like a deploy or a commit.

Existing .claude/commands/ files keep working, so there is no rush to convert them. Reach for a skill when a command grows past one file or you want Claude to invoke it automatically.

Keep going

Slash commands are one piece of getting fluent with AI tooling. If you want the bigger picture of working with AI day to day, our AI course covers prompting, tools, and real workflows, and you can start with the free lessons. From here, wiring up MCP servers, hooks, and subagents will take your Claude Code setup further.

Frequently asked questions

What is a slash command in Claude Code?

It's a shortcut you type into the Claude Code prompt, starting with a forward slash, that runs an action instead of sending a normal message. Some are built in, like /clear to reset the conversation or /model to switch models, and you can also create your own for repeated workflows.

How do I create a custom slash command?

Create a Markdown file inside .claude/commands/ in your project (or in ~/.claude/skills/ as a skill folder for personal use). The file name becomes the command, so deploy.md gives you /deploy. Anthropic now recommends skills, which are a folder with a SKILL.md file that supports the same features plus supporting files.

What is the difference between project and personal commands?

Project commands live in your repo's .claude/ folder and are shared with anyone who works in that project. Personal ones live in ~/.claude/ and follow you across every project on your machine. When names clash, personal takes precedence over project.

Start free

Get free access to our beginner courses

Drop your email and we'll let you know the moment each free course is live - plus new courses and deals. No spam, unsubscribe anytime.

Master Claude Code from start to finish

This is one lesson from a much larger course. Get the full course with a single one-time payment and lifetime access.

Explore our AI course