
Slash Commands
Create and use Claude Code slash commands with bash execution and file references
What You Can Do
You can create reusable slash commands that execute instantly in Claude Code conversations. Commands support bash execution, file references, arguments, and tool permissions. Use built-in commands like /cost, /review, /memory, and /clear, or define custom project and personal commands stored in .claude/commands/ or ~/.claude/commands/.
Features
`/cost`, `/clear`, `/compact`, `/config`, `/agents`, `/mcp`, `/memory`, `/model`, `/review`, `/resume`, `/help`
Store reusable prompts in `.claude/commands/` for team access and version control
Create user-specific commands in `~/.claude/commands/` for individual workflows
Prefix instructions with `!` to run shell commands and inject output into prompts
Specify which tools (Bash, Read, Write) each command can access via `allowed-tools`
Accept user input with `$1`, `$2`, or `$ARGUMENTS` placeholders and display hints
Define description, tool access, and argument format in command metadata
Embed file content and paths directly in command prompts
Example Output
Example 1: Built-in /cost command
Tokens used in this session: 45,230
Input tokens: 32,100 | Output tokens: 13,130
Estimated cost: $0.87
Example 2: Custom /optimize command output
Performance Analysis:
✓ Identified O(n²) loop in data processing (lines 45-52)
✓ Missing memoization on recursive function
✓ Suggests caching layer for repeated queries
Recommended fix: Implement request deduplication
Example 3: Bash-enabled /git-status command
Current branch: feature/auth-improvements
Staged changes: 3 files modified
Recent commits:
a1b2c3d Fix login validation
d4e5f6g Add password reset flow
g7h8i9j Initial auth module
Suggestion: Create PR for feature/auth-improvements
What's Included
- SKILL.md: Complete slash command reference with syntax, built-in command list, and format specifications
- Command templates: Ready-to-use project and personal command examples (code review, git helpers, optimization)
- YAML format guide: Metadata structure for descriptions, tool permissions, and argument handling
- Bash execution patterns: Examples using `!` prefix to inject shell output into prompts
- Directory setup instructions: Quick commands to create `.claude/commands/` and `~/.claude/commands/` directories
Who It's For
- Full-stack engineers — Create commands for git workflows, environment setup, and code review processes
- DevOps and platform engineers — Build commands for deployment checks, infrastructure queries, and health monitoring
- Data scientists and analysts — Define commands for data validation, notebook execution, and analysis workflows
- Technical team leads — Set up shared project commands for consistent code review, testing, and documentation practices
- Automation specialists — Create bash-enabled commands that combine file operations, queries, and intelligent prompts
Best For
- Automating repetitive development workflows (code reviews, testing, formatting)
- Integrating bash scripts and system queries into AI prompts
- Creating team-wide or personal command shortcuts for complex multi-step processes
- Injecting real-time system output (git status, logs, metrics) into Claude's context
- Defining role-based commands with specific tool access and permission controls







