Mindket

Claude Code slash commands: the built-in ones and how to write your own

A black banner with the Claude logo, titled "Claude Code course" over "Install, plan mode, slash commands and hooks in 4 free lessons".

Claude Code slash commands are shortcuts you type at the start of a message, such as /help, /clear and /plan. Type / to see the ones you have. To add your own, create a skill, which is a folder with a SKILL.md file, and its name becomes the command. In Anthropic's docs a custom command is now a skill, and old .claude/commands/ files still work.

In this lesson

  • Type / to list the commands you have, or / plus letters to filter. A command counts only at the start of your message, and the text after it becomes its arguments.
  • Custom commands are skills now: .claude/commands/deploy.md and .claude/skills/deploy/SKILL.md each give you /deploy.
  • $ARGUMENTS in the skill text stands for your input after the command.
  • disable-model-invocation: true stops Claude from running a command on its own, which suits anything with side effects.
All courses
On this page
  1. Before you start
  2. Write your first custom command
  3. The built-in commands to learn first
  4. Custom commands are skills now
  5. Arguments, and who can run a command
  6. How Claude Code's creator turns daily work into commands
  7. Common mistakes
  8. Try it yourself
  9. Next: hooks
  10. Check yourself
  11. Frequently asked questions
  12. Sources

Before you start

You need Claude Code from lesson 1 and a project that uses git, because the sample command reads your uncommitted changes. Slash commands run inside a session. The shell commands from lesson 1, such as claude -p, run from the terminal instead.

Write your first custom command

Anthropic's skills page builds its first example in three moves, and this lesson follows it. The skill below summarizes your uncommitted changes. The line that starts with an exclamation mark runs git diff HEAD, and Claude Code puts the output into the skill before Claude reads it.

---
description: Summarizes uncommitted changes and flags anything risky. Use when the user asks what changed, wants a commit message, or asks to review their diff.
---

## Current changes

!`git diff HEAD`

## Instructions

Summarize the changes above in two or three bullet points, then list any risks you notice such as missing error handling, hardcoded values, or tests that need updating. If the diff is empty, say there are no uncommitted changes.
  1. Make a folder for the command in your personal skills folder: mkdir -p ~/.claude/skills/summarize-changes. Personal skills work in all your projects. On Windows, create the same folder inside your user folder.
  2. Save the text above as SKILL.md in that folder. The folder name becomes the command, so this one is /summarize-changes.
  3. Open a git project, change one file and run claude.
  4. Run the command directly with /summarize-changes. You can also ask "What did I change?" and let Claude load the skill because the description matches.
  5. Edit the description or the instructions and run the command again. Claude Code picks up the change in the same session.

The built-in commands to learn first

The commands reference groups its commands by when you reach for them. In a new repository you run /init for a starter CLAUDE.md, then /memory to refine it. During a task, /plan and /model change how Claude works. When the conversation gets long, /context and /compact deal with the space.

Some entries in that list are bundled skills, such as /doctor and /code-review. They are prompts handed to Claude, and you run them the same way as the commands that execute fixed logic. Which commands you see depends on your platform, plan and environment.

Ten built-in commands, from Anthropic's commands reference
CommandWhat it does
/helpShows help and the available commands
/initInitializes the project with a CLAUDE.md guide
/plan [description]Enters plan mode, and starts on the task if you add a description
/model [model]Switches the model and saves it as your default for new sessions
/contextShows context usage as a colored grid
/compact [instructions]Summarizes the conversation so far to free up context
/clear [name]Starts a new conversation with empty context
/resume [session]Resumes a conversation by ID or name, or opens the session picker
/rewindRewinds the conversation, the code or both to a previous point
/diffShows the changes in your working tree, including Claude's edits so far

Custom commands are skills now

The older way to make a command was a Markdown file in .claude/commands/. Anthropic's skills page now says custom commands have been merged into skills: a file at .claude/commands/deploy.md and a skill at .claude/skills/deploy/SKILL.md both create /deploy and work the same way. Existing command files keep working, and the docs prefer a skill for new work because skills also take supporting files.

If both exist under one name, the skill wins. A command file accepts the same frontmatter as a skill, except name and paths.

Where you save the file decides who gets the command. The Mindket guide to creating an Agent Skill goes deeper on the file itself.

