How this skill is triggered — by the user, by Claude, or both
Slash command
/utils:pr-check-reviewsThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
pr:check-reviews
pr:check-reviews
/pr:check-reviews [PR number (optional - uses current branch if omitted)]
This command automates the process of addressing PR review comments by fetching all comments from a pull request, categorizing them by priority (blocking, change requests, questions, suggestions), and systematically addressing each one. It intelligently filters out outdated comments, bot-generated content, and oversized responses to optimize context usage. The command handles code changes, posts replies to reviewers, and maintains a clean git history by amending relevant commits rather than creating unnecessary new ones.
gh pr list --head <current-branch>gh pr checkout <PR_NUMBER> if not already on the branch, then git pullgit status. If uncommitted changes exist, ask user how to proceedFetch PR metadata with selective filtering:
a. First pass - Get metadata only (IDs, authors, lengths, URLs):
# Get issue comments (general PR comments - main conversation)
gh pr view <PR_NUMBER> --json comments --jq '.comments | map({
id,
author: .author.login,
length: (.body | length),
url,
createdAt,
type: "issue_comment"
})'
# Get reviews (need REST API for numeric IDs)
gh api repos/{owner}/{repo}/pulls/<PR_NUMBER>/reviews --jq 'map({
id,
author: .user.login,
length: (.body | length),
state,
submitted_at,
type: "review"
})'
# Get review comments (inline code comments)
gh api repos/{owner}/{repo}/pulls/<PR_NUMBER>/comments --jq 'map({
id,
author: .user.login,
length: (.body | length),
path,
line,
created_at,
type: "review_comment"
})'
b. Apply filtering logic (DO NOT fetch full body yet):
line == null (outdated review comments)length > 5000author in ["openshift-ci-robot", "openshift-ci"] (keep coderabbitai for code review insights)c. Second pass - Fetch ONLY essential fields for kept items:
# For issue comments - fetch only body and minimal metadata:
gh api repos/{owner}/{repo}/issues/comments/<comment_id> --jq '{id, body, user: .user.login, created_at, url}'
# For reviews - fetch only body and state:
gh api repos/{owner}/{repo}/pulls/<PR_NUMBER>/reviews/<review_id> --jq '{id, body, user: .user.login, state, submitted_at}'
# For review comments - fetch only body and code context:
gh api repos/{owner}/{repo}/pulls/comments/<comment_id> --jq '{id, body, user: .user.login, path, position, diff_hunk, created_at}'
Note: Using --jq to select only needed fields minimizes context usage. Avoid fetching full API responses with all metadata.
d. Log filtering results:
ℹ️ Fetched N/M comments (filtered out K large/bot comments saving ~X chars)
Fetch commit messages: gh pr view <PR_NUMBER> --json commits -q '.commits[] | "\(.messageHeadline)\n\n\(.messageBody)"'
Store ONLY the kept (filtered) comments for analysis
Note: Most filtering already happened in Step 1 to save context window space.
Additional filtering (for remaining fetched comments):
Categorize:
Group by context: Group by file, then by proximity (within 10 lines)
Prioritize: BLOCKING → CHANGE_REQUEST → QUESTION → SUGGESTION
Present summary: Show counts by category and file groupings, ask user to confirm
When multiple comments relate to the same concern/fix:
Done. (Also addresses feedback from @user)a. Validate: Thoroughly analyze if the change is valid and fixes an issue or improves code. Don't be afraid to reject the change if it doesn't make sense.
b. If requested change is valid:
Plan and implement changes
Commit and Push (ALL sub-steps are MANDATORY — do not skip any)
Review changes: git diff
Sync with remote first: git pull --rebase origin <branch> to ensure local branch is up to date. If the branch is behind or diverged, you MUST rebase before committing.
Analyze commit structure: git log --oneline origin/main..HEAD
Commit strategy:
DEFAULT: Amend the relevant commit
git rebase -i origin/main to amend the specific relevant commitCreate commit AND push (both required):
git commit --amend --no-edit && git push --force-with-lease (or update message if scope changed)git pushVerify push succeeded (MANDATORY before replying):
git log -1 --format='%H' locally and git ls-remote origin <branch> to confirm the remote has your commitgit status): The commit failed. Fix it first.Concise Reply template: Done. [1-line what changed]. [Optional 1-line why]
Post reply:
gh api repos/{owner}/{repo}/pulls/<PR_NUMBER>/comments/<comment_id>/replies -f body="<reply>"
If fails: gh pr comment <PR_NUMBER> --body="@<author> <reply>"
c. If declining change:
d. If unsure: Ask user for clarification
Replies must NOT include any AI attribution footer.
Show user:
Before posting ANY reply, verify you haven't already responded:
CHECK_REPLIED="${CLAUDE_PLUGIN_ROOT}/scripts/check_replied.py"
if [ ! -f "$CHECK_REPLIED" ]; then
CHECK_REPLIED=$(find ~/.claude/plugins -type f -path "*/utils/scripts/check_replied.py" 2>/dev/null | sort | head -1)
fi
if [ -z "$CHECK_REPLIED" ] || [ ! -f "$CHECK_REPLIED" ]; then echo "ERROR: check_replied.py not found" >&2; exit 2; fi
python3 "$CHECK_REPLIED" <owner> <repo> <pr_number> <comment_id> --type <type>
Where <type> is one of: issue_comment, review_thread, or review_comment
If the script returns exit code 1: Skip that comment - you've already replied. If the script returns exit code 2: The check failed - do NOT post a reply. Investigate and fix the issue before proceeding.
One response per feedback: For each piece of feedback, choose ONE response mechanism:
Code changes require explicit request: Only modify code when the reviewer explicitly asks using imperative language like "change", "fix", "remove", "update", "add". For questions, clarifications, or observations - reply with explanation only, do not change code.
Check before acting: If a comment is phrased as a question ("Why did you...?", "What about...?"), provide an explanation. Only make code changes for direct requests ("Please change...", "This should be...", "Remove this...").
npx claudepluginhub wangke19/my-claude-skills --plugin utilsGuides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.