Claude Slash Commands: Written for Claude, Not for You

This video explains that a slash command is a Markdown file whose body instructs Claude rather than speaking to the user. It covers the three command locations, the five frontmatter fields, argument handling, file references, and one gap in the guide.

2:13 video3 min readWatch on YouTube

The video starts from a common assumption: that the body of a slash command describes what will happen to the user. It does not. A slash command is a Markdown file with YAML frontmatter, and its body is a directive to Claude, not a message to the user. Getting that direction right changes how the command behaves.

Write for Claude

The opening question is whether you are writing a command body for the user or for Claude. The video's answer is Claude. The words that matter tell Claude what to do, not what you will see happen. A body that merely describes an outcome to the person typing the command misses the point of the file.

Three places commands live

Commands can live in three locations:

  • Project commands, shared with the team and available only in that project.
  • Personal commands, available in every project.
  • Plugin commands, bundled with an installed plugin.

Five frontmatter fields

The frontmatter carries five fields: description, allowed-tools, model, argument-hint, and disable-model-invocation. The video's "Deliberately not claimed" notes make clear that these five are the full set the format supports, not a checklist every command must fill in.

Two ways to take arguments

Arguments come in two forms. The dollar-ARGUMENTS variable captures everything typed after the command as one string. Dollar-1, dollar-2, and so on capture individual pieces, for example a PR number followed by a priority level.

Reading files with the at sign

An at sign reads a file. Used with dollar-1, it opens whatever path the argument names. A static reference, such as a package.json, embeds a known file every time with no argument needed.

Plugin commands and portable paths

Plugin commands get one more tool. CLAUDE_PLUGIN_ROOT resolves to the plugin's own folder, so a command can point at its own scripts without a hard-coded path.

A note on status and one gap

The video relays a note from the skill itself: this whole file format is now considered legacy, and new work is pointed toward a skill file instead.

It then names one gap. A command can run a shell command inline before Claude sees the rest of the body. An exclamation mark followed by backticks can pull in something like the current git diff automatically. The video calls this the most useful dynamic trick available, yet the guide that teaches command writing does not show it inline and pushes it into a separate reference file.

Key takeaways

  • A slash command is a Markdown file with YAML frontmatter, and its body is a directive to Claude.
  • Commands live in project, personal, or plugin locations, with different sharing scope.
  • The five frontmatter fields are description, allowed-tools, model, argument-hint, and disable-model-invocation.
  • Dollar-ARGUMENTS gives all the text as one string; dollar-1 and dollar-2 give individual pieces.
  • The at sign reads a file, either a static one or one named by an argument.
  • CLAUDE_PLUGIN_ROOT lets plugin commands refer to their own folder without hard-coded paths.
  • Inline shell execution, written as an exclamation mark and backticks, can pull in live output such as a git diff but is not shown inline in the guide.
  • The command file format is described as legacy, with skills as the newer direction.

Try it yourself

In a Claude Code session, ask Claude to create a slash command called review-pr that takes a PR number as an argument, reads the changed files, and reviews them for code quality. Then check four things. Does the body tell Claude what to do? Does it use dollar-ARGUMENTS or dollar-1 with argument-hint set? Does it use allowed-tools to restrict what it can touch? And if you ask for inline bash execution to pull the PR diff, does it show the syntax or send you to a reference file? Use your own plugin idea.

Chapters

  1. 0:00The naive framing: "is it written for the user?"
  2. 0:10Anatomy: locations + fields
  3. 0:33Arguments + file refs
  4. 1:09One gap
  5. 1:28Carry-out
  6. 1:35Your turn
  7. 2:09Outro
Full transcript(auto-generated, with timestamps)

The naive framing: "is it written for the user?"

[0:00]Someone assumed a command's body describes what will happen to the user. It doesn't. It's a directive to Claude. So, when I write a command body, am I writing it for Claude? A slash command

Anatomy: locations + fields

[0:10]Is a markdown file with YAML front matter, and its body is a directive to Claude, not a message to the user. Commands live in three places: project commands shared with the team and available only in that project, personal commands available in every project, and plugin commands bundled with an installed plugin. Front matter carries five fields: description, allowed tools, model, argument hint, and disable model invocation. Arguments come two ways.

Arguments + file refs

[0:33]Dollar arguments captures everything typed after the command as one string. Dollar one, dollar two capture individual pieces, a PR number then a priority level. The at sign reads a file. At dollar one opens whatever path the argument names. A static reference like a package.json embeds a known file every time, no argument needed. Plugin commands get one more trick. Claude plugin root resolves to the plugin's own folder, so a command can point at its own scripts without a hard-coded path. One note from the skill itself. This whole file format is now considered legacy. New work is pointed toward a skill file instead. One gap worth

One gap

[1:09]Knowing. A command can also run a shell command inline before Claude ever sees the rest. An exclamation mark then backticks pulling in something like the current git diff automatically. That's the single most useful dynamic trick available, but the guide that teaches command writing doesn't show it inline. It's pushed off into a separate reference file instead. A slash

Carry-out

[1:28]Command's body is written for Claude, not for you. The words that matter tell Claude what to do, not what you'll see happen. Your turn. Open a Claude code session

Your turn

[1:36]And paste this. Create a slash command called review PR that takes a PR number as an argument, reads the changed files, and reviews them for code quality. Watch four things. First, does the command body tell Claude what to do or describe what will happen to you? Second, does it use dollar arguments or dollar one for the PR number with the argument hint field set? Third, does it use allowed tools to restrict what the command can touch? Fourth, if you ask it to add bash execution to pull in the PR diff dynamically, does it show you the exclamation mark backtick syntax inline or send you to a reference file? For Claude, not for you, Liam, in for

Outro

[2:10]Bear.

More from Extending Claude — Skills, Plugins & Connectors

Humanitarians AI Lyrical Literacy Project