Create new Claude commands following best practices.
"Let's create a new command. Describe:"
- What problem does it solve?
- Who uses it and when?
- Expected output?
- Interactive or batch?
Check existing commands:
ls -la .claude/commands/ # Project
ls -la ~/.claude/commands/ # UserRead similar ones for patterns:
- Section structure
- Tool usage
- Argument handling
- Documentation references
Project command (.claude/commands/):
- Specific to this codebase
- Uses project conventions
- References project docs
User command (~/.claude/commands/):
- General-purpose
- Reusable across projects
- Personal productivity
Common structures:
# Command Name
Brief description
## Workflow
### 1. Step One
bash commands, tool usage
### 2. Step Two
process, decisions
## Rules/Safety
Key constraints
## Usage
ExamplesStandard sections:
- Clear workflow steps
- Bash examples for gh/git commands
- Safety/error handling
- Usage examples
- Output format
Create command file:
- Follow naming (gh- prefix for GitHub)
- Include workflow steps
- Add safety checks
- Show examples
Test it:
- Run example scenarios
- Verify argument handling
- Check error cases
GitHub commands:
gh pr view {PR}
gh pr checkout {PR}
gh api repos/{owner}/{repo}/...Git operations:
git branch --show-current
git diff main...HEAD
git status --shortSafety checks:
- Warn on main branch
- Check uncommitted changes
- Confirm destructive ops
gh-* - GitHub workflows (PR, CI, commits) de-slop - Code cleanup make-tests - Test creation new-cmd - Meta (this file)
✅ Command created: {location}/{name}.md
Usage: /{name} [args]
Example: /{name} 123
Next: Test it, refine based on usage
/new-cmd