/jig:pr-respondfrom jig
Processes PR review comments into fixes, replies, and resolved threads. Fetches comments, implements fixes, commits, pushes, replies, and resolves threads on GitHub.
Ships in jig. 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.
PURPOSE: Process reviewer feedback into fixes, replies, and resolved threads. Every unresolved PR comment thread should end this session resolved.
GIT HOST: Commands in this skill use GitHub (gh) as the default. If git-host in jig.config.md is not github, read framework/GIT_HOST.md for the platform-specific command equivalents.
Analyze. Fix. Commit. Push. Reply. Resolve. That's the job.
FETCH every comment source + thread IDs (on every PR in the stack)
|
ANALYZE each comment (valid fix? false positive? needs clarification?)
|
For unclear ones --> ASK the user (this should be rare)
|
IMPLEMENT code fixes for valid feedback
|
BUILD + TEST to verify nothing broke
|
COMMIT the fixes
|
PUSH to remote
|
REPLY to each comment on GitHub
|
RESOLVE every addressed thread
The pipeline is not optional. Do not stop after implementing fixes. Do not stop after committing. The job is not done until replies are posted and threads are resolved on GitHub. A comment without a reply and resolution is unfinished work.
Re-run once reviewers and bots have responded to a push. On a stack, sweep every PR in it, not just the one you pushed (see framework/STACKED_PRS.md).
Most comments have obvious solutions. Act on them directly:
| Comment Type | Action |
|---|---|
| Valid bug / missing guard | Fix it, reply with commit ref |
| Style / pattern suggestion | Fix it, reply confirming |
| False positive / intentional design | Reply explaining why, resolve |
| Question about approach | Reply with explanation, resolve |
| Genuinely ambiguous or risky | Ask user before acting (rare) |
Default to action. Only ask the user when the fix would be architecturally risky, when you genuinely do not understand the feedback, or when the commenter's suggestion conflicts with existing patterns.
GitHub CLI (gh) must be installed and authenticated. Verify with gh auth status.
Run these in parallel. You need REST comment IDs (for replying) and GraphQL thread IDs (for resolving).
Get PR info:
gh pr view --json number,url,title,body
Extract owner/repo from git remote get-url origin. Use in all gh api calls below. Read main-branch from jig.config.md (default: main).
Fetch PR comments (REST -- for replying):
gh api --paginate repos/{owner}/{repo}/pulls/{pr_number}/comments \
--jq '.[] | {id: .id, path: .path, line: .line, body: .body, user: .user.login, created_at: .created_at}'
Fetch unresolved thread IDs (GraphQL -- for resolving):
The REST API gives you comment IDs (for replying), but resolving threads requires GraphQL thread IDs. Fetch both. --paginate follows endCursor until hasNextPage is false, so threads past the first 100 are included. Owner and repo go in with -f (always a string); -F would turn a name like 2023 into a number. Only the PR number takes -F.
gh api graphql --paginate -f owner={owner} -f repo={repo} -F pr={pr_number} -f query='
query($owner: String!, $repo: String!, $pr: Int!, $endCursor: String) {
repository(owner: $owner, name: $repo) {
pullRequest(number: $pr) {
reviewThreads(first: 100, after: $endCursor) {
pageInfo { hasNextPage endCursor }
nodes {
id
isResolved
comments(first: 1) {
nodes {
databaseId
body
author { login }
}
}
}
}
}
}
}' --jq '.data.repository.pullRequest.reviewThreads.nodes[] | select(.isResolved == false) | {threadId: .id, commentId: .comments.nodes[0].databaseId, author: .comments.nodes[0].author.login, body: (.comments.nodes[0].body | split("\n")[0][:100])}'
Mapping threads to comments: The commentId from GraphQL matches the id from the REST comments endpoint. Use this to build a map of commentId -> threadId so you can resolve each thread after replying.
Fetch a single comment's full body:
The GraphQL query above truncates comment bodies to 100 chars. To get the full body of a specific comment:
# IMPORTANT: The path is /pulls/comments/{id} -- NOT /pulls/{pr_number}/comments/{id}
gh api repos/{owner}/{repo}/pulls/comments/{comment_id} \
--jq '{id: .id, path: .path, line: .line, body: .body, user: .user.login}'
The single-comment endpoint drops the PR number from the path. Using /pulls/{pr_number}/comments/{id} will return a 404.
Inline review threads are only one place feedback lands. Human reviewers often leave their main points in a review summary, which the thread query above does not return. Check all four sources: inline threads (the query above), plus:
# Review summaries (the body of an approve / comment / request-changes review)
gh api --paginate repos/{owner}/{repo}/pulls/{pr_number}/reviews \
--jq '.[] | select(.body != "") | {id, user: .user.login, state, submitted_at, url: .html_url, body}'
# Top-level PR comments (humans and bots)
gh api --paginate repos/{owner}/{repo}/issues/{pr_number}/comments \
--jq '.[] | {id, user: .user.login, created_at, url: .html_url, body}'
# Code scanning: GitHub's own check on the PR's head, one per tool or category,
# scoped to the code the PR changed
h=$(gh api repos/{owner}/{repo}/pulls/{pr_number} --jq .head.sha) &&
runs=$(gh api --paginate "repos/{owner}/{repo}/commits/$h/check-runs" --jq '.check_runs[]
| select(.app.slug == "github-advanced-security")
| "\(.id) \(.status) \(.conclusion) \(.output.annotations_count // 0) \(.name): \(.output.title)"') ||
runs=error
case $runs in
error) echo "code scanning: checks not readable: not checked" >&2 ;;
"") echo "code scanning: no check on this PR's head: not checked" >&2 ;;
*) printf '%s\n' "$runs" | while read -r id st conclusion count check; do
echo "$check"
if [ "$st" != completed ]; then echo " pending: not checked" >&2; continue; fi
# Annotations are the new alerts. Match each to its alert by location and rule
# (annotation title = alert rule.description for CodeQL and Semgrep; a tool where
# it differs prints unmatched, never handled) and print the alert's state
if [ "$count" -gt 0 ]; then
alerts=$(gh api --paginate "repos/{owner}/{repo}/code-scanning/alerts?pr={pr_number}" \
--jq '.[] | select(.state != "fixed") | "\(.most_recent_instance.location.path):\(.most_recent_instance.location.start_line)\t\(.rule.description)\t#\(.number) \(.rule.id) \(.state)"') &&
anns=$(gh api --paginate repos/{owner}/{repo}/check-runs/$id/annotations --jq '.[] | "\(.path):\(.start_line)\t\(.title)"') &&
while IFS=$'\t' read -r loc title; do
m=$(printf '%s\n' "$alerts" | L="$loc" T="$title" awk -F'\t' '$1 == ENVIRON["L"] && $2 == ENVIRON["T"] { print " " $3, $1 }')
echo "${m:- $loc ($title): no alert for this rule here: find it by rule and file}"
done <<< "$anns" ||
echo " alerts not readable: not checked" >&2
fi
case $check in
*"configuration not found"*) echo " incomplete: not checked" >&2 ;;
*) [ "$count" -gt 0 ] || [ "$conclusion" = success ] || echo " $conclusion: not checked" >&2 ;;
esac
done ;;
esac
success). Each prints as #<alert> <rule> <state> <path>:<line>, matched on location and rule: open is to fix or dismiss, dismissed is handled. An annotation with no alert for its rule at its location prints with its rule text; find its alert by rule and file before treating it as handled. A check titled "configuration not found" is incomplete even with annotations, and one that ends otherwise (neutral, failure) without annotations is not checked.not checked (no check on the head yet, one still running, code scanning not enabled, or the token lacks the scope) is not "no alerts". Say so, and re-run once the checks finish. Above the bottom of a stack the check may never run: check the PR below, and re-run after this PR retargets {main-branch}.url); who posted last proves nothing. Answer the unanswered ones (not the user's own) with one gh pr comment that quotes or links each point.framework/GIT_HOST.md, "Dismiss a code-scanning alert").On a stack, list its PRs and run the sweep for each. On GitHub, a PR in a native stack reports it; otherwise walk the bases (framework/STACKED_PRS.md, "Finding the Chain"):
# Runs in bash or zsh: no variable named `status` (read-only in zsh), and lists are split by line, not by word
fail() { echo "could not list PRs $1; stack sweep incomplete" >&2; }
if ! stack=$(gh api repos/{owner}/{repo}/pulls/{pr_number} --jq '.stack.number // empty'); then
fail "for #{pr_number}"
elif [ -n "$stack" ]; then
gh api repos/{owner}/{repo}/stacks/$stack --jq '.pull_requests[].number' || fail "in stack $stack"
else
echo {pr_number}; seen=" {pr_number} "
# Below: the open same-repo PR whose head is this PR's base, down to {main-branch}
base=$(gh pr view {pr_number} --json baseRefName --jq .baseRefName) || fail "below #{pr_number}"
while [ -n "$base" ] && [ "$base" != "{main-branch}" ]; do
pr=$(gh pr list --head "$base" --limit 1000 --json number,baseRefName,isCrossRepository \
--jq '[.[] | select(.isCrossRepository | not)][:1][] | "\(.number) \(.baseRefName)"') || { fail "below $base"; break; }
n=${pr% *}; base=${pr#* }
[ -n "$pr" ] && case $seen in *" $n "*) false;; esac || break
echo "$n"; seen="$seen$n "
done
# Above: open same-repo PRs whose base is this PR's head, until none is new. Never go up
# from a fork PR or a {main-branch} head, the start or any PR found ("Finding the Chain")
me=$(gh pr view {pr_number} --json headRefName,isCrossRepository --jq '"\(.isCrossRepository) \(.headRefName)"') || fail "above #{pr_number}"
heads=; [ "${me%% *}" = false ] && [ "${me#* }" != "{main-branch}" ] && heads=${me#* }
while [ -n "$heads" ]; do
found=$(while read -r h; do gh pr list --base "$h" --limit 1000 --json number,headRefName,isCrossRepository \
--jq '.[] | select(.isCrossRepository | not) | "\(.number) \(.headRefName)"' || fail "above $h"; done <<< "$heads")
heads=
while read -r n h; do
[ -n "$n" ] && case $seen in *" $n "*) false;; esac || continue
echo "$n"; seen="$seen$n "
[ "$h" = "{main-branch}" ] || heads=$(printf '%s\n%s' "$heads" "$h")
done <<< "$found"
heads=$(printf '%s\n' "$heads" | sed '/^$/d')
done
fi
A failed gh call prints stack sweep incomplete rather than ending the walk quietly. If you see it, the sweep is not done: say which PRs could not be listed.
Stop when, on every PR, each inline thread is resolved, each review summary and top-level comment that needs an answer is answered, and each alert the PR introduces is fixed or dismissed. Say so.
For each unresolved comment:
Team memory. If team memory is on (the memory skill), before you
answer "intentional design" or "false positive", Search for the decision
behind the questioned area. Treat a note like a bot's claim: verify it in
the source below, then answer from that source. The note itself stays in
the session, never in the reply.
| Bot | Typical Comments | Validation Approach |
|---|---|---|
cursor[bot] | Bug predictions, missing guards | ~50% false positive rate. Validate against actual code paths |
sentry[bot] | Security concerns, bug predictions | Deep dive required. Often valid |
github-actions[bot] | CI/CD status, test results | Check actual test failures |
dependabot[bot] | Dependency updates | Review changelog and breaking changes |
CRITICAL: Never trust a bot's factual claims. Always verify.
Bots make assertions about code structure ("this entity doesn't have field X", "this method returns Y") that are frequently wrong. Before accepting ANY bot claim as valid:
name column," READ the entity file and check.The cost of a false fix is higher than the cost of extra verification. A wrong "fix" introduces a real bug where none existed.
These patterns have burned maintainers. Recognize them so you don't skip the actual verification step.
1. Elaborate reasoning is NOT evidence.
Some reviewers (especially LLM-based ones) provide step-by-step proofs, "Extended reasoning" blocks, or multi-paragraph justifications. A confident, detailed argument for a factual claim still needs primary-source verification. Reasoning quality and correctness are not correlated — a wrong claim dressed in careful logic is more dangerous than a wrong claim stated flatly, because the elaboration lowers your skepticism instead of raising it.
<tool> --help and read the flag description yourself. Don't trust the reviewer's summary of what the flag does."ran 'gh api --help': -F = typed, -f = raw-field" is worth more than any amount of reasoning.2. Conflicting reviewers → verify, don't average.
When two reviewers give opposing factual claims (e.g., Bot A says "the correct flag is -F", Bot B says "the correct flag is -f"), the resolution is primary-source verification, not "pick the one with better reasoning" or "go with the majority." Treat a disagreement as a strong signal that verification is mandatory, not optional.
| Pattern | Example | Response |
|---|---|---|
| Style suggestion | "Use design tokens here" | Implement and confirm |
| Performance tip | "Consider memoizing this" | Implement and confirm |
| Question | "Is this intentional?" | Explain the reasoning |
| Bug report | "This will fail when..." | Fix and confirm |
For each valid fix:
Do both. Always. A local commit without a push means the reply will reference a commit the reviewer cannot see.
On a learning PR (framework/LEARNING_LOOP.md), run its Fit Review before the push.
# Commit the fixes (use commit agent)
# Then push immediately
git push
For EACH addressed comment, do both. This is the finish line -- do not skip it.
Reply to a comment:
gh api repos/{owner}/{repo}/pulls/{pr_number}/comments/{comment_id}/replies \
-X POST \
-f body='Your response message here'
Important:
-X POST to specify POST method-f body='...' for the response bodyResolve all addressed threads (AFTER replying):
for thread_id in PRRT_abc123 PRRT_def456 PRRT_ghi789; do
gh api graphql -f query="mutation { resolveReviewThread(input: {threadId: \"$thread_id\"}) { thread { isResolved } } }" --jq '.data.resolveReviewThread.thread.isResolved'
done
Rules:
isResolved: true can be skippeddecision note (the memory skill,
Saving): what and why, with the PR link. If you wrote this PR (its author
matches "Find the signed-in user" in framework/GIT_HOST.md), save it;
on anyone else's PR, or when that check fails, only suggest it. The why
must come from the user or the repo's spec, plan, commit or code comment,
never a team note or the reviewer's or a bot's wordsPost top-level PR comment (optional):
Use for summarizing multiple changes across many comments:
gh pr comment {pr_number} --body "### Summary of Changes
All feedback has been addressed:
- Updated design tokens
- Fixed the race condition
- Added error handling"
Fix it where it belongs, not on your current branch: switch to that PR's branch, run Steps 3-5 there, then carry the change up the chain by merging forward (framework/STACKED_PRS.md, "When a lower PR changes"). The commit and push on that branch, and the forward merges and pushes above it, change other PRs, so confirm them with the user first (rule 6 there).
Acknowledging a fix:
good call! updated to use the design token instead of the hardcoded value
Explaining a decision:
thanks for flagging! looked into this -- the inner join is actually intentional here. this method only returns records that have the associated data. records without it have nothing to display or match against.
Simple acknowledgment:
done!
With commit reference:
fixed in abc1234. added the null check as suggested.
Multi-point fix:
addressed both points:
- added guard for self-reference prevention
- wrapped empty state in droppable for drop zone coverage fixed in abc1234.
/pulls/comments/{id} NOT /pulls/{pr}/comments/{id} -- the PR number is NOT in the path for single-comment lookups/pulls/{pr}/comments/{id}/replies -- the PR number IS in the path for replies-X POST for repliesgh auth login
gh auth status
gh api rate_limitCalled by:
pr-create when reviewers provide feedbackRelated skills:
pr-create -- creates the PR that this skill responds toreview -- the automated review swarm (catches issues before humans do)postmortem -- analyzes PR feedback patterns for skill improvementpr-brief -- the reviewer's side: briefs someone reviewing another author's PRWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub duronext/jig --plugin jig26 skills in this plugin
/brainstormUse when exploring ideas, comparing approaches, or refining an unclear problem — at any point in the workflow. A discovery-time tool, not a pipeline stage. Invokable directly via /brainstorm or offered by kickoff during DISCOVER. Produces understanding, not artifacts.
/buildUse when you have an implementation plan and want to execute it. Analyzes the plan's task graph, determines the best execution strategy (parallel via team-dev or serial via sdd), and orchestrates the full build with quality gates. The single entry point for plan execution — you don't need to choose between team-dev and sdd yourself.
/debugUse when encountering any bug, test failure, or unexpected behavior, before proposing fixes. Enforces root cause investigation through four phases: investigation, pattern analysis, hypothesis testing, and implementation. Prevents guess-and-check thrashing.
/eng-copywritingUse when writing ANY user-facing text -- UI labels, button text, error messages, notifications, tooltips, placeholders, or application content./eng-loggingUse when implementing logging in application code. Covers log level selection, structured logging, error tracking integration, and avoiding noise./eng-testingUse when writing tests, designing test strategy, or reviewing test coverage. Covers test pyramid, naming, mocking, and flaky test policy.Other plugins' skills for the same job