# Gh Pr Create

> Create a GitHub Pull Request using the gh CLI after git-incremental-commits has produced a clean working tree. Use when asked to open a PR, create a PR after committing, or "make a PR". Generates a PR body with Summary, Major changes, optional Screenshots, optional Tests, and optional Additional info. Use when this capability is needed.

- Skill: `tomevault-io/gh-pr-create` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add tomevault-io/gh-pr-create`
- Raw SKILL.md: https://api.skillmd.com/api/skills/tomevault-io/gh-pr-create/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: tomevault-io (https://skillmd.com/u/tomevault-io)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/tomevault-io/gh-pr-create

---


# GitHub PR Create (gh)

## Goal

After `$git-incremental-commits` finishes (working tree clean), push the branch, open a PR with a consistent body format, then ask who to request review from.

## Preconditions

- Repo is on a non-`main`/`master` branch.
- `git status -sb` is clean.
- `gh` is installed and authenticated (`gh auth status`).

## Workflow

1. Verify working tree is clean.
   - `git status -sb`
   - Stop if there are uncommitted changes.

2. Confirm you are on a branch suitable for a PR.
   - `git branch --show-current`
   - If on `main`/`master` or detached HEAD: stop and create/switch to a branch.

3. Ensure the branch is pushed.
   - If no upstream is set: `git push -u origin HEAD`
   - Otherwise: `git push`

4. Determine PR base branch.
   - Prefer the repo default branch: `gh repo view --json defaultBranchRef -q .defaultBranchRef.name`

5. Write a PR body in this format (human summary, not diffstats).

- Include these headings exactly:
  1. `## Summary`
  2. `## Major changes`

- Conditionally include these headings:
  - `## Screenshots`: include only if relevant (UI changes or image diffs).
  - `## Tests`: include only if the repo has a configured test command/CI expectation.
  - `## Additional info`: include only if there is something non-obvious to call out (follow-ups, rollout notes, risks).

6. Open the PR with `gh pr create`.

- Title:
  - Default to a summarized Conventional Commit style title derived from the branch commits (e.g. `Feat: ...`, `Fix: ...`, `Docs: ...`).
  - Override with `PR_TITLE="..."` if needed.

- Body:
  - Use `--body` or `--body-file`:
    - `gh pr create --title "..." --body-file /tmp/pr-body.md`

7. After the PR is created, ask who to request review from.

- Prompt the user for reviewers (GitHub usernames), supporting these special cases:
  - `copilot`: request review via the GitHub CLI reviewer option.
  - `codex`: request review by commenting `@codex review` on the PR.

- If the user chose `copilot`:
  - `gh pr edit --add-reviewer copilot`

- If the user chose `codex`:
  - `gh pr comment --body "@codex review"`

- If the user provided other reviewer usernames (e.g. `octocat`, `hubot`):
  - `gh pr edit --add-reviewer octocat,hubot`

- If you need to explicitly target a PR (instead of relying on the current branch), resolve the PR number/URL first and pass it to the commands above:
  - `gh pr view --json number,url -q .number`
  - `gh pr edit <number-or-url> --add-reviewer ...`
  - `gh pr comment <number-or-url> --body "@codex review"`

## Notes

- Keep the PR body concise but specific.
- If there are multiple major changes, list them as bullets under `## Major changes`.
- If tests are not configured, omit the entire `## Tests` section (do not include an empty heading).
- Avoid including raw `git diff --stat` output in `## Summary` (GitHub already provides file-level diff context).

---
> Converted and distributed by [TomeVault](https://tomevault.io/claim/saadjs) — claim your Tome and manage your conversions.
<!-- tomevault:4.0:skill_md:2026-04-14 -->

