Skip to main content
skill CX Codex

pr-link-issue — Claude Code skill: link an issue to a PR

Adds a GitHub issue and its linked Linear ticket to the current PR description. Use it when a pull request needs references to the work it addresses.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add getsentry/skills --skill pr-link-issue -a claude-code
Open on GitHub

What pr-link-issue does

The skill finds the open PR for the current branch unless you provide a PR number, then adds an #### Issues section with the GitHub issue and its Linear ticket. Give it an issue URL, or just an issue number when the PR belongs to the same repository.

It looks for the Linear key in an issue comment by linear-code. Before editing, it reads the existing PR description and preserves its contents; an existing #### Issues section is replaced rather than duplicated. If the comment has no matching ticket, the skill can ask you for the key or proceed with only the GitHub reference. It stops when there is no open PR on the branch, so supply a PR number if the target is elsewhere.

What it helps with

  • add a GitHub issue reference to a PR description
  • find the Linear ticket linked from an issue comment
  • replace an existing #### Issues section without overwriting other PR text
  • connect an issue to a PR using its URL or number

Example prompts for the agent

  • Add the issue from this GitHub URL and its linked Linear ticket to the current PR.
  • Link issue #1234 to the open PR on this branch.
  • Update the #### Issues section on PR 42 using this GitHub issue.

How to install pr-link-issue

1Skills CLI (Vercel)

npx skills add getsentry/skills --skill pr-link-issue -a claude-code

2Manually: put the files in place

~/.claude/skills/pr-link-issue/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/pr-link-issue/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about pr-link-issue

How do I install pr-link-issue in Claude Code?

Run npx skills add getsentry/skills --skill pr-link-issue -a claude-code. The skill file is installed at ~/.claude/skills/pr-link-issue/SKILL.md.

What does pr-link-issue do?

It adds a GitHub issue and its associated Linear ticket to a PR description. The skill reads the existing description first and keeps its other content intact.

What if the issue has no Linear ticket comment?

The skill can ask you for the Linear key or continue with the GitHub issue reference alone.

Source text

SKILL.md · Apache-2.0
---
name: pr-link-issue
description: 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.
---

# Link a GitHub Issue + Linear Ticket on a PR

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.

## Inputs

- `<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.
- (optional) `<pr-number>` — defaults to the open PR for the current branch.

## Steps

1. **Resolve the PR number** — skip if user supplied one:

   ```bash
   gh pr view --json number,body -q '.number'
   ```

   If no PR exists on the branch, stop and tell the user.

2. Extract issue number + repo from the input URL, or accept a bare `#1234` for current repo.

3. Fetch the Linear ticket from the issue's linear-linkback comment:

   ```bash
   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.

4. Read the existing PR body so you can append rather than overwrite:

   ```bash
   gh pr view <pr-number> --json body -q '.body'
   ```

5. 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:

   ```markdown
   #### Issues

   * Resolves: #<n>
   * Resolves: <linear-key>
   ```

6. Update the PR with a heredoc to preserve newlines:

   ```bash
   gh pr edit <pr-number> --body "$(cat <<'EOF'
   <new body>
   EOF
   )"
   ```

7. Confirm by echoing the resulting PR URL:

   ```bash
   gh pr view <pr-number> --json url -q '.url'
   ```

## Notes

- Linear linkback comments are posted by the GitHub user `linear-code`. The body contains a markdown link whose text is the Linear key, e.g. `PY-2357`.
- Project keys vary per repo (`PY-…` for sentry-python, `JS-…` for sentry-javascript, etc.) — the regex `[a-z]+-[0-9]+` covers them.
- Don't strip existing PR content. Always read first, append/replace second.
- If the issue doesn't have a Linear linkback yet (newly filed), proceed with just the GitHub issue reference and tell the user the Linear key is missing.

© getsentry · Apache-2.0 · getsentry/skills

Similar skills

All skills for Git and GitHub →

From the same set23

brand-guidelines Applies Sentry brand and copy guidelines to user-facing text, error states, and UI flows. Useful when writing UI labels, empty states, or docs. CX Codex +1 2,500installs skill-writer Designs, synthesizes, and refines agent skills following the Agent Skills specification. Helpful when turning raw workflows or prompt templates into structured skills. CX Codex +1 2,500installs prompt-optimizer A skill that rewrites system and agent prompts against a set of eval cases instead of gut feeling. Useful when a prompt exists but behaves inconsistently. CX Codex +1 2,300installs sred-project-organizer Organizes annual engineering projects into SRED-compliant documentation and creates structured Notion pages. CX Codex +1 2,100installs sred-work-summary Collects GitHub PRs, Notion pages, and Linear issues from a work period, then groups their links into projects in a private Notion document. Useful for preparing an SRED work summary. CX Codex +1 2,100installs typing-exclusion-worker Removes Python modules from mypy exclusion lists in pyproject.toml, fixes typing errors, and runs scoped validation. Built for parallel typing debt workers. CX Codex +1 1,600installs triage-frontend-issues A skill that clears noise from the sentry/javascript issue queue in Sentry and leaves real bugs for a human. CX Codex +1 1,300installs document-api-endpoint Documents and types Sentry API routes using drf-spectacular. It resolves type drift between declared OpenAPI schemas and live endpoint responses. CX Codex +1 1,200installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor