Agent Skillsgetsentry/skills › pr-link-issue

pr-link-issue

GitHub

自动将 GitHub Issue 链接及对应的 Linear 工单添加到 PR 描述中。通过解析 Issue 评论获取 Linear 键值,智能追加或替换 PR 描述中的 Issues 区块,确保内容不重复且保留原有信息。

skills/pr-link-issue/SKILL.md getsentry/skills

Trigger Scenarios

用户要求将 issue 链接到 pr 提供 GitHub issue URL 并要求附加到当前 PR

Install

npx skills add getsentry/skills --skill pr-link-issue -g -y
More Options

Use without installing

npx skills use getsentry/skills@pr-link-issue

指定 Agent (Claude Code)

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

安装 repo 全部 skill

npx skills add getsentry/skills --all -g -y

预览 repo 内 skill

npx skills add getsentry/skills --list

SKILL.md

Frontmatter
{
    "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:

    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:

    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:

    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:

    #### Issues
    
    * Resolves: #<n>
    * Resolves: <linear-key>
    
  6. Update the PR with a heredoc to preserve newlines:

    gh pr edit <pr-number> --body "$(cat <<'EOF'
    <new body>
    EOF
    )"
    
  7. Confirm by echoing the resulting PR URL:

    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.

Version History

  • 9a85b59 Current 2026-07-24 21:13

Same Skill Collection

skills/agents-md/SKILL.md
skills/brand-guidelines/SKILL.md
skills/claude-settings-audit/SKILL.md
skills/code-review/SKILL.md
skills/code-simplifier/SKILL.md
skills/commit/SKILL.md
skills/create-branch/SKILL.md
skills/django-access-review/SKILL.md
skills/django-perf-review/SKILL.md
skills/doc-coauthoring/SKILL.md
skills/find-bugs/SKILL.md
skills/gh-review-requests/SKILL.md
skills/gha-security-review/SKILL.md
skills/iterate-pr/SKILL.md
skills/pr-writer/SKILL.md
skills/presentation-creator/SKILL.md
skills/prompt-optimizer/SKILL.md
skills/replay-ux-research/SKILL.md
skills/security-review/SKILL.md
skills/skill-scanner/SKILL.md
skills/skill-writer/SKILL.md
skills/sred-project-organizer/SKILL.md
skills/sred-work-summary/SKILL.md
skills/triage-frontend-issues/SKILL.md
skills/typing-exclusion-worker/SKILL.md
skills/blog-writing-guide/SKILL.md
skills/document-api-endpoint/SKILL.md

Metadata

Files
0
Version
24fdb83
Hash
ae3fff3e
Indexed
2026-07-24 21:13

Главная - Вики-сайт
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-20 10:19
浙ICP备14020137号-1 $Гость$