Commands

How to Create a Custom Slash Command in Claude Code

2 min read

A slash command is just a Markdown file. The file name becomes the command name.

1. Create the folder

Project-level (shared with your repo):

mkdir .claude\commands

Or user-level (available in every project): use ~/.claude/commands.

2. Add a command file

Create .claude\commands\review.md. The filename review.md makes the command /review:

Review the current git diff for bugs and risky changes.
Focus on correctness. Be concise. $ARGUMENTS

$ARGUMENTS is replaced by anything you type after the command.

3. Run it

In Claude Code:

/review only the auth module

That runs your prompt with only the auth module substituted into $ARGUMENTS.


Tips

Open the full interactive version (with copy buttons) ↗

← All guides