Skip to content
Level up your prompts with SurePrompts — curated prompts for every workflow.
agentscamp

Claude Code Slash Commands: The Built-in List and How to Write Your Own

Claude Code's built-in slash commands grouped by job, and how to write your own as skills: file format, frontmatter, arguments, and plugin namespacing.

By Imtiaz RayhanUpdated 12 min read

On this page
  1. What slash commands are
  2. Built-in commands worth knowing
  3. Custom commands are skills now
  4. Anatomy of a command file
  5. Passing arguments
  6. Run shell commands before Claude sees the prompt
  7. Project vs personal commands, and namespacing
  8. Letting Claude invoke commands, and turning that off
  9. Five ready-made commands from our library
  10. When a command should become a skill or a subagent
  11. Next steps

Slash commands are shortcuts you type at the Claude Code prompt. Built-ins such as /compact, /model and /permissions control the session; custom commands are skills you trigger by name. Legacy .claude/commands/*.md files still work, but .claude/skills/<name>/SKILL.md is canonical, and disable-model-invocation: true makes it run only when you type it.

Key takeaways

  • Type / or run /help to see every command your version supports; built-ins change between releases, so treat any published list as highlights.
  • Custom commands merged into skills: .claude/commands/*.md still works as a legacy path, but .claude/skills/<name>/SKILL.md is canonical and runs as /<name>.
  • A slash command is a skill with disable-model-invocation: true, so Claude never loads it on its own and it runs only when you type it.
  • Arguments arrive through placeholders: one for the whole argument string, zero-based positional ones, or named ones declared in an arguments field.
  • Plugin commands are always namespaced as /plugin-name:skill-name, so two plugins can ship the same command name without colliding.
  • Promote a command to an auto-loading skill when Claude should apply it unprompted, and to a subagent when its output floods your context.

Slash commands are shortcuts you type at the Claude Code prompt. Built-ins such as /compact, /model and /permissions control the session, and custom commands are skills you trigger by name. To write your own today, create .claude/skills/<name>/SKILL.md with disable-model-invocation: true and type /<name>; legacy .claude/commands/*.md files still work.

What slash commands are

There are three kinds:

  • Built-in commands ship with Claude Code and control the session, settings and account.
  • Custom commands are skills you invoke by name. They can come from your project, from your home directory, or from a legacy .claude/commands/ file.
  • Plugin commands arrive with an installed plugin and are namespaced as /plugin-name:skill-name.

Type / at the prompt to open the menu, keep typing to filter it, and press Tab to complete a name. /help lists every available command, including your custom skills. The set changes between releases, so the menu on your machine beats any published list, this one included.

Built-in commands worth knowing

These are highlights from Anthropic's commands reference, grouped by job. The list isn't complete, and commands change between releases; type / or run /help to see every command on your version. Square brackets mark optional arguments and angle brackets mark required ones.

JobCommandWhat it does
Session and context/clear [name]Start a fresh conversation
/compact [instructions]Free up context by summarizing
/context [all]Visualize context usage
/resumeReturn to an earlier conversation
/rewindRoll back code and conversation to a checkpoint
/btw [question]Ask a side question without affecting history
/branch [name]Branch the conversation to try another direction
/export [filename]Export the conversation as text
/copy [N]Copy assistant responses to the clipboard
/exitExit Claude Code (or press Ctrl+D)
Model and planning/model [model]Switch models
/effort [level]Adjust reasoning depth: low to max, ultracode or auto
/plan [description]Enter plan mode for large changes
Config and permissions/config [key=value]Open settings, or set one directly
/permissionsConfigure tool access rules
/theme, /color [color], /keybindingsAppearance and shortcuts
Project and memory/initInitialize the project with a CLAUDE.md
/memoryEdit and manage CLAUDE.md files
Tools, MCP and plugins/mcpSet up MCP server connections
/reload-pluginsReload plugins without restarting
Review/diffReview working-tree changes
/code-review [level] [--fix]Review the diff for bugs and cleanups
/security-reviewCheck for vulnerabilities
Parallel and background/batch <instruction>Split a large change into parallel units
/background [prompt]Detach the session as a background agent
/fork [prompt]Copy the conversation into a new background session
/loop [interval] [prompt]Run a prompt on a schedule
Research and design/deep-research <question>Fan out web searches with cited sources
/design [brief], /dataviz [request]UI mockups; chart and dashboard guidance
Account and diagnostics/login, /logoutManage authentication
/usageCheck token and cost usage
/doctorRun setup diagnostics
/debug [description]Enable debug logging
/feedback, /bugReport an issue
/helpList available commands and skills

A few of these pay off on day one:

  • /clear between unrelated tasks.
  • /compact with instructions about what to keep, when context runs long.
  • /rewind when an edit goes wrong, because it rolls back code and conversation together.

Managing memory and context covers /compact, /context and /memory in depth. Settings and permissions explains what /permissions edits.

Custom commands are skills now

Custom commands have been merged into skills. .claude/commands/*.md files still work as a legacy path, but .claude/skills/<name>/SKILL.md is canonical, and every skill can be invoked as /<name>. What makes a skill behave like a classic slash command is one frontmatter line, disable-model-invocation: true, which stops Claude from loading it on its own.

WherePathInvoked as
Project skill (canonical).claude/skills/<name>/SKILL.md/<name>
Personal skill~/.claude/skills/<name>/SKILL.md/<name>
Project command (legacy).claude/commands/<name>.md/<name>
Personal command (legacy)~/.claude/commands/<name>.md/<name>
PluginThe plugin's skills/ directory/plugin-name:skill-name

Project locations are committed and shared with your team; personal ones follow you into every repo. The command name comes from a different place in each format:

  • A legacy command's name comes from its filename.
  • A skill's command comes from its directory name. The name field only sets the label shown in skill listings, except in a plugin skill, where it replaces the command's last segment.

Monorepos can also keep .claude/skills/ directories further down the tree.

For new work, write skills. A skill is a folder, so it can bundle scripts and templates next to SKILL.md. If you later want a command to auto-load, you delete one line instead of moving files.

Anatomy of a command file

A command is YAML frontmatter plus a Markdown body. The frontmatter controls how it's invoked, and the body is the prompt Claude receives when you run it.

---
name: pr-summary
description: Summarize the diff against a base branch as a PR description.
argument-hint: [base-branch]
disable-model-invocation: true
allowed-tools: Bash(git *) Read
---
 
Summarize the changes on this branch against $0.
 
1. Run git diff $0...HEAD and read the changed files.
2. Write an imperative title and a body with Summary and Test plan sections.
3. Don't push or open anything; print the draft.

Save that as .claude/skills/pr-summary/SKILL.md and run /pr-summary main. The body runs in your main conversation, as if you had pasted it, unless you set context: fork.

The frontmatter fields that shape invocation:

FieldWhat it does
nameDisplay name in skill listings; defaults to the directory name, which sets the command except in plugin skills
descriptionWhat it does; Claude uses it to decide when to load the skill
disable-model-invocationtrue means only you can invoke it
user-invocablefalse means only Claude can invoke it
allowed-toolsPre-approves tools for the turn that runs it
argument-hintShows the expected arguments in autocomplete
argumentsNames positional arguments for $name placeholders
pathsGlob patterns that limit when the skill activates
contextfork runs it in an isolated subagent context
agentWhich subagent type runs a forked skill, such as Explore
backgroundFor forks; defaults to true, set false to get the result in the same turn

The spellings are exact. The names use hyphens, not underscores (disable-model-invocation, user-invocable), and context: fork takes the literal value fork.

The legacy format is the same idea in a single file. A .claude/commands/<name>.md file takes its name from the filename, has optional frontmatter, and a body that reads $ARGUMENTS:

---
description: Review a pull request and list findings by severity.
argument-hint: [PR number]
allowed-tools: Bash(gh *) Read
---
 
Review pull request #$ARGUMENTS. Run gh pr diff $ARGUMENTS, then list blockers, should-fix items and nits with file:line for each.

To convert it, move the file to .claude/skills/<name>/SKILL.md and add disable-model-invocation: true.

Passing arguments

Whatever you type after the command name becomes arguments:

  • $ARGUMENTS expands to the whole argument string as typed.
  • $0, $1 and so on pick out single arguments, counting from zero.
  • Values follow shell-style quoting, so /my-skill "hello world" second puts hello world in $0 and second in $1.
  • An index with no matching argument is left in the text untouched.

Named arguments read better once there are two or more. Declare them in frontmatter and use them by name:

---
argument-hint: [issue] [branch]
arguments: [issue, branch]
disable-model-invocation: true
---
 
Fix issue $issue on branch $branch.

Names map to positions in order, so $issue takes the first argument and $branch the second. Named and positional placeholders differ in a few ways:

  • A named argument with nothing passed expands to an empty string, while a positional one is left untouched.
  • To write a literal dollar sign, escape it with a backslash, as in \$1.00.
  • A single-argument hint such as argument-hint: [base-branch] still lands in $0.

Always tell the body what to do when no argument arrives. The commands in our library ask one focused question instead of guessing.

Run shell commands before Claude sees the prompt

A skill can inject live data before Claude reads it. Put !`git diff HEAD` in the body and the command runs when the skill loads. Its output replaces the placeholder, so Claude starts from the current diff instead of spending a turn fetching it. For multi-line commands, use a fenced code block marked with !.

Three substitutions help a skill find its surroundings:

  • ${CLAUDE_SKILL_DIR} is the skill's own directory, which is useful for bundled scripts.
  • ${CLAUDE_PROJECT_DIR} is the project root.
  • ${CLAUDE_SESSION_ID} is the current session.

Injected commands run on your machine as you, so read them before adopting someone else's command. The skills security checklist lists what to look for.

Project vs personal commands, and namespacing

Put a command in the project when the team should share it and it depends on the repo, such as build steps, review checklists or release flows. Put it in ~/.claude/skills/ when it's your own habit and works anywhere.

Plugins solve the naming-collision problem, because plugin skills are always namespaced as /plugin-name:skill-name:

  • A plugin named my-plugin with a skill hello runs as /my-plugin:hello, so two plugins can both ship a review command.
  • The prefix comes from the name field in plugin.json.
  • A plugin can still carry a legacy commands/ directory, but skills/ is canonical.

After editing a plugin, /reload-plugins picks up the change without a restart. Claude Code plugins covers building and installing them. MCP servers are managed separately through /mcp; see adding MCP servers to Claude Code.

Letting Claude invoke commands, and turning that off

By default a skill works both ways: you can type it, and Claude can load it through the Skill tool whenever its description matches the task. Two frontmatter flags split those paths:

FrontmatterYou can type /nameClaude can load it
Neither flagYesYes, when the description matches
disable-model-invocation: trueYesNo
user-invocable: falseNoYes

disable-model-invocation: true is the right default for anything with side effects, such as committing, pushing, deploying or opening PRs, because you decide when it runs. It has one cost: a subagent can't preload such a skill through its skills field, because preloading counts as model invocation.

To change a skill's behavior without editing its file, add skillOverrides to .claude/settings.json:

{
  "skillOverrides": {
    "my-skill": "off",
    "another-skill": "user-invocable-only"
  }
}

Five ready-made commands from our library

If you'd rather start from working examples, these AgentsCamp commands cover loops most developers repeat daily. Each page shows the full file:

  1. Review PR, run as /review-pr [PR number], reviews a pull request end to end. It:
    • pulls metadata, diff and CI status through gh;
    • checks out the branch and evaluates correctness, security and style against the PR's stated goal;
    • tags each finding blocker, should-fix or nit, with file:line and a fix;
    • ends with a verdict and never merges.
  2. Commit inspects status, diffs and recent log. It stages only the files that belong to one logical change and writes a Conventional Commits message with an imperative subject of 72 characters or fewer. It flags secrets instead of staging them, and never pushes unless asked.
  3. Create PR, run as /create-pr [base branch or notes], opens a pull request. It confirms the base branch, pushes if needed, and writes a title and a body with summary, changes, testing and risk. It opens the PR through gh and reports the URL, without merging.
  4. Fix Failing Test, run as /fix-failing-test [test name or path], reproduces the failure and traces it to the code under test. Before editing, it states whether the test or the code is wrong. Then it applies the smallest fix to the correct side and reruns the suite, never weakening an assertion.
  5. Explain Error takes an error message or stack trace. It finds the first in-repo frame, names the root cause one level below the message, and confirms it with read-only checks. It reports a specific fix, or ranked candidates, and changes no files.

Copy a file from its page, or install from the terminal. The command below installs into your project's .claude/ directory by default; add -g to install into ~/.claude/.

npx agentscamp add commands/review-pr

To build your own, Create Slash Command scaffolds a new command file from a one-line description.

When a command should become a skill or a subagent

Commands are the manual end of Claude Code's extension model. These signals say it's time to move:

SignalMove to
You type the same prompt every dayKeep it a command with disable-model-invocation: true
Claude should apply it without being askedAn auto-loading skill: drop the flag, sharpen description, add paths
Its intermediate output floods your contextA subagent, or context: fork on the skill
It must happen every time, no exceptionsA hook, which runs deterministically

The deciding questions are who pulls the trigger and whether the work needs its own context window. Skills vs agents vs commands works through that decision with examples. When you are ready, Create Skill and Create Subagent scaffold the next step.

Next steps

Start with one command for the prompt you retype most. Commit it under .claude/skills/, and add an argument-hint so teammates can see how to call it. Then:

Sources and further reading

Primary documentation used to verify this guide.

Frequently asked questions

What are slash commands in Claude Code?
Slash commands are shortcuts you type at the prompt, starting with a forward slash. Built-in commands such as /clear, /compact and /model control the session, and custom commands are skills you trigger by name. Type / to see every command available in your version.
How do I create a custom slash command in Claude Code?
Create .claude/skills/<name>/SKILL.md in your project, or ~/.claude/skills/<name>/SKILL.md for every project, with YAML frontmatter and a Markdown body. Add disable-model-invocation: true so it runs only when you type /<name>. Legacy .claude/commands/<name>.md files still work too.
Do .claude/commands files still work?
Yes. Custom commands have been merged into skills, and .claude/commands/*.md files still work as a legacy path. The canonical location is now .claude/skills/<name>/SKILL.md, which also lets a command bundle supporting files next to it.
How do I pass arguments to a Claude Code slash command?
Type them after the command name. In the body, $ARGUMENTS expands to everything you typed, zero-based positional placeholders pick out single arguments, and names declared in an arguments frontmatter field expand to the matching position. Values follow shell-style quoting.
How do I see all Claude Code commands?
Type / at the prompt to open the command menu, and keep typing to filter it; Tab completes the name. /help lists every available command for the version you are running, including your custom skills.
Can Claude run my slash commands on its own?
Claude can load a skill whenever its description matches the task. Add disable-model-invocation: true to the frontmatter and only you can trigger it; set user-invocable: false for the opposite, a skill that only Claude can load.

Filed under

claude-code · slash-commands · custom-commands · skills · configuration

Related