Skip to content
Development
Skill

/generate-pr

Generate a complete pull request when the user asks to create/open a PR, fill the PR template, or mentions "/generate-pr". Fills every section of .github/pull_request_template.md from the branch diff and commits, ticking only the boxes the evidence supports. Discovers the

From plugin
genesis
410 skills1 hook

Claude Code

$ npx -y skills add gabrieldabbah/genesis --skill generate-pr --agent claude-code

SKILL.md

generate-pr.SKILL.md
name: generate-pr
description: 'Generate a complete pull request when the user asks to create/open a PR, fill the PR template, or mentions "/generate-pr". Fills every section of .github/pull_request_template.md from the branch diff and commits, ticking only the boxes the evidence supports. Discovers the repository''s own branch flow rather than assuming one; aborts if a secret is in the diff; updates the open PR for the branch instead of opening a duplicate.'
license: MIT
allowed-tools: Bash, Read, Write
argument-hint: "[target branch]"

Generate a Pull Request

When this skill runs

**Only when the operator invokes it** — `/generate-pr`, or an explicit request to open or fill a PR in their own words. A pull request exists for one purpose: promoting the working branch to the branch that releases.

A PR is never opened on an agent's own initiative — not to trigger CI, not to summarise a branch, not because the work looks finished. Reading PR state to answer a question (`gh pr list`) is ordinary; creating one is not. Pushing to the working branch is a separate act under its own rule (the `git-commit` skill) and never implies a PR.

Overview

Produce a fully-filled pull request — every applicable section of `.github/pull_request_template.md`, every checkbox the **evidence** supports — and open or update the PR.

Portability