Commands and skills in the Claude Code changelog
  1. The /plan command arrives

    Version 2.1.0 adds a shortcut into plan mode from the prompt.

  2. Commands merge into skills

    Version 2.1.3 merges slash commands and skills, with no change in how either behaves.

  3. /simplify and /batch ship

    Version 2.1.63 adds both as bundled commands.

  4. /reload-skills arrives

    Version 2.1.152 re-scans the skill folders without a restart.

  5. Skills come back after compaction

    Version 2.1.304 sends Claude the skill list again once a conversation is compacted.

  6. Custom commands speak up in scripts

    Version 2.1.318 fixes custom commands that printed nothing in claude -p and SDK sessions when they failed.

Source: Claude Code changelog (read November 5, 2026)

Where a command file lives and what you type, per Anthropic's skills page
WherePathYou type
Personal, all your projects~/.claude/skills/deploy/SKILL.md/deploy
One project, shared by committing it.claude/skills/deploy/SKILL.md/deploy
Older command file.claude/commands/deploy.md/deploy
Command file in a subfolder.claude/commands/frontend/component.md/frontend:component
Inside a pluginmy-plugin/skills/review/SKILL.md/my-plugin:review

Arguments, and who can run a command

Whatever you type after the command name replaces $ARGUMENTS. Run /fix-issue 123 against the skill below and Claude receives "Fix GitHub issue 123 following our coding standards" and the numbered steps. For several values, $ARGUMENTS[0] and $ARGUMENTS[1], or the shorter $0 and $1, pick them by position.

If the text has no placeholder, Claude Code adds a final line that starts with ARGUMENTS: and holds your input, so Claude still sees what you typed. A frontmatter argument-hint such as [issue-number] shows the expected input while you type.

Anthropic's own example of a command to keep away from Claude is /deploy. You do not want Claude deciding to deploy because the code looks ready. disable-model-invocation: true handles that, and user-invocable: false does the reverse.

---
name: fix-issue
description: Fix a GitHub issue
disable-model-invocation: true
---

Fix GitHub issue $ARGUMENTS following our coding standards.

1. Read the issue description
2. Understand the requirements
3. Implement the fix
4. Write tests
5. Create a commit
Who can run a command, from the skills page
FrontmatterYou can run itClaude can run it
Nothing setYesYes
disable-model-invocation: trueYesNot on its own
user-invocable: falseNoYes

How Claude Code's creator turns daily work into commands

Boris Cherny created Claude Code at Anthropic. In January 2026 he wrote on X that he makes a slash command for every "inner loop" task he repeats many times a day. It saves him retyping prompts, and Claude can run the same workflow. His /commit-push-pr command runs dozens of times a day. It uses inline bash to collect git status before the model reads the prompt, which is the exclamation-mark line from your first command above. He kept his commands in .claude/commands/, checked into git, and a skill folder does the same job today.

In February 2026 he announced two bundled skills, /simplify and /batch, after using both daily. Today /simplify reviews the code you changed for cleanup and applies the fixes. /batch plans a large change, splits it into 5 to 30 independent units and hands each to a background subagent once you approve. Run /simplify after your next edit to see a bundled skill work like any other command.

I use slash commands for every "inner loop" workflow that I end up doing many times a day.

Boris Cherny, Creator of Claude Code, Anthropic · X (read November 5, 2026)
Boris Cherny (@bcherny) on X, 2 January 2026, tip 7 of his setup thread. I use slash commands for every inner loop workflow that I end up doing many times a day. Commands are checked into git and live in .claude/commands/.
Boris Cherny on X, 2 January 2026
Boris Cherny (@bcherny) on X, 28 February 2026. In the next version of Claude Code, we're introducing two new Skills: /simplify and /batch. I have been using both daily.
Boris Cherny on X, 28 February 2026

Screenshots of X's own embeds of the posts, taken on 5 November 2026, with the time in UTC. X cuts both posts short with Show more. Select a screenshot to open the post on X.

Common mistakes

  • Typing the command after other words. Claude Code recognizes a command only when it opens the message. After plain text, the name only gives Claude permission to run a skill, and nothing runs directly.
  • Hitting Enter after a typo. Nothing is highlighted, Enter submits your text as typed and Claude Code reports "Unknown command". Pick a close match with Tab or the arrow keys. A command your platform or plan lacks is missing from the menu too.
  • Misspelling a frontmatter field. A field name must match the docs exactly, hyphens included, and Claude Code ignores one it does not recognize without an error. The opening --- must also be the first line of the file.
  • Naming a command after a built-in one. In a local terminal session, your skill replaces the built-in command of that name, though not its aliases.
  • Writing new commands in .claude/commands/ because an older tutorial does. It still works. A skill does more, and a skill with the same name beats the command file.

