I kept typing the same long prompts into Claude Code over and over. Then I turned them into slash commands. Now I type /review and the whole prompt fires. Here's how Claude Code slash commands work and how I use them.
What a custom slash command is
A custom slash command is a reusable prompt shortcut. You invoke it by typing /name in Claude Code, and the body of the command file becomes the prompt that gets sent.
That's the whole idea. Instead of retyping a careful prompt every time, you write it once, save it as a file, and call it with a slash. It's the fastest way to make a repeatable workflow stick.
Think of it as a saved prompt, not a saved answer. Every time you run the command, Claude reads the current state of your project and responds fresh. The command just guarantees the instructions are the same every time.
Where they live and how naming works
Slash commands are plain markdown files. There are two places to put them.
- Project commands —
.claude/commands/in your repo. These ship with the project, so anyone who clones it gets the same commands. - Global commands —
~/.claude/commands/in your home directory. These follow you across every project on your machine.
.claude/commands/review.md gives you /review. A file at ~/.claude/commands/commit.md gives you /commit. Drop the .md, add a slash, and you have your command.
The file body is the prompt. No special syntax required to get started — write the instructions you'd normally type, and that's your command.
Passing arguments
Static prompts are useful, but the real power shows up when you pass arguments. Claude Code substitutes $ARGUMENTS in the command body with whatever you type after the command name.
Here's a command I keep at .claude/commands/fix-issue.md:
---
description: Fix a GitHub issue by number
Fix GitHub issue #$ARGUMENTS in this repository.
- Read the issue with
gh issue view $ARGUMENTS
- Find the relevant files and the root cause
- Make the smallest change that fixes it
- Add or update a test that would have caught it
- Write a commit message that references the issue
Now /fix-issue 412 runs that whole workflow against issue 412. The optional frontmatter description is what shows up when you browse your commands. Everything below it is the prompt.
You can reference $ARGUMENTS as many times as you need in one command. The substitution is plain text, so it works anywhere in the body.
A few high-value commands
These are the ones that earn their keep for me.
- /review — Review the current diff for bugs, missing edge cases, and anything that would embarrass me in a PR. I run it before every push.
- /commit — Read the staged changes and write a clean, conventional commit message. No more staring at an empty commit prompt.
- /scaffold — Create a new component with the file, its test, and its barrel export, following the patterns already in the repo.
/scaffold UserCardand it's done. - /explain — Walk me through how a file or feature works, in plain language, before I touch it.
How they differ from skills and subagents
Slash commands are one of three ways to package work in Claude Code, and it's worth knowing which is which.
A slash command is a prompt you trigger by typing /name. You're in control — nothing happens until you invoke it. It runs in your main conversation, with your current context.
A skill is loaded by the model on demand. You don't type a slash; Claude decides a skill is relevant to the task and pulls it in automatically. Skills are for capabilities the model should reach for when it notices it needs them.
A subagent is a separate agent with its own context window. You delegate a whole task to it, it works in isolation, and it returns a summary. Subagents are for heavy, self-contained jobs you want kept out of your main context.
Rule of thumb: reach for a slash command when you want to trigger a repeatable prompt, a skill when the model should pull in a capability, and a subagent when a job deserves its own context.
Wrapping up
Slash commands are the lowest-effort, highest-return feature in Claude Code. A markdown file and a slash, and your best prompts are always one keystroke away.
If you'd rather start with proven commands instead of building your own, that's exactly why I built AgentsCamp. Browse the directory and install any command into your project with npx agentscamp add commands/. Grab a few, see what sticks, and make them yours.