github-pull-request
Github Pull Request
Path Resolution (avoid missing-skill errors)
- Always open this skill using the absolute path from the active session skills list (for example
~/.codex/skills/github-pull-request/SKILL.md). - Do not try repo-relative
.codex/skills/...or.agents/skills/...paths unless the session explicitly lists that exact path. - If you hit a missing-skill error from an old path, re-open this skill from the active session skills list and continue (do not retry repo paths).
Workflow
- Confirm branch and scope
- Run
git branch --show-current. - If branch looks wrong for the requested work, ask for correction.
- Run
- Gather change context
- Run
git status -sb. - Run
git diff --stat origin/$(git rev-parse --abbrev-ref @{upstream}..HEAD)when upstream exists. - If no upstream exists, use
git diff --statandgit diffagainst the likely target branch.
- Run
- Decide PR title
- Follow
type(scope): short imperative summaryformat. - Keep title under 72 chars where possible.
- Follow
- Build PR body from required sections:
- Summary
- Why this change
- What changed (bullets grouped by feature/file area)
- Files changed
- QA / testing (exact commands + outcomes)
- Risk and impact
- Rollback plan
- Related issues
- Checklist
- Identify related issue(s)
- Parse issue number from branch if present (examples:
123,issue-123,fix/123-...). - Add
Fixes #<issue>orCloses #<issue>in the PR body when confirmed.
- Parse issue number from branch if present (examples:
- Push branch if needed
- If branch has no upstream, run
git push -u origin <branch>.
- If branch has no upstream, run
- Pre-create guards (avoid
gh pr createhard failures)- Check whether an open PR already exists for this branch:
gh pr list --head <branch> --state open --json number,url- If one exists, stop and report the existing PR link instead of creating a duplicate.
- Check commit delta against intended base branch before create:
git rev-list --count <base>..HEAD- If count is
0, stop and report "no commits to open PR against<base>" with next action:- verify current repo/branch, or
- push the intended commits, or
- switch to the correct branch.
- Check whether an open PR already exists for this branch:
- Create PR
- If user requested draft, pass
--draft. - Write the PR body to a temp file and use
--body-fileto avoid shell quoting/interpolation bugs with Markdown/backticks. - Preferred pattern:
BODY_FILE=$(mktemp)cat > "$BODY_FILE" <<'EOF'...EOFgh pr create --title "<title>" --body-file "$BODY_FILE"rm -f "$BODY_FILE"
- If
ghauth is unavailable or user is not in GitHub environment, output the prepared title and body text for manual submission.
- If user requested draft, pass
- Report back
- Include PR link if created, target branch, and review expectations.
- Ask explicitly what should be prioritized in review.
PR body template
## Summary
- ...
## Why
- ...
## What changed
- ...
## Files changed
- ...
## QA / Testing
- Command: `...` — Result: ...
- Command: `...` — Result: ...
## Risks and impacts
- ...
## Rollback plan
- ...
## Related issues
- Fixes #123 (optional)
## Checklist
- [ ] Tests pass
- [ ] No obvious regressions
- [ ] Documentation updated where needed
- [ ] Rollback path documented
Hard rules
- Never submit a PR without a QA/testing section.
- Never claim tests passed without listing exact commands and outputs.
- Do not include secrets, credentials, or internal URLs in the PR description.
- Ask before adding reviewers/labels if not already provided.
- Never merge a PR automatically; only merge when the user explicitly instructs it.
Optional metadata enrichment with gh
- Use
gh pr createandgh pr viewfor consistency checks. - If labels are requested, add after creation:
gh pr edit <number> --add-label <label>
- If reviewers are requested:
gh pr edit <number> --add-reviewer <users>
More from mindgames/skills
github-sync
Sync a local Git repository with its remote safely. Use when Codex needs to update a repo before starting work, fast-forward a local branch from `origin`, confirm that local `main` or another branch matches the remote, or prepare an up-to-date base branch before creating a new branch.
3branch
Use when a user asks to create a new local git branch and start issue work (for example, "create branch" or "start working on issue XYZ"). Use this for issue-based branch naming in the `type/scope-short-description` pattern and for always syncing local `main` from `origin/main` before creating the new branch, creating the local tracking `main` branch first when needed.
1gh-pr-audit
Perform a full local audit of one or more GitHub PRs, run repository-native deterministic checks, apply result labels, and post a structured review comment. Use when a PR in this repo or under projects/* needs a deep, evidence-based review across any language or stack.
1gh-fix-ci
Use when a user asks to debug or fix failing GitHub PR checks that run in GitHub Actions; use `gh` to inspect checks and logs, summarize failure context, draft a fix plan, and implement only after explicit approval. Treat external providers (for example Buildkite) as out of scope and report only the details URL.
1github-issue
Create complete, implementation-ready GitHub issues from user input and publish them with `gh issue create`. Use when asked to create/file/open a new issue in any repository, including cases where requirements must be structured into clear scope, acceptance criteria, constraints, and done-when outcomes.
1gh-address-comments
Help address review/issue comments on the open GitHub PR for the current branch using gh CLI; verify gh auth first and prompt the user to authenticate if not logged in.
1