Try it yourself

  • Type / in a session and scroll the list. Filter it with a few letters, then run /help.
  • Create /summarize-changes as above and run it twice: once with /summarize-changes and once by asking "What did I change?".
  • Save the fix-issue text as a second skill and run /fix-issue 123. Then remove disable-model-invocation: true, which puts the description in Claude's context so Claude can load the skill itself.
  • Make a command of your own for something you paste into chat every week, using the same two-part file: frontmatter, then instructions.

Next: hooks

A command runs when you ask. Lesson 4 covers hooks, which run on their own at fixed points, such as right before a tool call.

To share a command with other people, package it in a plugin, which our Claude Code plugins post covers.

Check yourself

  1. You save a skill at ~/.claude/skills/summarize-changes/SKILL.md. Which command runs it?

    Show answer

    A. /summarize-changes The folder name becomes the command, and a personal skill works in all your projects.

  2. You run /fix-issue 123 against a skill that contains $ARGUMENTS. What does $ARGUMENTS stand for?

    Show answer

    C. The text 123 after the command name Whatever you type after the command name replaces $ARGUMENTS.

  3. Which frontmatter line stops Claude from running a command such as /deploy on its own?

    Show answer

    D. disable-model-invocation: true disable-model-invocation: true keeps Claude from starting the command itself, while user-invocable: false does the reverse.

  4. Which message runs /summarize-changes directly?

    Show answer

    B. /summarize-changes Claude Code recognizes a command only when it opens the message, and after plain text nothing runs directly.

Frequently asked questions

Can a command pre-approve tools so Claude stops asking?

Yes, with allowed-tools in the frontmatter. The docs show a /commit skill that lists Bash(git add *) Bash(git commit *) Bash(git status *) there. The grant covers only the turn that runs the command and clears when you send your next message, and your permission settings still govern anything not listed. Review that field in any skill checked into a repository before you run Claude Code there, because a skill can grant itself broad access.

What is the difference between a slash command and a skill?

In Claude Code there is almost none now. Both create a /name command. A skill adds a folder for supporting files, frontmatter that controls who can run it, and automatic loading when its description fits what you ask.

Do I need to restart Claude Code after adding a command?

No. Claude Code watches ~/.claude/skills/ and the project's .claude/skills/ and picks up an added, edited or removed skill in the same session. The exception is a top-level skills folder that did not exist when the session started. Run /reload-skills after creating it.

How do I hide a command from the / menu?

Set user-invocable: false in its frontmatter. Claude Code then hides it from the menu and does not run it when you type its name, while Claude can still load it. Use that for background knowledge that is not an action you would take.

Can a plugin add slash commands?

Yes. A plugin's skills appear as /plugin-name:skill-name, so they never clash with your own commands. Our plugins post covers building and installing one.

Can /init set up more than a CLAUDE.md?

With CLAUDE_CODE_NEW_INIT=1 set, it runs an interactive flow that also walks through skills, hooks and personal memory files. If it finds OpenAI Codex or Google Gemini CLI configuration, it offers to carry it over with /import.

Can I run two commands in one message?

At the terminal prompt, yes. Typing /write-tests /fix-issue 123 loads both skills and passes the trailing text to each as arguments. Claude Code expands the first skill plus up to five more stacked after it.

Sources

  1. Claude Code docs: Commands (read November 4, 2026)https://code.claude.com/docs/en/commands
  2. Claude Code docs: Extend Claude with skills (read November 4, 2026)https://code.claude.com/docs/en/skills
  3. Claude Code changelog (read November 5, 2026)https://code.claude.com/docs/en/changelog
  4. Boris Cherny on X: tip 7, slash commands, 2 January 2026 (read November 5, 2026)https://x.com/bcherny/status/2007179847949500714
  5. Boris Cherny on X: /simplify and /batch, 28 February 2026 (read November 5, 2026)https://x.com/bcherny/status/2027534984534544489

Share this lesson

Next lesson: hooks

Run your own command automatically at fixed points in a Claude Code session.

Start lesson 4

This lesson as Markdown · Claude Code course for beginners · All courses