// Use when creating, improving, or troubleshooting Claude Code slash commands. Expert guidance on command structure, arguments, frontmatter, tool permissions, and best practices for building effective custom commands.
| name | slash-command-builder |
| description | Use when creating, improving, or troubleshooting Claude Code slash commands. Expert guidance on command structure, arguments, frontmatter, tool permissions, and best practices for building effective custom commands. |
| globs | ["**/.claude/commands/**/*.md","**/.claude/commands/**/*.markdown"] |
| alwaysApply | false |
Use this skill when creating, improving, or troubleshooting Claude Code slash commands. Provides expert guidance on command structure, syntax, frontmatter configuration, and best practices.
Activate this skill when:
---
description: Brief description shown in autocomplete
argument-hint: [arg1] [arg2] <optional-arg>
allowed-tools: Bash(git *), Read, Write
model: claude-3-5-sonnet-20241022
disable-model-invocation: false
---
Your command prompt here with $ARGUMENTS or $1, $2, etc.
Use !`command` for bash execution
Use @file.txt for file references
Project commands (shared with team):
.claude/commands/my-command.md
Personal commands (individual use):
~/.claude/commands/my-command.md
Organized commands (namespaced):
.claude/commands/frontend/component.md โ /component (project:frontend)
Good candidates for slash commands:
NOT good for slash commands (use Skills instead):
Best practices:
/review-pr, /optimize-codeExamples:
/review-pr - Clear, concise/fix-lint - Action-oriented/review-pull-request-thoroughly - Too verbose/rpr - Too crypticSimple command (no arguments):
---
description: Analyze code for performance bottlenecks
---
Analyze the current file for performance issues:
1. Identify O(nยฒ) or worse algorithms
2. Find unnecessary re-renders or computations
3. Check for memory leaks
4. Suggest optimizations with code examples
Command with all arguments:
---
description: Generate component boilerplate
argument-hint: <component-name> <type>
---
Create a $ARGUMENTS component following our style guide:
- Use TypeScript with strict types
- Include prop interfaces
- Add JSDoc comments
- Export as default
Command with positional arguments:
---
description: Review pull request
argument-hint: [pr-number] [reviewer]
---
Review PR #$1 and assign to @$2:
1. Check code quality and style
2. Verify tests are included
3. Look for security issues
4. Suggest improvements
5. Add comments in GitHub
See FRONTMATTER.md in this skill directory for complete frontmatter options.
Minimal frontmatter:
---
description: What this command does
---
Full-featured frontmatter:
---
description: Complete command with all options
argument-hint: [required] <optional>
allowed-tools: Bash(git *), Read(**/*.ts), Write
model: claude-3-5-sonnet-20241022
disable-model-invocation: false
---
.claude/commands//command-nameallowed-toolsExecute shell commands inline with ! prefix:
---
description: Show git status
allowed-tools: Bash(git status:*)
---
Current repository status:
!`git status`
Recent commits:
!`git log --oneline -5`
Include file contents with @ prefix:
---
description: Review specific file
argument-hint: <file-path>
---
Review this file for code quality:
@$1
Focus on:
- Type safety
- Error handling
- Performance
- Maintainability
Restrict which tools Claude can use:
---
description: Safe git status check
allowed-tools: Bash(git status:*), Bash(git diff:*)
---
Show current changes:
!`git status`
!`git diff --stat`
Tool permission syntax:
Bash(command:*) - Allow specific command with any argsRead(path/to/*.ts) - Allow reading TypeScript files in pathWrite - Allow writing any fileGlob, Grep, Edit - Other available toolsOverride default model for specific commands:
---
description: Quick syntax fix
model: claude-3-5-haiku-20241022
---
Fix syntax errors in the current file quickly.
When to use different models:
claude-3-5-haiku-20241022 - Fast, simple tasksclaude-3-5-sonnet-20241022 - General purpose (default)claude-opus-4-20250514 - Complex reasoningPrevent Claude from calling command automatically:
---
description: Destructive operation
disable-model-invocation: true
---
!`rm -rf node_modules`
!`npm install`
---
description: Review code changes
argument-hint: [file-or-pr]
allowed-tools: Bash(git *), Read, Grep
---
Review $ARGUMENTS for:
1. **Code Quality**
- Clean, readable code
- Proper naming conventions
- DRY principle
2. **Security**
- Input validation
- SQL injection risks
- XSS vulnerabilities
3. **Performance**
- Inefficient algorithms
- Unnecessary computations
- Memory leaks
4. **Tests**
- Unit test coverage
- Edge cases handled
- Integration tests
Provide specific file:line references for all issues.
---
description: Create feature branch
argument-hint: <feature-name>
allowed-tools: Bash(git *)
---
Create and switch to feature branch:
!`git checkout -b feature/$1`
!`git push -u origin feature/$1`
Branch feature/$1 created and pushed to origin.
---
description: Generate API docs
argument-hint: <file-path>
allowed-tools: Read
---
Generate comprehensive API documentation for:
@$1
Include:
- Function signatures with types
- Parameter descriptions
- Return value documentation
- Usage examples
- Error cases
---
description: Generate test cases
argument-hint: <file-to-test>
allowed-tools: Read, Write
---
Generate test cases for:
@$1
Create tests covering:
- Happy path scenarios
- Edge cases
- Error conditions
- Boundary values
Use the existing test framework style.
Problem: /my-command doesn't autocomplete
Solutions:
.claude/commands/ or ~/.claude/commands/.claude/commands/my-command.md)Problem: $1 appears literally instead of being replaced
Solutions:
/command arg1 arg2$1, $2 (not ${1})$ARGUMENTS insteadargument-hint frontmatter is correctProblem: Command can't execute bash or read files
Solutions:
allowed-tools frontmatterBash(git *)Bash, not bash)Read(**/*.ts)Problem: Claude calls command when you don't want it to
Solutions:
disable-model-invocation: true to frontmatterdescription is specific to avoid false triggersExample:
/review-pr - Quick PR review promptcode-reviewer - Comprehensive review framework with security.md, performance.md, style.md, and scriptsEach command should do ONE thing well. Don't create Swiss Army knife commands.
argument-hint: [required] <optional> [choices: a|b|c]
Tell Claude what format you want:
Generate a JSON response with this structure:
{
"issues": [],
"suggestions": []
}
Show Claude what good output looks like:
Example output:
## Security Issues
- **SQL Injection** (file.ts:42) - Use parameterized queries
Don't use allowed-tools: Bash - use allowed-tools: Bash(git *)
Store .claude/commands/ in git for team collaboration
Use subdirectories for related commands:
.claude/commands/
โโโ git/
โ โโโ feature.md
โ โโโ fix.md
โ โโโ release.md
โโโ testing/
โโโ unit.md
โโโ e2e.md
Before finalizing a slash command:
Remember: Great slash commands are simple, focused, and make frequent tasks effortless. If you find yourself adding complexity, consider creating a Skill instead.