Workbranch › Guides

Guide

How 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.

Updated 30 October 2026

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.

CommandWhat it does
/initDrafts a CLAUDE.md for the project
/memoryOpens your CLAUDE.md and memory files
/planSwitches into plan mode before a large change
/contextShows what is filling the context window
/compactSummarizes the conversation to free space
/clearStarts a fresh conversation
/resumeReopens an earlier conversation
/statusShows your version, model, account and connection
/configOpens 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.

  1. In your project, create the folder .claude/skills/review/. The folder name becomes the command name, unless you set a different one with a name: field.
  2. Inside it, create SKILL.md.
  3. 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].
  4. 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.
  5. Type /review in 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

Useful frontmatter options

Field names must match exactly; unknown fields are ignored without a warning.

Share commands in a project

WhereWho gets it
.claude/skills/ or .claude/commands/ in the repoEveryone who pulls the repository
~/.claude/skills/ or ~/.claude/commands/Only you, in all your projects
A pluginAnyone who installs it; used as /plugin-name:command
Managed settingsEveryone 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

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

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.