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.- 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. - Save the text above as
SKILL.mdin that folder. The folder name becomes the command, so this one is/summarize-changes. - Open a git project, change one file and run
claude. - 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. - 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.
| Command | What it does |
|---|---|
/help | Shows help and the available commands |
/init | Initializes 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 |
/context | Shows 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 |
/rewind | Rewinds the conversation, the code or both to a previous point |
/diff | Shows 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.
The /plan command arrives
Version 2.1.0 adds a shortcut into plan mode from the prompt.
Commands merge into skills
Version 2.1.3 merges slash commands and skills, with no change in how either behaves.
/simplify and /batch ship
Version 2.1.63 adds both as bundled commands.
/reload-skills arrives
Version 2.1.152 re-scans the skill folders without a restart.
Skills come back after compaction
Version 2.1.304 sends Claude the skill list again once a conversation is compacted.
Custom commands speak up in scripts
Version 2.1.318 fixes custom commands that printed nothing in
claude -pand SDK sessions when they failed.
Source: Claude Code changelog (read November 5, 2026)
| Where | Path | You 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 plugin | my-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| Frontmatter | You can run it | Claude can run it |
|---|---|---|
| Nothing set | Yes | Yes |
disable-model-invocation: true | Yes | Not on its own |
user-invocable: false | No | Yes |
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.
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,
Entersubmits your text as typed and Claude Code reports "Unknown command". Pick a close match withTabor 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-changesas above and run it twice: once with/summarize-changesand once by asking "What did I change?". - Save the
fix-issuetext as a second skill and run/fix-issue 123. Then removedisable-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
You save a skill at
~/.claude/skills/summarize-changes/SKILL.md. Which command runs it?Show answer
A.
/summarize-changesThe folder name becomes the command, and a personal skill works in all your projects.You run
/fix-issue 123against a skill that contains$ARGUMENTS. What does$ARGUMENTSstand for?Show answer
C. The text
123after the command name Whatever you type after the command name replaces$ARGUMENTS.Which frontmatter line stops Claude from running a command such as
/deployon its own?Show answer
D.
disable-model-invocation: truedisable-model-invocation: truekeeps Claude from starting the command itself, whileuser-invocable: falsedoes the reverse.Which message runs
/summarize-changesdirectly?Show answer
B.
/summarize-changesClaude 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
- Claude Code docs: Commands https://code.claude.com/docs/en/commands
- Claude Code docs: Extend Claude with skills https://code.claude.com/docs/en/skills
- Claude Code changelog https://code.claude.com/docs/en/changelog
- Boris Cherny on X: tip 7, slash commands, 2 January 2026 https://x.com/bcherny/status/2007179847949500714
- Boris Cherny on X: /simplify and /batch, 28 February 2026 https://x.com/bcherny/status/2027534984534544489


