Best practices for creating Claude Code slash commands. Use this skill when creating, editing, or improving custom slash commands for Claude Code. Covers frontmatter configuration, dynamic features ($ARGUMENTS, bash execution, file references), command patterns (git workflows, multi-agent orchestration, code review), and helps decide when to use slash commands vs skills vs subagents.
/plugin marketplace add horuz-ai/claude-plugins/plugin install core@horuzThis skill inherits all available tools. When active, it can use any tool Claude has access to.
assets/templates/git-workflow.mdassets/templates/multi-agent.mdassets/templates/review-command.mdassets/templates/simple-command.mdreferences/decision-guide.mdreferences/frontmatter.mdreferences/patterns.mdThis skill provides guidance for creating effective custom slash commands in Claude Code.
Locations:
.claude/commands/ (shared via git)~/.claude/commands/ (user-specific)File format: Markdown (.md) with optional YAML frontmatter
Command name: Derived from filename (commit.md → /commit)
See references/frontmatter.md for complete documentation.
Essential fields:
---
allowed-tools: Bash(git add:*), Bash(git commit:*) # Tool permissions
description: Brief description shown in /help # Required for model invocation
argument-hint: "[branch-name] [commit-type]" # Shown in autocomplete
model: claude-haiku-4-5 # Override session model
disable-model-invocation: true # Prevent auto-invocation
---
All arguments: $ARGUMENTS captures everything after the command
Fix issue #$ARGUMENTS following our coding standards
# /fix-issue 123 high-priority → "123 high-priority"
Positional: $1, $2, $3... for specific arguments
Review PR #$1 with priority $2 and assign to $3
# /review-pr 456 high alice → $1="456", $2="high", $3="alice"
Use ! prefix to execute bash and inject output as context:
## Context
- Current git status: !`git status`
- Current branch: !`git branch --show-current`
- Recent commits: !`git log --oneline -10`
Important: Requires allowed-tools with Bash tool in frontmatter.
Use @ prefix to include file contents:
Review the implementation in @src/utils/helpers.js
Compare @src/old-version.js with @src/new-version.js
See references/patterns.md for detailed patterns with full examples.
For quick, focused operations:
---
description: Analyze code for performance issues
---
Analyze this code for performance issues and suggest optimizations.
Focus on: time complexity, memory usage, unnecessary operations.
For git operations with context:
---
allowed-tools: Bash(git add:*), Bash(git status:*), Bash(git commit:*)
description: Create a git commit
---
## Context
- Current git status: !`git status`
- Current git diff: !`git diff HEAD`
- Current branch: !`git branch --show-current`
## Your task
Based on the above changes, create a single commit with an appropriate message.
For complex tasks requiring parallel work:
---
allowed-tools: Bash(gh:*), TodoWrite
description: Find duplicate GitHub issues
---
Find duplicates for issue $ARGUMENTS.
Follow these steps precisely:
1. Use an agent to view the issue and return a summary
2. Launch 5 parallel agents to search for duplicates using diverse keywords
3. Feed results into another agent to filter false positives
4. Comment on the issue with up to 3 likely duplicates
Notes (tell your agents too):
- Use `gh` for GitHub interactions
- Do not use other tools beyond `gh`
For comprehensive analysis workflows:
---
description: "Comprehensive code review"
argument-hint: "[review-aspects]"
allowed-tools: ["Bash", "Glob", "Grep", "Read", "Task"]
---
# Code Review
**Review Aspects (optional):** "$ARGUMENTS"
## Workflow:
1. **Determine Scope** - Check git status for changed files
2. **Run Reviews** - Execute applicable review agents
3. **Aggregate Results** - Summarize findings by severity
4. **Provide Action Plan** - Organize fixes by priority
See references/decision-guide.md for detailed comparison.
Quick decision framework:
| Use Case | Best Choice |
|---|---|
| Quick, repeatable task you trigger manually | Slash Command |
| Complex workflow with scripts/templates | Skill |
| Parallel execution with isolated context | Subagent |
| Team-shared workflow checked into git | Slash Command |
| Domain expertise Claude should auto-discover | Skill |
| Specialized role (security auditor, etc.) | Subagent |
Key distinctions:
/command), simple prompts, manual triggerUse templates in assets/templates/ as starting points:
simple-command.md - Basic single-purpose commandgit-workflow.md - Git operations with context injectionmulti-agent.md - Orchestration with parallel agentsreview-command.md - Comprehensive review workflowGranular tool permissions: Use wildcards for flexibility
allowed-tools: Bash(git add:*), Bash(git commit:*)
Context injection: Pre-load relevant state with bash execution
Clear task structure: Use ## Your task or ## Your Task section
Explicit constraints: Include prohibitions
Do not use any other tools or do anything else.
Do not send any other text or messages besides these tool calls.
Output format specification: Provide exact templates for structured output
Agent instructions: When using subagents, include notes they should follow
Notes (be sure to tell this to your agents, too):
- Use `gh` for GitHub interactions
- Make a todo list first