agentsclimarketplace

Gh pr

Skill weicheng95/skills-hub/skills/gh-pr

Use this skill when the user wants to create or modify a GitHub pull request. Three triggers: (1) Create a PR — "open/raise/file/submit a PR or MR", "PR this", "ship it", "put this up for review", "get this in front of the team", "branch is done", or any phrasing treating review as the next step. Often bundled with extras: push the branch first, target a non-default base like develop, or operate in a named worktree or repo — all still this skill. (2) Refresh a PR's body — the user opened a PR earlier and the scope, code, or description has drifted; they want the description rewritten, refreshed, or corrected to match the current diff. (3) Edit PR metadata — "add a reviewer", "label it", "rename the PR", "mark it ready for review", "convert it to a draft", "retarget the base to develop". Not for merging, approving, or reviewing someone else's PR, responding to review comments, filing issues, committing, rebasing, or just summarizing a branch.From its SKILL.md

Install
npx -y skills add weicheng95/skills-hub --skill gh-pr

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

2 things to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
  • 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

13.4 KB, as published. Nobody here has run it

GitHub pull requests: create, refresh, edit

Route by what the user asked for: creating a PR or rewriting its description follows the full flow below; metadata-only edits (reviewers, labels, title, draft state, base) skip to Metadata edits — no diff reading needed unless the base is changing.

Create a pull request

Turn the commits already on this branch into a PR whose description a reviewer can trust: it says what the code does now, and nothing it can't back up.

You are not committing anything here. The commits exist; your job is to read them honestly, describe them plainly, and open the PR once the user approves the text.

The one rule that matters

Every line of the body must be traceable to the diff or to a command you actually ran in this session.

Everything below is downstream of that. A PR body is read by someone deciding whether to trust the change — a confident sentence about behavior you never verified costs them more than saying nothing would have. If you can't source it, cut it.

Preflight

Run these together and read all four before doing anything else:

git status --porcelain
git rev-parse --abbrev-ref HEAD
gh repo view --json defaultBranchRef -q .defaultBranchRef.name
gh pr view --json url,state -q '.url + " " + .state' 2>/dev/null

Each result gates the run:

ResultWhat to do
git status non-emptyDon't push or create. Never git add/git commit on your own — committing for them silently puts work in a PR they never chose to include. But don't stop dead either: read the committed diff and draft the PR anyway, then show the draft and the uncommitted files together and ask how to handle them (ignore / stash / commit). The uncommitted work usually isn't meant for this PR, so the draft is usually still right — showing it turns two round trips into one. Say which option you'd pick and why.
Branch is the default branchStop. Say so and offer to move the commits onto a feature branch.
gh pr view returned a URLA PR already exists. Say so, print it, and ask: update its body, or leave it. Don't open a second one.
gh errors on authTell the user to run gh auth login themselves via ! gh auth login.

If the branch has no upstream, that's expected and fine — you push with -u later.

Read the change

The base is the default branch from preflight. Use three dots so you see this branch's work and not everything that landed on main meanwhile:

git log --oneline <base>..HEAD
git diff <base>...HEAD --stat
git diff <base>...HEAD

Read the full diff, not just the stat. The stat tells you which files moved; only the diff tells you what the change does, and the body is about what it does.

If the diff is huge, read the stat first to find the load-bearing files, read those in full, and skim the rest (lockfiles, generated output, mass renames). Say in the body that a bulk change was mechanical if it was — that's a fact about the diff and it saves the reviewer real time.

While reading, separate two things that feel similar and aren't:

  • What the code does now — the Summary. Present tense, from the reader's perspective.
  • What changed to get there — the Changes list. Per file or area.

Conversation history is context, not content. If you spent an hour on an approach that got thrown away, the PR doesn't mention it. The reviewer is reading the diff that exists.

Read it adversarially

Describing a diff and understanding it are different jobs, and only the second one is useful to a reviewer. Before you write anything, spend a moment trying to break the change:

  • What input worked before and behaves differently now? Reach for the awkward ones — empty, unterminated, nested, the delimiter appearing inside the data it delimits.
  • Does a narrow fix change a wider contract? A parser taught about quoted fields now treats a stray quote in an unquoted field differently too. That's a regression the commit message won't mention, because the author didn't notice it either.
  • What did the commits not touch that they probably should have — callers, migrations, a sibling code path with the same bug?

Trace one or two concrete inputs through the new code by hand. If a claim is cheap to check, check it: node -e, a REPL, whatever's fast.

Finding nothing is a fine outcome — most diffs are clean, and this costs a minute. But when you do find something, it goes in ## Risks, and it's usually the most valuable line in the PR. This is the part a reviewer can't easily do for themselves: you already have the whole diff in your head, and they don't.

Write the body

Three sections every time, plus a fourth only when the diff earns it:

## Summary
<1-3 sentences: what the code does now and why it's here>

## Changes
- <file or area>: <what changed>

## Testing
- <command> — <result>

## Risks          <- only when you found something under "Read it adversarially"
- <the behavior that changed, and the input that exposes it>

Summary. What the branch delivers, in present tense. Skip "This PR..." — the reader knows. One to three sentences; if you need more, the PR is probably too big and you can say so.

Changes. One bullet per file or coherent area, biggest first. Group trivia (docs, deps, formatting) into a single line rather than listing ten one-line bullets. The reviewer is using this to decide reading order, so lead with what carries risk.

Testing. Only commands you actually ran, with their real outcome — including failures. If you ran nothing, write exactly:

## Testing
- Not run.

Two words beat a fabricated green checkmark, and they're honest about where the reviewer needs to look. Do not run the test suite just to fill this section in; the user scoped this skill to push-and-PR, so if they wanted a gate run they'd have asked. If a gate looks worth running, offer it — don't just do it.

