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 stagingTyped 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
FAQ
What is a slash command in Claude Code?
/review, that runs a predefined prompt or procedure instead of the user re-typing it each time.Can I make my own slash command?
What's the difference between a slash command and a hook?
Last checked: 2026-08-28