| name | pr |
| description | Prepare and create a GitHub pull request from the current branch. Use when the user asks to open a PR, create a pull request, or requests `/pr`, including an optional base branch argument. |
GitHub Pull Request
Use this workflow when the user wants a PR created from the current branch.
Base Branch
- Use the user-provided base branch when present.
- Default to
main when no base branch is provided.
Workflow
- Identify the current branch with
git branch --show-current.
- Stop if the current branch is the base branch.
- Inspect commits with
git log origin/<base>..HEAD --oneline.
- Inspect changed files with
git diff origin/<base>...HEAD --name-status.
- Inspect the full branch diff with
git diff origin/<base>...HEAD.
- Check whether the branch is pushed and whether an open PR already exists.
- Summarize the changes by feature additions, structural changes, refactors, tests, and docs.
- Draft one Mermaid diagram that shows the main changed flow or component relationship.
- Draft a PR title and body that match existing repository style.
- Push the current branch if needed.
- Create the PR with the available GitHub tooling, preferring
gh pr create when available.
- Return the PR URL.
PR Body Shape
Prefer a concise body like:
## Summary
- ...
## How It Works
```mermaid
flowchart LR
A[Before] --> B[Changed behavior]
B --> C[Result]
```
## Testing
- ...
Keep the diagram small, factual, and derived from the diff. Prefer flowchart for data or control flow and sequenceDiagram for interactions. Do not invent components or include a diagram that merely repeats the summary; omit it only when the change has no meaningful flow or relationship to visualize.
Mention tests that were not run.
Safety
- Do not create a PR from
main or the selected base branch.
- Do not force-push unless the user explicitly requests it.
- If an open PR already exists for the branch, return that PR instead of creating a duplicate.