If you’re using Claude Code in your terminal, you’ve probably typed /help or /clear before. Those are built-in slash commands. But the real power move is building your own.
A custom slash command is just a Markdown file with a prompt inside it. Drop it in the right folder, and Claude Code instantly turns it into a /command you can run anytime. The filename becomes the command name — review.md becomes /review.
01 Where to Save Them
You have two options depending on whether you want the command everywhere or just in one project:
~/.claude/commands/your-command.md — Available in every Claude Code session, on any project.
.claude/commands/your-command.md — Lives in the project root. Gets committed with your repo so the whole team can use it.
You can also namespace with subfolders. A file at .claude/commands/ahk/review.md becomes /project:ahk:review.
02 Your First Command
At its simplest, a command is just a prompt saved as a file. No YAML, no special syntax — just plain text that tells Claude what to do.
Example: Quick AHK Script Starter
Example: Code Review
Type /ahk-new or /review in Claude Code and you’re off to the races.
03 Dynamic Input with $ARGUMENTS
Static prompts are great, but things get way more useful when your command can accept input. Drop $ARGUMENTS anywhere in the file and whatever you type after the command name gets plugged in.
Example: Explain a Concept
/explain
COM objects in AutoHotkey v2
Example: Write an Email Promo
/promo-email
AHK Script Maker — 50% off this week only
04 Positional Arguments: $1, $2, $3
When you need specific pieces of input in specific places, use numbered placeholders instead. Each word or phrase you type gets assigned to a position.
Example: File Converter
/convert
data.csv CSV JSON
$1 = data.csv, $2 = CSV, $3 = JSON
Example: GitHub Issue Fixer
/fix-issue
42 high
05 Inline Bash with ! Backticks
This is where it gets really powerful. Prefix a backtick command with ! and Claude will execute it and inject the output directly into the prompt. Your command gets live, real-time context without you having to paste anything.
Example: Smart Commit Message
When you type /commit, Claude runs those git commands first, reads the actual diff, then writes a commit message that actually describes what changed. No copy-pasting.
Example: Project Status Report
06 File References with @
Use the @ symbol to pull a file’s contents directly into the prompt. Perfect for comparing files or giving Claude context about your codebase.
Example: Compare Two Files
/compare
src/v1/app.ahk src/v2/app.ahk
Example: Document a Script
/document
lib/StringUtils.ahk
07 YAML Frontmatter: The Control Panel
Add a YAML block between --- markers at the very top of your file to control how the command behaves. This is optional but gives you superpowers.
Example: Quick Linter (Fast Model)
This runs on Haiku so it’s nearly instant — perfect for a quick sanity check before you save.
Example: Deploy Guard (No Auto-Run)
disable-model-invocation: true is critical for commands that have real-world side effects. You don’t want Claude deciding to deploy because your code “looks ready.”
08 Putting It All Together
The real magic happens when you combine these features. Here’s a command that uses frontmatter, inline bash, arguments, and file references all at once:
/full-review
src/main.ahk
One command. Claude reads the file, checks the git history, looks at uncommitted changes, and delivers a detailed review. All with six keystrokes and a filename.
Commands are just the starting point. For complex multi-step workflows that Claude should trigger automatically, look into Skills — the next evolution that supports bundled scripts, templates, and autonomous invocation.