If a piped command produced the result, be careful: cmd | tail reports tail's exit code, not cmd's. Don't record a pass you inferred from a pipeline.

Risks. Omit the section entirely when the diff is clean — a ## Risks header followed by "None" is noise, and if you write one every time it stops meaning anything. Include it when the previous step turned up a real behavior change, and lead with the input that exposes it:

## Risks
- A bare `"` in an *unquoted* field now toggles quote mode and swallows the
  delimiter: `5" pipe,3` parses as one field where it used to parse as two.
  Rows carrying inch marks lose a column.

That is the single highest-value thing in the body when it's true. It's what the reviewer would have had to find themselves, and it's the difference between a description and a review.

Keep it to behavior: what breaks, for whom, on what input. "Only the happy path has a test" and "this could be tidier" are review comments, not risks — they're cheap to write, they're what everyone already suspects, and every one you add makes the real finding above it easier to skim past. Two sharp bullets beat five padded ones. If nothing in the section would change how the reviewer reads the diff, drop the section.

Title

Imperative mood, ≤72 characters, no trailing period — same shape as a good commit subject. Add plate lookup to SSR entrypoint, not Added... or This PR adds.... If the repo's existing PR titles follow a convention (feat(auth): ...), match it — check with gh pr list --limit 10 --json title -q '.[].title' when you're unsure.

Language

Plain and factual. A bug fix is a bug fix.

Ban list — these words make a PR read like marketing, and reviewers discount everything around them: critical, crucial, essential, significant, comprehensive, robust, elegant, seamless, powerful.

Don'tDo
Comprehensive refactor of the auth layer for robust error handlingMove token refresh into AuthClient and return a typed error instead of throwing
This critical fix resolves a significant issueFix the null deref when session is absent
Various improvements to the parserHandle escaped quotes in parseRow; drop the unused strict flag

The test: could a reviewer look at the diff and disagree with your sentence? If yes, it's a fact — good. If your sentence is unfalsifiable praise, delete it.

Show the draft, then wait

Print the title and full body in your message and ask for approval — something like "Open it, or want changes?" Opening a PR is outward-facing and notifies reviewers; a wrong body is public and gets read before you fix it. That's why the user asked for this gate.

Wait for an actual answer. Silence isn't approval, and "looks good" about a code change isn't approval to open the PR. On requested edits, show the revision and ask again.

Push and create

Only after approval. Push first — gh pr create needs the branch to exist on the remote:

git push -u origin HEAD

If the push is rejected as non-fast-forward, stop and report it. The remote has commits you don't have; force-pushing is a decision the user makes, not you.

Write the body to a file rather than passing it inline. Bodies contain backticks, $, and newlines that a shell will happily mangle or execute:

cat > "$SCRATCHPAD/pr-body.md" <<'EOF'
<body here>
EOF

gh pr create --base <base> --title "<title>" --body-file "$SCRATCHPAD/pr-body.md"

The quoted <<'EOF' heredoc matters — unquoted, the shell expands $ and backticks inside your body.

Add --draft only if the user asked for a draft.

Then give them the URL on its own line. That's the whole handoff — they clicked approve, the PR is up, here's where it lives.

Refreshing an existing PR's body

When preflight found a PR and the user wants the description refreshed, the flow is the same as creating — read, draft, approve — with three differences that matter:

  1. Diff against the PR's actual base, not the default branch. They can differ, and diffing the wrong base describes the wrong change:

    gh pr view --json baseRefName -q .baseRefName
    
  2. Read the existing body before overwriting it (gh pr view --json body -q .body). Preserve anything the user hand-wrote that isn't derivable from the diff — issue links (Closes #123), screenshots, deploy notes, instructions to reviewers. That information exists only in the old body; rebuilding from the diff alone silently deletes it.

  3. Rebuild the generated sections from scratch — Summary, Changes, Testing, Risks all come from the current diff, exactly as above. Don't patch the old prose; it describes an older diff, and stale sentences that survive an edit read as true.

Show the new body and get approval first, same as a new PR, then:

gh pr edit --body-file "$SCRATCHPAD/pr-body.md"

Metadata edits

Title, labels, reviewers, draft state, and base branch are all gh pr edit / gh pr ready one-liners. The commands are trivial; the judgment is knowing which are safe to just run and which need a look first.

Run immediately, no approval gate: title tweaks the user dictated, adding or removing labels that exist, converting ready→draft (it reduces noise for everyone). Cheap, reversible, pings nobody.

Check first:

Labels and reviewers must exist

gh pr edit --add-label on a label that doesn't exist just errors. Check gh label list and match the repo's casing. For reviewers: if the user named the person, add them. If you're choosing, propose candidates from CODEOWNERS or from who recently reviewed this area — never invent a username, and don't add anyone unprompted; a review request is a notification in someone's inbox.

draft → ready notifies reviewers

gh pr ready tells everyone subscribed that the PR is ready for their time. Run gh pr checks first. If CI is red or still running, say so and ask whether to proceed — marking ready at a broken build asks reviewers to read code that's about to change.

Base retarget silently redefines the diff

gh pr edit --base <new> changes what the PR is: reviewers now see a diff against a different branch, and if this branch wasn't cut from the new base, the PR picks up commits that aren't the user's. Before retargeting, compare what the PR contains under each base:

git log --oneline origin/<current-base>..HEAD | wc -l
git log --oneline origin/<new-base>..HEAD | wc -l

If the counts differ, show which commits would enter or leave the PR and retarget only after the user confirms with that in front of them. If they match, say so and proceed.

Keep looking

Skills are one crate of 607,533. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.