Append a GitHub issue link and its Linear ticket to the current PR's description. Use when asked to "link issue to pr", "fill in issue and linear in pr", "add issue refs to pr", or when given a GitHub issue URL and asked to attach it to the current PR. Resolves the Linear ticket automatically from the issue's linear-linkback comment.
Written by Sentry and published in getsentry/skills under the Apache-2.0 license. Treq shows it unchanged except for heading levels and links to files on GitHub.
Appends a Sentry-style #### Issues block to a PR description, referencing both the GitHub issue and the Linear ticket pulled from the issue's linear-linkback comment.
<issue-url> — GitHub issue URL like https://github.com/<owner>/<repo>/issues/<n>. Issue number alone is fine if the PR is in the same repo.<pr-number> — defaults to the open PR for the current branch.Resolve the PR number — skip if user supplied one:
gh pr view --json number,body -q '.number'
If no PR exists on the branch, stop and tell the user.
Extract issue number + repo from the input URL, or accept a bare #1234 for current repo.
Fetch the Linear ticket from the issue's linear-linkback comment:
gh issue view <n> --repo <owner>/<repo> --json comments \
-q '.comments[] | select(.author.login=="linear-code") | .body' \
| grep -Eioe '[a-z]+-[0-9]+' | head -1
If no match, fall back to asking the user for the Linear key, or omit it.
Read the existing PR body so you can append rather than overwrite:
gh pr view <pr-number> --json body -q '.body'
Construct the new body. If the body is empty, use just the #### Issues block. Otherwise, append it after a blank line. Don't duplicate — if #### Issues is already present, replace that section instead of adding a second one.
Format:
#### Issues
* Resolves: #<n>
* Resolves: <linear-key>
Update the PR with a heredoc to preserve newlines:
gh pr edit <pr-number> --body "$(cat <<'EOF'
<new body>
EOF
)"
Confirm by echoing the resulting PR URL:
gh pr view <pr-number> --json url -q '.url'
linear-code. The body contains a markdown link whose text is the Linear key, e.g. PY-2357.PY-… for sentry-python, JS-… for sentry-javascript, etc.) — the regex [a-z]+-[0-9]+ covers them.Claude Code and Codex keep each installed skill's name and description in context. When a request matches the description, the agent loads the full SKILL.md. You can also run it yourself: type /pr-link-issue in Claude Code or $pr-link-issue in Codex.
The description says when to use it:
Use when asked to "link issue to pr", "fill in issue and linear in pr", "add issue refs to pr", or when given a GitHub issue URL and asked to attach it to the current PR.
Copy the pr-link-issue folder into .claude/skills/ in your project. To use it in every project, copy it into ~/.claude/skills/ instead.
git clone --depth 1 https://github.com/getsentry/skills.git /tmp/getsentry-skills
mkdir -p .claude/skills
cp -r /tmp/getsentry-skills/skills/pr-link-issue .claude/skills/
Codex reads skills from .agents/skills/ in your repository, and from ~/.agents/skills/ for every repository. It detects new skills on its own. Restart Codex if pr-link-issue does not appear.
git clone --depth 1 https://github.com/getsentry/skills.git /tmp/getsentry-skills
mkdir -p .agents/skills
cp -r /tmp/getsentry-skills/skills/pr-link-issue .agents/skills/
Open Settings and select the Skills tab. The tab appears when Skills installation is on under Settings → Feature Preview. Search for pr-link-issue and choose Install….
Install for repository writes the skill under .treq/skills/ in the current repository. Install for application makes it available to every repository on this machine. Each new workspace gets a copy in .claude/skills/ and .agents/skills/, so Claude Code and Codex both find it. See Installing Skills from the Library.
pr-link-issue ships one file, SKILL.md, shown above.