Commands are user-invocable actions defined in Markdown files. When a user types /command-name in Claude Code, the command's instructions guide Claude's behavior. Commands are the primary way users interact with plugins.
# Command NameBrief one-sentence description of what this command does.
## Usage```/command-name [options]```## PurposeExplain when and why users should use this command. What problem does it solve?
## InstructionsStep-by-step instructions for Claude to follow:
1. First, do this
2. Then, do that
3. Finally, complete with this
## Examples### Example 1: Basic Usage```/command-name```Expected outcome: Description of what happens.
### Example 2: With Options```/command-name --option value```Expected outcome: Description of what happens.
## Best Practices-✅ Do this
-❌ Don't do that
## Troubleshooting### Common Issue 1**Problem**: Description of the problem
**Solution**: How to fix it
## PurposeUse this command when you need to:
-Create a pull request from your current branch
-Ensure code is properly formatted before PR
-Generate professional PR descriptions automatically
-Follow team PR conventions consistently
**When to use:**-After committing changes to a feature branch
-When ready for code review
-Before merging work into main branch
**When NOT to use:**-On protected branches (main, develop) - command will create feature branch first
-Without committed changes - use `/commit` first
## InstructionsFollow these steps to create a pull request:
1.**Check current branch**-Verify you're not on a protected branch (main, develop)
-If on protected branch, create a feature branch with format: `<type>/<description>-<date>`-Types: feature/, fix/, docs/, refactor/
2.**Format code**-Detect project type (JavaScript, Python, Java)
-Run appropriate formatter (Biome, Black, Google Java Format)
-Commit formatting changes if any
3.**Push to remote**-Push current branch to origin
-Set upstream tracking
4.**Generate PR description**-Analyze all commits on the branch
-Create summary of changes
-List modified files
-Generate test plan checklist
5.**Create pull request**-Use GitHub CLI (`gh pr create`)
-Set title from most recent commit
-Use generated description
-Target main branch (or specified with --target)
-Mark as draft if --draft flag provided
6.**Confirm success**-Display PR URL
-Show PR number
-Confirm target branch
Format: H2 heading
Content: Detailed step-by-step process
Structure: Numbered list with sub-bullets
Detail level: Specific enough for Claude to execute
## Examples### Example 1: Basic PR Creation```/create-pr```**What happens:**1. Checks you're on feature branch `feature/user-dashboard`2. Formats code with Biome
3. Pushes to origin
4. Creates PR targeting main
5. Returns: `https://github.com/org/repo/pull/42`### Example 2: Draft PR```/create-pr --draft```Creates a draft PR for early feedback without requesting reviews.
### Example 3: Custom Target Branch```/create-pr --target develop```Creates PR targeting `develop` instead of `main`.
Format: H2 heading with H3 subheadings for each example
## Best Practices### ✅ Do-**Keep PRs small** - Aim for 150-400 lines of changes
-**Write clear titles** - Describe the "what" in under 50 characters
-**Self-review first** - Check your own diff before submitting
-**Link issues** - Reference with `Fixes #123` or `Closes #456`### ❌ Don't-**Create huge PRs** - Large PRs are hard to review
-**Mix unrelated changes** - Each PR should address one concern
-**Skip the description** - Reviewers need context
-**Force push without warning** - Communicate with reviewers first
Format: H2 heading with H3 subheadings for Do/Don't
## Troubleshooting### PR Creation Fails**Problem**: `gh pr create` returns an error
**Solution**:
1. Verify GitHub CLI is authenticated: `gh auth status`2. Check remote is configured: `git remote -v`3. Ensure branch is pushed: `git push -u origin HEAD`### Branch Already Exists**Problem**: The suggested branch name already exists
**Solution**:
1. Claude will detect this and suggest an alternative name
2. Or delete the old branch if no longer needed: `git branch -d old-branch`
Format: H2 heading with H3 subheadings for each issue
## Instructions1.**Determine branch strategy**-IF on protected branch (main, develop):
-Create new feature branch
-Checkout new branch
-ELSE IF on feature branch:
-Use current branch
-ELSE:
-Ask user for confirmation
2.**Handle uncommitted changes**-IF unstaged changes exist:
-Call `/commit` command
-Wait for commit completion
-ELSE IF no commits on branch:
-Error: "No changes to create PR from"
-ELSE:
-Proceed with PR creation
## PrerequisitesBefore using this command:
1. Ensure changes are committed (use `/commit` if needed)
2. Verify GitHub CLI is installed and authenticated
3. Confirm you're in a git repository
**Automatic integration:**-If uncommitted changes detected, `/commit` is called automatically
-If formatting needed, appropriate formatter is invoked