Pr update

From OutThisLife/brooklyn-skills · View interactive version

Pr update is an AI agent skill from the GitHub repository OutThisLife/brooklyn-skills. Open a PR/MR if missing, or refresh an existing one's title and description so they match the current diff. Preserves any media already in the body. Use when the user says /pr-update, open a PR, update the PR, refresh the PR title/description, or wants the PR opener/manager flow.

How to use this skill

Skill file

PR Update (open or refresh)

One skill for create and update. Make the title + body match the branch

as it is now. Do not strip media from an existing description.

Steps

  1. git status / git diff / git log / git diff <default>...HEAD (and

remote tracking) so you know the full change set — not just the latest

commit.

  1. Detect an existing PR/MR for this branch (gh pr view / glab mr view).
  1. Draft a title and body from all commits/files in the PR, not one commit.
  2. If updating: fetch the current body first. Preserve every media item

exactly (see below). Then rewrite text so Summary / Test plan (or the

repo's usual sections) stay accurate.

  1. Apply with gh pr create / gh pr edit (or glab equivalents).
  2. End with the PR/MR as a markdown link — the number and the full forge

URL ([#123](https://github.com/org/repo/pull/123), GitLab ! equivalent).

Never a bare #123. This is the one place the rule is written down; the

other skills just follow it.

Title + body

## Summary
<1-3 bullets of what changed and why>

## Test plan
- [ ] <concrete checks>

Commits

Shape the branch's commits as part of opening/refreshing the PR.

does not set commit attribution. If email is unset or Git infers a local-host

address, stop before publishing and confirm an account-associated email.

Never publish after ignoring Git's inferred-identity warning.

not asked; don't dump everything into one blob unless the user wants it.

No "WIP" / "fix stuff".

TTY). Show the final git log --oneline <default>..HEAD before force-push.

Two traps in that recipe:

never to origin/<default> itself — it moves mid-task and will stage other

people's commits as yours.

git commit silently captures its pre-edit version. Verify the content

landed (git show <sha>:<path> | grep <new symbol>) before force-push.

especially during pr-triage salvage.

commits already on the default branch without asking.

Preserve media (hard rule)

When a PR/MR already has a body, never delete media.

Treat as media (keep verbatim, same URLs/markup/order when possible):

media)

Update flow:

  1. Read the existing body. Extract JSON descriptions to plain Markdown with jq -r '.description' before using line-oriented file tools; one long escaped JSON string can be truncated even when the overall file fits. Reject truncated content rather than rebuilding a partial description.
  2. Extract and keep the media blocks.
  3. Rewrite textual sections so they match the current diff.
  4. Re-attach the preserved media (same block(s), typically at the end unless

they were interleaved on purpose — then keep interleaving).

  1. Before submit, diff old body vs new: every media URL/markup from the old

body must still be present.

If a refresh would drop media, stop and keep the old body (or only edit the

title) rather than publishing a media-stripped description.

Scope

description, preserve media, print URL.

(pr-triage), merging.

Forge cheatsheet

# GitHub — read
gh pr view --json url,title,body,baseRefName,headRefName

# GitHub — create
gh pr create --title "…" --body "$(cat <<'EOF'
…
EOF
)"

# GitHub — update (body from file avoids shell-eating newlines/media)
gh pr view --json body -q .body > /tmp/pr-body.md
# …edit /tmp/pr-body.md carefully…
gh pr edit --title "…" --body-file /tmp/pr-body.md

# GitLab
glab mr view
glab mr create
glab mr update <N> --title "…" --description-file /tmp/pr-body.md
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.