/hal-skills:pr [create | update | merge [PR number or URL]] [part-of <issue>]from HAL Skills
Pushes the current branch, opens a PR, rewrites an open PR's title/body from its commits, or waits for CI and merges it. Handles create, update, and merge modes.
Ships in HAL Skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Invoking this skill IS the request. Your task is fully specified here. Never ask what to do.
Run every command bare, exactly as written below: git and gh find the repository from any subdirectory, and a cd does not carry over to the next Bash call in this fork. A cd ... && or $() prefix stops a command matching allowed-tools, and the merge then hits the permission gate.
So the shell has to start inside the repository. When a command fails with not a git repository, stop and report that the skill has to be invoked from inside the repository, or for merge mode with the PR's URL, which gh accepts from any directory. A path in the arguments does not change this.
The user invoked this skill with: "$ARGUMENTS"
Mode comes from the arguments first: create means create mode, update means update mode, merge means merge mode. With none of those three words, including an empty argument, run gh pr view --json state --jq .state 2>/dev/null and let its result decide: a non-zero exit (no PR for this branch) means create mode, OPEN means update mode, any other state means report that state and stop. Merge mode only ever comes from the argument.
Create mode and update mode run these steps where they say "gather PR material":
git log --format='%n%s' --name-only main..HEAD (fall back to master..HEAD). Each commit is a block: its subject, then the files it touched. A flat log next to a branch-wide diff stat lets the writer guess which commit touched which file.
The PR describes the net change of the branch. A commit whose subject starts with Revert " and the commit it names cancel each other when both sit in the log, as does a later commit that restores what an earlier one removed, and a subject starting with build: bump describes no change. Remove those blocks from the log before passing it on.
git branch --show-current, then git log --format=%B main..HEAD (same fallback). Collect the issues the branch fixes from the branch name and the commit messages:
#N, or an issue URL. One in another repository is owner/repo#N.ENG-123, or a URL that contains one. Branch names carry the key in lowercase, as in fix/eng-123-login-timeout; write it in uppercase.Skip an issue a commit cites only as related or earlier work. Each remaining issue becomes a Fix [<issue>](<issue URL>) line at the end of the body, one per line, no duplicates, such as Fix [ENG-123](https://linear.app/acme/issue/ENG-123/login-timeout). Use an issue URL the branch name or commits carry. Otherwise build a GitHub one from the repository URL gh repo view --json url --jq .url prints: https://github.com/acme/app gives Fix [#12](https://github.com/acme/app/issues/12) and Fix [octo-org/octo-repo#100](https://github.com/octo-org/octo-repo/issues/100). A tracker key with no URL, common when only the branch name carries it, borrows one from an earlier PR body: for ENG-123, run gh pr list --state all --limit 100 --json body --jq '[.[].body | scan("https://[^)\\s]*/ENG-[0-9]+")] | first' with the key's own prefix in place of ENG, and swap the key in the URL it prints, so https://linear.app/acme/issue/ENG-98 gives Fix [ENG-123](https://linear.app/acme/issue/ENG-123). If it prints nothing, the key stays bare: Fix ENG-123. GitHub and Linear close the issue on merge only when a closing word such as Fix comes before it; a non-closing word such as Refs just links it. So an issue the arguments mark as partly done, as in part-of ENG-123, gets Part of in place of Fix, whether or not the branch names it.
Invoke the write-like-me skill. Pass as argument: "Write a GitHub PR title and body from the material below. Shape the draft as the title on the first line, a blank line, then the body, and nothing else: the caller splits on the first line, so a label or heading would land in the title. The draft goes straight into the caller's next gh command in the same response, never into a reply: a reply with no tool call ends the caller before that command runs.
Title: one plain-English line under 72 chars that names the change itself, with no fix: or feat: type prefix. GitHub shows titles as plain text, so write file names bare, without backticks. Body: GitHub renders it as markdown, so wrap every file path, command, flag, and identifier in backticks, at every occurrence. Leave out changes a reviewer would not miss, such as ignore files, asset moves, and personal config tweaks, unless the branch holds nothing else. Body shape depends on how many separate changes are left.
One change: 1-3 sentences of prose, what changed and why, no list.
Add pr skill for pushing branches and opening PRsAdds a pr skill that pushes the current branch, drafts a PR title and body with write-like-me, and opens the PR with gh. Wires it into the plugin manifest and marketplace so it ships with hal-skills.
Two or more changes: one - item per change, each item 1-3 short sentences stating the change and one before/after example when the change has a visible input and output. Give every item its example, not only the first.
name-suffix from AI spacing into the core rules.http:// or https:// is hidden from the rules, so %E4%B8%AD and /wiki/CJK#CJK survive./ next to CJK never gets spaces anymore. CJK/CJK stays CJK/CJK, same as _. File paths still work: CJK/homeCJK becomes CJK /home CJK.
" followed by the log from step 2, then a closing "" line.
Fix and Part of lines from step 3 to the body.Create, update, and merge mode run these steps where they say "push the branch", so a branch the remote already has is never pushed again:
git rev-parse HEAD, then git rev-parse @{u}, each alone in its Bash call.git rev-parse @{u} fails because the branch has no upstream, run git push -u origin HEAD alone in its Bash call. Abort if it fails.git rev-parse --abbrev-ref HEAD — abort if main or master.gh pr view --json url 2>/dev/null — if a PR already exists, report its URL and stop.gh pr create --title "<title>" --body "<body>".gh pr view --json url,state 2>/dev/null — abort if no PR or not open.gh pr edit --title "<title>" --body "<body>".The arguments may name the PR by number or URL, as in merge 173 or merge https://github.com/acme/app/pull/173. The shell then need not be on the PR's branch, so three things change: put the number or URL right after the subcommand in every gh pr command below (gh pr view 173 ..., gh pr checks 173 ..., gh pr merge 173 ...), skip step 2, and in step 3 run only the gh pr view command and keep the commit it prints.
gh pr view --json url,number,state,headRefName — abort if no PR or not open.git rev-parse HEAD, then gh pr view --json headRefOid --jq .headRefOid. If they differ, GitHub has not seen the push yet and gh pr checks would report the old head's runs: run sleep 15 alone in its Bash call and compare once more, then abort if they still differ.gh pr checks --watch — blocks until all checks complete. Use a 10-minute Bash timeout. If step 2 pushed and it reports no checks yet, the push just queued them: run sleep 15 alone in its Bash call, then run it again once. If the call times out instead, the checks are still running: run it again with the same timeout, and after a third timeout report the checks still pending and stop.gh pr checks --json name,bucket,link --jq '.[] | select(.bucket != "pass" and .bucket != "skipping")'. Its output, not the watch's exit code, decides the merge: gh pr checks exits 0 even when a check was cancelled, and a cancelled check never ran.gh pr merge --merge --delete-branch. When the arguments named the PR, add --match-head-commit with the commit from step 3: no local HEAD was compared there, and the flag makes GitHub refuse the merge if the PR's head moved after the checks were read.git rev-parse --verify --quiet refs/heads/<headRefName from step 1>, alone in its Bash call. gh deletes the local branch and removes its worktree only where the checkout allows, and it reports a finished cleanup only on a terminal, so its silence here proves nothing.gh pr merge printed a skipping local delete warning, quote it and the To finish cleanup command under it word for word.not a git repository: the shell is outside the repository, so a local branch or worktree of the PR, if one exists, is still there.What SKILL.md sets; muted values are Claude Code's defaults
sonnethighThree short reads, in order
13 skills in this plugin
/audit-agent-settingsUse when auditing Claude Code or Codex settings and env vars against the latest docs to suggest tailored changes/best-practicesUse when about to choose, configure, or refine a tool, library, config format, API pattern, or project setup, or before proposing a design or fix of your own — research current guidance, pitfalls, and prior art for the problem it solves first; already knowing an approach, or assuming no prior art exists, is not an exemption. Also use when the user asks about best practices, gotchas, or recommended patterns/blindspotUse when the user asks for a blindspot pass or to find their unknown unknowns, or signals unfamiliarity with a domain, tool, or codebase area ("never used X", "first time doing Y", "no idea where to start", "don't know what I don't know") before working there. Maps the areas their request leaves unnamed, purpose and shape before mechanics, shows how people usually answer each and why, and asks which to explore next, so unknown unknowns become known unknowns they can prompt with. Recommendations on a tool already chosen belong to best-practicesnpx claudepluginhub vinta/hal-9000 --plugin hal-skillsOther plugins' skills for the same job