Commands
Claude
Intermediate
Write a Slash Command
Create custom slash commands for Claude Code with markdown templates
27 of 66
What are slash commands?
Slash commands are reusable prompt templates stored as markdown files. Type /command-name in Claude Code to run them.
File location
.claude/commands/ my-command.md another-command.md
Basic template
# Command Title You are performing X. The user wants Y. **User's input:** $ARGUMENTS ## Steps 1. Read the relevant files 2. Analyze the situation 3. Perform the action 4. Report results
Using arguments
$ARGUMENTS captures everything the user types after the command name:
/my-command fix the login bug
Here, $ARGUMENTS = "fix the login bug".
Tips
- Keep instructions specific and actionable
- Reference file paths the agent should check
- Include guardrails (e.g., "do NOT modify tests")
- Test with edge cases to refine the prompt