Build Your Own Slash Commands: The Prompt Templates Behind the Magic
intermediate 20 min 📋 Copy-paste ready
Sources not yet verified
Scenario
Context: You've seen /specify, /plan, and /session-start commands but want to understand how they work and customize them for your team
Goal: Learn that slash commands are just reusable prompt templates, and build your own from scratch
Anti-pattern: Treating AI tools as black boxes instead of understanding the prompts underneath
Tools: Claude CodeGitHub CopilotCursor
Key Takeaways
- Slash commands are just Markdown files containing prompt templates
- Put project commands in .claude/commands/, personal in ~/.claude/commands/
- Use $ARGUMENTS for single input, $1 $2 $3 for multiple arguments
- Commands can work together by reading/writing shared files
- Commit .claude/commands/ to git to share workflows with your team
Try It Yourself
Prompt Template
Create a custom slash command for a task you do repeatedly.
1. Create the file:
```bash
mkdir -p .claude/commands
```
2. Write your template in `.claude/commands/your-command.md`:
```markdown
---
description: [What this command does]
argument-hint: [Expected input]
---
[Your prompt here]
$ARGUMENTS
```
3. Test it: `/project:your-command [input]` Variations to Try
- Start simple: Create a /project:explain command that explains code you paste in
- Add structure: Create /project:plan that generates implementation plans
- Build workflows: Create /project:task-start and /project:task-done that work together
Sources
Tempered AI — Forged Through Practice, Not Hype
? Keyboard shortcuts