1.5 KiB
1.5 KiB
Slash Commands Reference
Quick reference for creating custom slash commands.
Structure
---
description: Brief description
argument-hint: [arg1] [arg2]
allowed-tools: Tool1, Tool2
---
Your command prompt here with $ARGUMENTS or $1, $2, etc.
Location
- Project:
.claude/commands/filename.md→/filename - Personal:
~/.claude/commands/filename.md→/filename - Subdirectories:
.claude/commands/subdir/filename.md→/filename(subdir shown in description)
Arguments
$ARGUMENTS- All arguments as single string$1, $2, $3- Individual arguments
File References
Use @ prefix to reference files:
Review @src/app.js for bugs
Compare @old.js with @new.js
Bash Execution
Prefix with ! to execute bash:
---
allowed-tools: Bash(git status:*), Bash(git diff:*)
---
Current status: !`git status`
Recent changes: !`git diff HEAD`
Simple Examples
Commit helper:
---
description: Create git commit
allowed-tools: Bash(git add:*), Bash(git commit:*)
---
Create a commit for these changes: !`git diff`
Review PR:
---
description: Review pull request
argument-hint: [pr-number]
---
Review PR #$1 focusing on code quality and security.
Fix issue:
---
description: Fix GitHub issue
argument-hint: [issue-number]
---
Fix issue #$ARGUMENTS following our coding standards.
Tips
- Keep descriptions short and clear
- Use
allowed-toolsto pre-approve tools - Simple prompts work best
- Test with different arguments