Skills & Workflow

Slash Command

A slash command is a short, typed instruction — starting with `/` — that a user invokes to run a predefined prompt, procedure, or action instead of writing it out in full.

Typing the same detailed instructions to an agent over and over is tedious. A slash command gives that instruction a short name: type /review instead of re-explaining what a code review should check every time. When the harness sees the slash command, it substitutes in the predefined prompt or procedure behind that name, optionally with arguments the user supplies after it.

Slash commands are explicitly user-invoked — someone has to type them — which distinguishes them from a hook (which runs automatically around an action) or a trigger (which starts a run from an external event, no typing involved).

In many implementations a slash command is nothing more than a small file: a name, and the text of the prompt it should expand to. That makes them easy for a user or team to define without writing any code.

Example

/deploy staging

Typed by a user, this might expand into a predefined prompt telling the agent to run the staging deploy checklist — build the project, run the smoke tests, and push to the staging environment — without the user having to spell all of that out each time.

How it differs

Slash command vs. hook: a slash command is something a person deliberately types to kick something off; a hook runs automatically, without anyone typing anything, at a fixed point in an action's lifecycle.

Common misconceptions

Often assumed: Creating a slash command requires writing a plugin or custom code.
Actually: In many systems a slash command is just a short file naming a prompt template — no plugin development or code required.

FAQ

What is a slash command in Claude Code?
A short typed instruction, like /review, that runs a predefined prompt or procedure instead of the user re-typing it each time.
Can I make my own slash command?
In most implementations, yes — usually by adding a small file that names the command and defines the prompt it should run.
What's the difference between a slash command and a hook?
A slash command is typed on purpose by a person; a hook fires automatically around an action, with no one typing anything.

Last checked: 2026-08-28

Related terms