/kaoths-skills:fetch-pr-detailfrom kaoths-skills
Fetch a GitHub PR's metadata + file changes using a two-phase hybrid approach — triage filenames first (no patches), then fetch diffs only for files worth looking at. Use when asked to fetch, show, pull, or summarize a PR's changes. Do NOT trigger for "review this PR" / "find bugs in this PR" — that's a full analysis workflow, not a fetch.
Ships in kaoths-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.
None: SKILL.md is the whole skill.
Fetch a PR's metadata and file changes from the CLI, without pulling every patch upfront. Lockfiles, codegen, and trivial wiring changes are deferred or skipped so the reader sees only meaningful diffs.
/code-review plugin), not a plain fetch. This skill only
retrieves and triages content; it doesn't evaluate it.fetch-pr-review-comments).Resolve these before calling anything (ask if missing):
464), URL, or "latest"/"current branch's PR".summary — file list + stats onlyfull — every patch (only if the user explicitly wants everything)Detect owner and repo from the current git remote:
git remote get-url origin
If no PR number is given, get it from the current branch:
gh pr view --json number -q '.number'
<NUM> in every call below must be resolved to a concrete number first — unlike bare
gh pr view, the gh api repos/:owner/:repo/pulls/<NUM>/files calls in Phase 1b and
Phase 3 have no implicit "use current branch" fallback.
Resolve owner, repo, and <NUM> once, then reuse those literal values for every
later call — never re-run the resolution commands mid-run. A branch checkout or remote
change between calls would otherwise silently retarget a different PR.
Goal: PR metadata + per-file stats, no patches. Two calls, fire together:
gh pr view <NUM> --json number,title,state,author,baseRefName,headRefName,additions,deletions,changedFiles,body,createdAt,url
:owner/:repo resolved from local git remote.files/commits/reviews (they're noise here).gh api repos/:owner/:repo/pulls/<NUM>/files --paginate \
--jq '.[] | {filename, status, additions, deletions, changes}'
/pulls/{n}/files endpoint returns one patch per file by
default. Requesting all patches upfront reintroduces the lockfile/codegen noise we're
trying to avoid.--jq is gh's embedded JSON processor — no system jq needed, and no jq -s wrapper required since output is consumed as JSON lines.Rank each file into a signal tier:
| Tier | Meaning | Typical examples |
|---|---|---|
| 🔴 Critical | core logic / new feature | *.service.ts, *.ts with the real algorithm |
| 🟡 High | API contract, data layer | new DTOs, hooks, mappers, mappers, query hooks |
| 🟢 Medium | new container / non-trivial UI | new page/tab components |
| 🟢 Low | trivial wiring | controller route, enum edits, 1-line tweaks |
| ⚪ Skip | noise | lockfiles, codegen (*.gen.ts, swagger.json), 2-line imports |
pnpm-lock.yaml, package-lock.json, yarn.lock, poetry.lock, Cargo.lock*.gen.ts, generated/**, swagger.json, openapi.json (when gitignored or codegen)full)Fetch patches only for Critical + High (optionally Medium). Single paginated call, filtered client-side:
gh api repos/:owner/:repo/pulls/<NUM>/files --paginate \
--jq '.[]
| select(.filename | IN("path/to/file1.ts","path/to/file2.ts","path/to/file3.ts"))
| "\n===== \(.filename) =====\n\(.patch // "(binary or no patch)")\n"'
jq select().IN(...), not a suffix/regex match — Phase 1
already returned the exact filename for every candidate, so there's no reason to
match loosely. A suffix match (endswith(), or a |-joined test(...) regex) would
wrongly match unrelated files sharing a tail, e.g. src/foo.ts also matching
test/foo.ts or src/xfoo.ts.Read.Present to the user as:
| Endpoint / call | Why skipped |
|---|---|
/repos/.../pulls/{n} (root) | Redundant — gh pr view --json covers it. |
/repos/.../commits or per-commit diffs | PR-level diff already aggregates commits. |
/repos/.../compare/{base}...{head} | Same content as PR diff, different shape. |
| Review comments / CI status | Out of scope for "file changes" (separate skill: fetch-pr-review-comments). |
.patch is null; the // "(binary or no patch)" fallback keeps
output readable.--paginate still works, but warn the user and
consider fetching per-file via /contents or /compare if Phase 3 explodes.gh auth / repo context — gh pr view needs a local git remote pointing at
GitHub. If absent, fall back to gh api with explicit owner/repo.What SKILL.md sets; muted values are Claude Code's defaults
4 skills in this plugin
/fetch-pr-review-commentsHow to fetch PR review comments using gh api. Triggers when the user asks the agent to look at review comments on a specific PR (by number or by referencing "the PR"/"my PR"). Examples: "got comments on PR 123, which should we address", "check the review feedback on the PR", "triage the PR comments". Do NOT trigger when the user pastes a raw gh command — that's a manual action, not a request for the agent to fetch and analyze./reply-pr-review-commentsReply to PR review comments using gh api. User-invoke only — do not trigger automatically from conversational requests; only run when the user explicitly invokes this skill./request-pr-reviewersOther plugins' skills for the same job
npx claudepluginhub kaoths/agent-skills --plugin kaoths-skills