Creating Shortcuts to your own Claude Commands


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:

Personal (all projects)

~/.claude/commands/your-command.md — Available in every Claude Code session, on any project.

Project-specific

.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

~/.claude/commands/ahk-new.md
Create a new AutoHotkey v2 script with proper headers:
#Requires AutoHotkey v2.0.2+
#SingleInstance Force
DetectHiddenWindows true
Use camelCase, One True Brace formatting, and
inline comments for beginners.
Functions go at the end of the script.

Example: Code Review

~/.claude/commands/review.md
Review the current file for bugs, performance
issues, and best practices. Check for:
1. Undeclared or uninitialized variables
2. Deprecated syntax or patterns
3. Missing error handling
4. Opportunities to simplify

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.md
Explain the following concept in simple terms
a beginner would understand:
$ARGUMENTS
Use analogies and short code examples.

/explain
COM objects in AutoHotkey v2

Example: Write an Email Promo

promo-email.md
Write an HTML email promoting: $ARGUMENTS
Rules:
- Inline CSS only (no external stylesheets)
- Direct-response copywriting style
- One clear call-to-action button
- Keep it under 300 words

/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.md
Convert the file $1 from $2 format to $3 format.
Preserve all data and handle edge cases.

/convert
data.csv CSV JSON

$1 = data.csv, $2 = CSV, $3 = JSON

Example: GitHub Issue Fixer

fix-issue.md
Fix GitHub issue #$1 with priority $2.
Steps:
1. Read the issue details
2. Find relevant files in the codebase
3. Implement the fix
4. Write tests to verify

/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

commit.md
## Staged Changes
!`git diff --cached`
## Current Branch
!`git branch --show-current`
Write a clear, conventional commit message
based on the changes above.

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

status.md
## Recent Commits
!`git log --oneline -10`
## Modified Files
!`git status --short`
## TODO Comments
!`grep -rn "TODO" src/ --include="*.ahk"`
Summarize the current project status based
on the above information.

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.md
Compare these two files and list the differences:
### File A
@$1
### File B
@$2
Highlight breaking changes and improvements.

/compare
src/v1/app.ahk src/v2/app.ahk

Example: Document a Script

document.md
Read this script and generate documentation:
@$1
Include: purpose, parameters for each function,
return values, and usage examples.

/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.

OptionWhat It Does
descriptionShows up when you type /help — so you remember what the command does
allowed-toolsAuto-approves specific tools so you don’t get permission prompts every time
modelForce a specific model — use haiku for fast stuff, opus for heavy thinking
argument-hintShows users what to type after the command, like [filename]
disable-model-invocationSet to true to prevent Claude from running this on its own

Example: Quick Linter (Fast Model)

lint.md
---
description: Quick syntax check for AHK v2 scripts
allowed-tools: Read, Grep
model: haiku
argument-hint: [filename]
---
Check $ARGUMENTS for common AutoHotkey v2 mistakes:
- v1 syntax used by accident
- Undeclared variables
- Missing braces or parentheses
Keep the report short and actionable.

This runs on Haiku so it’s nearly instant — perfect for a quick sanity check before you save.

Example: Deploy Guard (No Auto-Run)

deploy.md
---
description: Build and deploy to production
allowed-tools: Bash(npm run:*), Bash(git:*)
model: opus
disable-model-invocation: true
---
Deploy the application to production:
1. Run the full test suite
2. Build for production
3. Tag the release with current version
4. Push to the deploy branch
Stop immediately if any tests fail.
Pro Tip

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.md
---
description: Full code review with git context
allowed-tools: Read, Grep, Glob, Bash(git:*)
model: opus
argument-hint: [filename]
---
## File to Review
@$1
## Recent Changes to This File
!`git log --oneline -5 -- $1`
## Current Diff
!`git diff -- $1`
Perform a thorough review covering:
1. Bugs and logic errors
2. Performance concerns
3. Readability improvements
4. Security issues
Be specific. Reference line numbers.

/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.

Remember

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.

Comments are closed.