AGENT SKILL

pr-link-issue

Idempotently ensure a GitHub PR body closes every issue in its own issue set (appends the `Closes

License 许可
GPL-3.0
最近更新
2026-11-14
Stars
★ 0
Forks
0

01 前言 Front Matter

name
pr-link-issue
description
Idempotently ensure a GitHub PR body closes every issue in its own issue set (appends the `Closes

03 SKILL.md 正文

PR Link Issue

Ensure a GitHub pull request's body links to and closes each issue it resolves, by verifying — and, if needed, appending — a closing keyword immediately followed by that issue reference in the PR body, once per issue.

Per GitHub's "Linking a pull request to an issue" docs, a closing keyword immediately followed by an issue reference in the PR description does two things at once: it creates the Development-sidebar "linked pull request" and auto-closes the linked issue when the PR merges into the default branch. A keyword in a commit message auto-closes but does not create the sidebar link, which is why this skill writes the PR body, never a commit. Both effects are intended: the sidebar link is the whole point, and auto-close-on-merge is the behavior we want.

Each issue needs its own keyword, so this skill writes one Closes #<issue> line per issue rather than one line listing several. The bundled script reads the body back for the lines it already carries before writing, through gp_closing_issues — the parse the pr-closing-issues script shares — so it appends only what is missing and is idempotent on its own.

Invocation

/pr-link-issue <PR> <issue-number>…
  • <PR> (required): the pull request, in any form skills/lib/pr-reference.md lists.
  • <issue-number>… (required): one or more issue numbers the PR resolves — members of the branch's own issue set only, each as N or #N, space-separated. See "Own issue set only" below.

Own issue set only

Every issue this skill writes a closing keyword for MUST be a member of the branch's own issue set — never an umbrella, parent, predecessor, or otherwise "related" issue. Aiming a closing keyword at another issue would auto-close that issue when this PR merges, which is what the closing-keyword rule — PR body only, the branch's own issue set only — exists to prevent.

That rule also settles what happens when the caller's numbers and the branch name disagree, and applying it is not this skill's job: /git-tools:git-issues-from-branch is the one skill that applies it.

This skill's part is small. Its claim is the caller-supplied numbers — a caller of /pr-link-issue always has the issues in hand, so there is nothing to look up. It hands that claim to /git-tools:git-issues-from-branch alongside the PR's head branch, and acts on what comes back. It never parses a branch name and never re-derives the resolution. This skill reads no config of its own.

Execution

  1. Resolve the set of issues to ensure. Fetch the PR's head branch:

    /github-prs:pr-view <PR> --json headRefName --jq .headRefName
    

    Invoke /git-tools:git-issues-from-branch <headRefName> <issue-number>… — the head branch first, the caller-supplied numbers after it as the claim.

    • A resolved set is the set to ensure. Call it <issues>.
    • No safe resolution — leave the body untouched. Report that outcome with both sets exactly as the skill named them, and stop; the caller re-invokes with numbers drawn from the branch's set.

    Note the "claimed outside the branch set" numbers it reports: those never get a closing line, and the refusal is named in the report-back.

  2. Ensure the lines with the bundled script, spelled as a bare name, passing every member of <issues>:

    pr-link-issue <PR> <issueA> <issueB>
    

    The script reads the body and the issues it already closes. Members already closed are left alone; for the rest it keeps the existing body verbatim, appends one Closes #<issue> line per issue after a blank line, writes the body back, and re-reads it. When every member is already closed it writes nothing and prints PR <PR> already closes <issues>. Every issue it is given that the body does not close gets a line, so never pass an issue outside the branch's set, and never write the keyword into a commit message.

    Exit Meaning
    0 the body closes every issue given; stdout names the ones already closed and the lines appended
    1 a command the script ran failed, such as a gh call; its own error is on stderr above the script's line
    2 a usage error; the body is untouched
    3 the re-read body is not the body written; stderr says so

    On any non-zero exit, surface stderr verbatim in the report-back.

  3. Report back a single line: which members were already linked and which had a Closes #<issue> line appended, as the script's stdout names them, naming <PR>, plus any caller-supplied number step 1 reported as sitting outside the branch's set. If step 1 gave no safe resolution, the body is unchanged — report that outcome instead, with both sets.

04 同仓库更多 Skills

TheVoskamps
TheVoskamps/claude-plugins-marketplace

mask-inappropriate-language

Replace inappropriate language (profanity, slurs, strong insults) in provided text or a file with asterisks, character-for-character, preserving everything else.

★ 0
TheVoskamps
TheVoskamps/claude-plugins-marketplace

theorem-agents-interface

The interface between the sdlc reviewer and the theorem agents it spawns — what each double-dash brief parameter means, and what each consequence class means. Preloaded into every theorem agent (sdlc:theorem-generator, the disprover, and the verifier) via its skills frontmatter, and read by name by the sdlc:theorem-based-pr-reviewer agent for what its briefs' parameters mean; not invoked from the user's slash menu.

★ 0
TheVoskamps
TheVoskamps/claude-plugins-marketplace

sdlc-config-user

Interactively create or merge-update the repo user sdlc config, `<repo-root>/.sdlc/user-config.yml` (tier 3 — this user, this repo, never committed), and add it to the repo's tracked `.gitignore`.

★ 0
TheVoskamps
TheVoskamps/claude-plugins-marketplace

sdlc-config-repo

Interactively create or merge-update the shared repo sdlc config, `<repo-root>/.sdlc/repo-config.yml` (tier 2 — tracked, every user of this repo).

★ 0
TheVoskamps
TheVoskamps/claude-plugins-marketplace

sdlc-config-global

Interactively create or merge-update the global user sdlc config, `$XDG_CONFIG_HOME/sdlc/user-config.yml` (tier 1 — this user, every repo on this machine).

★ 0
TheVoskamps
TheVoskamps/claude-plugins-marketplace

pr-read-cli-interface

The contract for sdlc's PR-read CLIs — sdlc-pr-round, sdlc-pr-adjustments, sdlc-fixer-brief and sdlc-records-chain — their arguments, exit codes and output grammar. Preloaded into sdlc:theorem-based-pr-reviewer, sdlc:issue-fixer, sdlc:docs-writer and sdlc:pr-finalizer via their skills frontmatter; not invoked from the user's slash menu.

★ 0