Workbranch › Guides
GuideHow to create custom slash commands in Claude Code
If you type the same long prompt into Claude Code every week, such as a review checklist or release steps, you can turn it into your own slash command. This guide covers the built-in commands worth knowing, how to write a custom one, and how to share it with a project.
Quick answer: create a Markdown file at .claude/skills/<name>/SKILL.md (or the older .claude/commands/<name>.md) in your project and write the prompt in it; it becomes /<name>. Put it in ~/.claude/ instead to use it in all your projects, and commit the project folder to share it with your team.
Paths and fields below were checked against Anthropic's Claude Code documentation as of October 2026.
Built-in commands worth knowing
Type / in a session to see every command available to you, or / plus a few letters to filter. A command only counts at the very start of a message; whatever you type after it becomes its arguments. Some commands depend on your platform and plan.
| Command | What it does |
|---|---|
/init | Drafts a CLAUDE.md for the project |
/memory | Opens your CLAUDE.md and memory files |
/plan | Switches into plan mode before a large change |
/context | Shows what is filling the context window |
/compact | Summarizes the conversation to free space |
/clear | Starts a fresh conversation |
/resume | Reopens an earlier conversation |
/status | Shows your version, model, account and connection |
/config | Opens settings such as theme and model |
The full list is on Anthropic's Commands page.
Create your own command
Custom commands and skills now work the same way: .claude/commands/review.md and .claude/skills/review/SKILL.md both give you /review. The skill folder is the recommended form because it can hold extra files.
- In your project, create the folder
.claude/skills/review/. The folder name becomes the command name, unless you set a different one with aname:field. - Inside it, create
SKILL.md. - Start the file with frontmatter. The
---line must be the very first line:description:what the command does and when to use it. Put the main use first.argument-hint:optional, a hint shown in autocomplete, such as[file].
- Close the frontmatter with another
---and write the prompt below it, the same way you would type it to Claude: what to check, in what order, and how to report. - Type
/reviewin a session. Edits to the file are picked up live; if you created a new top-level.claude/skills/folder mid-session, run/reload-skills.
Pass arguments
$ARGUMENTSis replaced with everything typed after the command.$0,$1,$2(counting from 0) take single words, so/migrate SearchBar JavaScript TypeScriptfills three placeholders. Quote values with spaces.- If the file has no placeholder, Claude Code adds the arguments at the end as
ARGUMENTS: …. - To write a literal dollar sign before a digit, escape it, as in
\$1.00.
Useful frontmatter options
disable-model-invocation: true: only you can start it with the slash. Use it for anything with side effects, like a deploy.user-invocable: false: hides it from the/menu, so only Claude loads it as background knowledge.allowed-tools:tools Claude may use without asking during the turn you run the command, for exampleBash(npm run build *). It grants access; it doesn't restrict other tools.
Field names must match exactly; unknown fields are ignored without a warning.
Share commands in a project
| Where | Who gets it |
|---|---|
.claude/skills/ or .claude/commands/ in the repo | Everyone who pulls the repository |
~/.claude/skills/ or ~/.claude/commands/ | Only you, in all your projects |
| A plugin | Anyone who installs it; used as /plugin-name:command |
| Managed settings | Everyone in an organization, set by admins |
Subfolders in .claude/commands/ add a namespace: .claude/commands/frontend/component.md becomes /frontend:component. Cloud and Cowork sessions don't read ~/.claude/skills/, so commit the command to the repository or enable the skill on your claude.ai account if you need it there. For skills in the Claude apps, see how to use Claude Skills.
If it doesn't work
- The command isn't in the
/menu. Check that the folder or file name has no<,>, doubled spaces or invisible characters; a name like that is refused. Startclaude --debugand search the debug log for[names]to see which names were refused. Run/reload-skillsafter adding a new skills folder. - Settings in the frontmatter are ignored. The YAML must parse and start on line one; a parse error loads the command with no fields set.
- Claude never uses it on its own. Make the description say when to use it, and check
disable-model-invocationisn't set. - The project's command runs your personal version instead. When the same name exists in
~/.claude/and in the project, the personal one wins; rename one of them.
A ready-made command for saving sessions
The Workbranch plugin for Claude Code adds /workbranch:save, which files the session's tasks, decisions, open questions and ideas into a Workbranch project by topic, so you don't have to write that command yourself. Workbranch has a 3-day free trial at app.workbranch.ai.
Sources
- Extend Claude with skills (Claude Code Docs, checked 2026-10-30)
- Commands (Claude Code Docs, checked 2026-10-30)
- Use Claude Code with your Pro or Max plan (Claude Help Center, checked 2026-10-30)
Frequently asked questions
Should I use .claude/commands or .claude/skills?
Both create the same kind of slash command and old command files keep working. Anthropic recommends skills for new work, because a skill folder can hold supporting files and Claude can load it automatically when relevant.
Can Claude run my command on its own?
A skill with a description can be loaded by Claude when it fits your request. Add disable-model-invocation: true to the frontmatter if only you should start it, for example for a deploy.
What if my command has the same name as another one?
Enterprise commands win over personal ones, and personal over project ones. A skill beats a command file with the same name. Plugin commands are namespaced, like /plugin-name:command, so they don't collide.