Arguments
[command purpose and requirements]
Create a Custom Claude Code Command
Create a new slash command in .claude/commands/ for the requested task.
Goal
#$ARGUMENTS
Key Capabilities to Leverage
File Operations:
- Read, Edit, Write - modify files precisely
- Glob, Grep - search codebase
- MultiEdit - atomic multi-part changes
Development:
- Bash - run commands (git, tests, linters)
- Task - launch specialized agents for complex tasks
- TodoWrite - track progress with todo lists
Web & APIs:
- WebFetch, WebSearch - research documentation
- GitHub (gh cli) - PRs, issues, reviews
- Playwright - browser automation, screenshots
Integrations:
- AppSignal - logs and monitoring
- Context7 - framework docs
- Stripe, Todoist, Featurebase (if relevant)
Best Practices
- Be specific and clear - detailed instructions yield better results
- Break down complex tasks - use step-by-step plans
- Use examples - reference existing code patterns
- Include success criteria - tests pass, linting clean, etc.
- Think first - use "think hard" or "plan" keywords for complex problems
- Iterate - guide the process step by step
Required: YAML Frontmatter
EVERY command MUST start with YAML frontmatter:
---
name: command-name
description: Brief description of what this command does (max 100 chars)
argument-hint: "[what arguments the command accepts]"
---
Fields:
name: Lowercase command identifier (used internally)
description: Clear, concise summary of command purpose
argument-hint: Shows user what arguments are expected (e.g., [file path], [PR number], [optional: format])
Structure Your Command
# [Command Name]
[Brief description of what this command does]
## Steps
1. [First step with specific details]
- Include file paths, patterns, or constraints
- Reference existing code if applicable
2. [Second step]
- Use parallel tool calls when possible
- Check/verify results
3. [Final steps]
- Run tests
- Lint code
- Commit changes (if appropriate)
## Success Criteria
- [ ] Tests pass
- [ ] Code follows style guide
- [ ] Documentation updated (if needed)
Tips for Effective Commands
- Use $ARGUMENTS placeholder for dynamic inputs
- Reference CLAUDE.md patterns and conventions
- Include verification steps - tests, linting, visual checks
- Be explicit about constraints - don't modify X, use pattern Y
- Use XML tags for structured prompts:
<task>, <requirements>, <constraints>
Example Pattern
Implement #$ARGUMENTS following these steps:
1. Research existing patterns
- Search for similar code using Grep
- Read relevant files to understand approach
2. Plan the implementation
- Think through edge cases and requirements
- Consider test cases needed
3. Implement
- Follow existing code patterns (reference specific files)
- Write tests first if doing TDD
- Ensure code follows CLAUDE.md conventions
4. Verify
- Run tests: `bin/rails test`
- Run linter: `bundle exec standardrb`
- Check changes with git diff
5. Commit (optional)
- Stage changes
- Write clear commit message
Creating the Command File
- Create the file at
.claude/commands/[name].md (subdirectories like workflows/ supported)
- Start with YAML frontmatter (see section above)
- Structure the command using the template above
- Test the command by using it with appropriate arguments
Command File Template
---
name: command-name
description: What this command does
argument-hint: "[expected arguments]"
---
# Command Title
Brief introduction of what the command does and when to use it.
## Workflow
### Step 1: [First Major Step]
Details about what to do.
### Step 2: [Second Major Step]
Details about what to do.
## Success Criteria
- [ ] Expected outcome 1
- [ ] Expected outcome 2
1---2name: generate-command3description: Create a new custom slash command following conventions and best practices4---56## Arguments7[command purpose and requirements]89# Create a Custom Claude Code Command1011Create a new slash command in `.claude/commands/` for the requested task.1213## Goal1415#$ARGUMENTS1617## Key Capabilities to Leverage1819**File Operations:**20- Read, Edit, Write - modify files precisely21- Glob, Grep - search codebase22- MultiEdit - atomic multi-part changes2324**Development:**25- Bash - run commands (git, tests, linters)26- Task - launch specialized agents for complex tasks27- TodoWrite - track progress with todo lists2829**Web & APIs:**30- WebFetch, WebSearch - research documentation31- GitHub (gh cli) - PRs, issues, reviews32- Playwright - browser automation, screenshots3334**Integrations:**35- AppSignal - logs and monitoring36- Context7 - framework docs37- Stripe, Todoist, Featurebase (if relevant)3839## Best Practices40411. **Be specific and clear** - detailed instructions yield better results422. **Break down complex tasks** - use step-by-step plans433. **Use examples** - reference existing code patterns444. **Include success criteria** - tests pass, linting clean, etc.455. **Think first** - use "think hard" or "plan" keywords for complex problems466. **Iterate** - guide the process step by step4748## Required: YAML Frontmatter4950**EVERY command MUST start with YAML frontmatter:**5152```yaml53---54name: command-name55description: Brief description of what this command does (max 100 chars)56argument-hint: "[what arguments the command accepts]"57---58```5960**Fields:**61- `name`: Lowercase command identifier (used internally)62- `description`: Clear, concise summary of command purpose63- `argument-hint`: Shows user what arguments are expected (e.g., `[file path]`, `[PR number]`, `[optional: format]`)6465## Structure Your Command6667```markdown68# [Command Name]6970[Brief description of what this command does]7172## Steps73741. [First step with specific details]75 - Include file paths, patterns, or constraints76 - Reference existing code if applicable77782. [Second step]79 - Use parallel tool calls when possible80 - Check/verify results81823. [Final steps]83 - Run tests84 - Lint code85 - Commit changes (if appropriate)8687## Success Criteria8889- [ ] Tests pass90- [ ] Code follows style guide91- [ ] Documentation updated (if needed)92```9394## Tips for Effective Commands9596- **Use $ARGUMENTS** placeholder for dynamic inputs97- **Reference CLAUDE.md** patterns and conventions98- **Include verification steps** - tests, linting, visual checks99- **Be explicit about constraints** - don't modify X, use pattern Y100- **Use XML tags** for structured prompts: `<task>`, `<requirements>`, `<constraints>`101102## Example Pattern103104```markdown105Implement #$ARGUMENTS following these steps:1061071. Research existing patterns108 - Search for similar code using Grep109 - Read relevant files to understand approach1101112. Plan the implementation112 - Think through edge cases and requirements113 - Consider test cases needed1141153. Implement116 - Follow existing code patterns (reference specific files)117 - Write tests first if doing TDD118 - Ensure code follows CLAUDE.md conventions1191204. Verify121 - Run tests: `bin/rails test`122 - Run linter: `bundle exec standardrb`123 - Check changes with git diff1241255. Commit (optional)126 - Stage changes127 - Write clear commit message128```129130## Creating the Command File1311321. **Create the file** at `.claude/commands/[name].md` (subdirectories like `workflows/` supported)1332. **Start with YAML frontmatter** (see section above)1343. **Structure the command** using the template above1354. **Test the command** by using it with appropriate arguments136137## Command File Template138139```markdown140---141name: command-name142description: What this command does143argument-hint: "[expected arguments]"144---145146# Command Title147148Brief introduction of what the command does and when to use it.149150## Workflow151152### Step 1: [First Major Step]153154Details about what to do.155156### Step 2: [Second Major Step]157158Details about what to do.159160## Success Criteria161162- [ ] Expected outcome 1163- [ ] Expected outcome 2164```