Every command here is POSIX shell and runs on macOS, Linux, WSL2 and Git Bash — no GNU-only flags, so BSD userland on macOS behaves identically. On native Windows without [Git for Windows](https://git-scm.com/downloads/win), Claude Code runs commands through PowerShell, which cannot execute them; translate them or install Git for Windows.

`git` is required. `gh` is optional — without it, or unauthenticated, the skill writes the finished body to `out/pr-body.md` and prints the command to run, which is also how you test it without opening a real PR. `jq` is optional and every use below has a fallback, because neither macOS nor Windows ships it.

Branch policy — read it, do not assume it

Repositories differ: trunk-based, a long-lived integration branch, short-lived feature branches, Git Flow. Establish this repository's flow before opening anything, from what the repository actually says:

git rev-parse --abbrev-ref HEAD                                  # where you are
git branch -a --format='%(refname:short)'                        # what exists
git symbolic-ref --short refs/remotes/origin/HEAD 2>/dev/null    # the remote's default branch
grep -rniE 'branch|pull request' CLAUDE.md CONTRIBUTING.md .github/*.md 2>/dev/null | head

The target defaults to the remote's default branch, and `$1` overrides it. If the current branch **is** the target, there is nothing to promote — stop and say so. Where the repository documents a flow, follow it; where it documents none and the branch is an ordinary working branch, the default branch is the target. Creating a branch is outside this skill.

**Deterministic facts versus written prose.** You are the one writing; there is no separate model call. The split is:

  • **Deterministic ("what is true"):** what changed, which type/area boxes to tick, which refs actually

appear, whether a secret leaked. Gathered from `git`/`gh` — never guessed.

  • **Voice (you):** the Summary, the Changes bullets, the verification narrative — prose grounded *only*

in the deterministic facts.

**Never invent.** A reference, statistic, ticket id, or sign-off that is not in the diff/commits does not go in the PR. Under-filling a box is recoverable; a fabricated claim is not. When a fact has no evidence, write `n/a`.

Arguments & modes

  • `$1` (optional) — target branch. Defaults to the remote's default branch, resolved below.
  • `DRY_RUN=1` (env) — emit the body to `out/pr-body.md` and print the `gh` command instead of touching

GitHub. Also the automatic fallback when `gh` is missing/unauthenticated. This is how you **test** the skill without spamming real PRs.

---

Step 0 — Preconditions (deterministic)

CURRENT=$(git rev-parse --abbrev-ref HEAD)

# Target: the argument, else the remote's default branch, else main.
DEFAULT=$(git symbolic-ref --short refs/remotes/origin/HEAD 2>/dev/null | sed 's|^origin/||')
[ -n "$DEFAULT" ] || DEFAULT=main
TARGET_BRANCH="${1:-$DEFAULT}"

[ "$CURRENT" = "$TARGET_BRANCH" ] && {
  echo "On $CURRENT, which is the target — there is nothing here to promote."; exit 1; }

# Resolve the COMPARISON ref. Prefer the remote-tracking branch — see below for why.
# A repo with no remote is purely local, so the local branch is the only truth available.
if git remote get-url origin >/dev/null 2>&1; then
  git fetch origin --quiet
  TARGET="origin/$TARGET_BRANCH"
else
  TARGET="$TARGET_BRANCH"
fi

# The target must exist.
git rev-parse --verify --quiet "$TARGET" >/dev/null || {
  echo "No '$TARGET' here — branches: $(git branch -a --format='%(refname:short)' | tr '\n' ' ')"
  echo "Create it, or pass the intended target as the argument."
  exit 1
}

**Compare against `origin/<target>`, never the local branch.** Nothing advances a local target branch you never check out — `git pull` on the working branch moves the remote-tracking ref `origin/<target>` and leaves the local branch wherever it was last checked out. Diffing against it produces a PR body describing commits that are already on the target, and the mistake is invisible because the numbers look plausible. Local default-branch refs are routinely dozens of commits behind their remotes while the deployed branch is perfectly current. The same trap in the other direction is the deploy-consequence rule: **a git ref is not a deployment** — `origin/<target>` is what a connected host builds from; the local branch is a bookmark this clone happens to hold.

# Inputs (three-dot: changes on HEAD since it diverged from TARGET).
git diff --stat "$TARGET...HEAD"
git diff --name-only "$TARGET...HEAD"
git log "$TARGET..HEAD" --format='%s%n%b
Read more
@gabrieldabbah
Ships withgenesis

Ultimate Opus 5 builder. Genesis creates and transforms any setup into the ultimate setup for generation 5 models. Genesis turns an empty folder into a working SaaS, web app, API, or CLI, running autonomously on your machine in Claude Code.

Stars on GitHub

Momentum

stars in total
4
Star history of gabrieldabbah/genesis on GitHub, a chart by star-history.com

Other skills on genesis.

axiomatic-induction

axiomatic-induction

The project constitution AND the reasoning method. Apply it in ALL planning and execution of non-trivial work: reason like a…

genesis

genesis

Build a new project from an empty folder, or bring an existing repository up to standard. Use when the user says \"/genesis\",…

git-commit

git-commit

Stage, write a Conventional Commits message from the actual diff, commit, and push. Use when the user asks to commit, save work…

parallel-work

parallel-work

Rules for working in a repository where other Claude sessions are editing at the same time — no git writes, no process kills,…

repo-hardening

repo-hardening

Set a repository up so it cannot merge broken code and cannot quietly rot: continuous integration, automated dependency updates,…

security-audit

security-audit

Audit a surface for security problems, score them honestly, and turn each into a task with a fix. Use before declaring work done,…

More skills from other plugins.

brainstorming
Auto-invoked

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…

@obra@obraInstall Skill
ask-matt

ask-matt

Ask which skill or flow fits your situation. A router over the skills in this repo.

skills2w309k
@mattpocock@mattpocockInstall Skill
accessibility
Auto-invoked

accessibility

Design, implement, and audit accessible UI to WCAG 2.2 Level AA across Web, iOS, and Android — semantic ARIA roles and labels,…

ecc2w293k
@affaan-m@affaan-mInstall Skill
compiler-commit

compiler-commit

Use when you want to verify compiler changes and commit with the correct convention. Runs tests, lint, and format, then commits…

react5d252k
@facebook@facebookInstall Skill

Questions about generate-pr.

Which coding agents can use generate-pr?
generate-pr installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.