GitHub Pull Requests
Create, update, publish, view, review, and search pull requests on GitHub — safely, consistently, and always as drafts first.
Operations
Identify the user's intent and read the corresponding reference file from this skill's references/ directory:
| Operation | When | Reference |
|-----------|------|-----------|
| Create | No PR exists for this branch | references/create.md |
| Update | PR already exists or user asks to edit title, body, labels, reviewers, assignees, or milestone | references/update.md |
| Publish | User wants to mark a draft PR as ready for review | references/publish.md |
| View | User wants to inspect a specific PR — description, comments, reviews, CI status, merge conflicts, or requested changes | references/view.md |
| Review | User wants to add line-level comments or a formal review (Approve/Request Changes) | references/review.md |
| List | User wants to search, filter, or browse PRs by state, label, author, assignee, branch, or full-text search | references/list.md |
Read only the reference you need — do not load all of them.
Shared Resources
| Resource | Path | Purpose |
|----------|------|---------|
| Pre-flight script | scripts/preflight.sh | Safety checks (branch, remote, auth, existing PRs) — run before Create |
| Context script | scripts/context.sh <base> <head> | Collect commits, diffstat, and full diff into temp files — run during Create |
| View script | scripts/view.sh [<pr_number>] | Fetch PR metadata, comments, and diff into temp files — run during View |
| Fallback body template | templates/pull_request.md | PR body template when the repo has none |
Hard Rules
These rules apply to all operations:
- Never infer the base branch. Always ask the user if not provided.
- Never create a PR from
main/master. Stop immediately and tell the user. - Always create PRs as drafts. Never create in ready-for-review state.
- Always use
--body-file. Write the body via your native file writing tool, then pass the path togh. Never use--bodywith inline text. Never use shell-based file creation (cat,echo,mktemp, heredocs). - Always confirm before executing. Present the full PR/change to the user and wait for explicit approval.
- Always check for existing PRs. Before creating, verify one doesn't already exist for this branch.
- Always get explicit user permission before posting a review. Present the full list of comments and the review status (e.g., REQUEST_CHANGES) to the user and wait for their approval before submitting.
- Use
gh apifor Line-Level Reviews. When adding comments to specific lines/files, use the structured JSON payload and the GitHub Reviews API to ensure atomicity and correctness.