gh-update-pr
Update PR via REST API
gh pr edit is broken due to GitHub deprecating Projects Classic (projectCards GraphQL field error). Use the REST API instead. gh pr view and gh pr create still work fine — only gh pr edit is affected.
Rules
- Never use
gh pr editto update PR title or body. It will fail with a GraphQL error. - Use
gh apiwith the REST endpoint. Always pipe JSON viajq --argto avoid shell injection:jq -n --arg title "..." --arg body "..." '{title: $title, body: $body}' | \ gh api repos/{owner}/{repo}/pulls/{number} -X PATCH --input - --jq '.html_url' - Get the current PR context before updating:
gh pr view --json number,url,baseRefName - Omit unchanged fields. If only updating the title, do not include
bodyin the JSON payload, and vice versa. Including an unchanged field risks overwriting it with stale content.
Verification procedure
- After the PATCH request, confirm it returned the PR's
html_url(not an error). - Run
gh pr view --json title,bodyand verify the updated fields match what was intended.
Common mistakes to watch for
- Including both title and body when only one changed. This can overwrite the other field with stale or empty content. Only include the field being updated.
- Running outside a git repo with a tracking branch.
gh pr viewneeds repo context. If it fails, pass--repo owner/repoexplicitly. - Forgetting to extract owner/repo/number. Always fetch these from
gh pr viewfirst — do not hardcode or assume them.
More from lwlee2608/agent-skills
gh-create-pr
Use when creating/raising/opening/submitting a GitHub PR. Produces short, feature-focused descriptions without a test plan.
26ascii-diagram
Use after generating or editing ASCII art, box diagrams, tables, or any monospace text art to ensure all lines, corners, and boxes are properly aligned.
24prefer-make
Use before running any Go toolchain command (`go build`, `go test`, `go run`, `go vet`, `go fmt`, `golangci-lint`). Substitutes make targets when a Makefile is present.
24create-skill
Use when creating a new agent skill. Ensures the skill follows quality guidelines for SKILL.md files.
19linear
Use when the user wants to interact with Linear.app — reading or searching issues/tickets.
15writing-system-prompts
Use when writing or editing a system prompt for any LLM API or SDK (any code passing a `system=` / `system` role parameter, or a `.txt`/`.md` file holding such a prompt). Applies prompt-engineering and prompt-caching best practices.
4