skills/cmd-pr-gh-comments/SKILL.md
Holistically triage and resolve GitHub PR review comments — gather comments with full line ranges, study surrounding code context (TODOs, docstrings, related logic), hunt for adjacent improvements via rg, execute an approval-gated plan, optionally refine AGENTS.md style rules, and propose cmd-olshanskify template updates when feedback comes from @olshansk
npx skillsauth add olshansk/agent-skills cmd-pr-gh-commentsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Pull all review comments from the current branch's PR, study their surrounding context, hunt for adjacent improvements, build a holistic plan, align with the developer, then execute.
Verify the environment is ready.
Check authentication:
gh auth status
If not authenticated, stop and tell the user to run gh auth login.
Check current branch:
git branch --show-current
Confirm you are not on the default branch. If you are, stop and ask the user to check out their feature branch.
Get PR details:
gh pr view --json number,url,headRefName,baseRefName
If no PR exists for the current branch, stop and tell the user.
Get repo owner/name:
gh repo view --json nameWithOwner -q '.nameWithOwner'
Parse this into {owner} and {repo} for API calls below.
Fetch every comment type and capture the full location span for each one.
Inline review comments:
gh api repos/{owner}/{repo}/pulls/{pr_number}/comments --paginate
Review-level comments:
gh api repos/{owner}/{repo}/pulls/{pr_number}/reviews --paginate
General PR conversation comments:
gh api repos/{owner}/{repo}/issues/{pr_number}/comments --paginate
Get current user for filtering:
gh api user -q '.login'
For each inline comment, extract:
id, node_id, user.login, body, created_at, in_reply_to_idpathstart_line (nullable — present for multi-line comments)line (the end line of the comment anchor)original_start_line, original_line (fallbacks if the comment is outdated)start_side, side (LEFT = base, RIGHT = head)diff_hunkposition (null → comment is outdated)Normalize every comment into {file, start_line, end_line, side} — if start_line is null, use line for both. This span is the context window used in the next step.
Filter out:
user.type == "Bot")Note: Do NOT filter out comments authored by the current user. Users often leave self-review notes as action items.
Group inline review comments into threads by in_reply_to_id. The latest comment in a thread determines the thread's status.
If zero comments remain after filtering, report "No open PR comments to address" and stop.
For each comment, read beyond the exact line range so the plan accounts for nearby intent, not just the flagged snippet.
For each {file, start_line, end_line}:
TODO, TODO_*, FIXME, HACK, NOTE, XXX markersgit blame -L start,end <file> if the reviewer's concern might be historical)FooBar"), mark it as a lookup target for the next step.Record the gathered context as a compact note per comment — it feeds both the plan and the adjacent-improvement hunt.
Look outside the PR diff for related code that would benefit from the same fix, using rg (ripgrep) and any signals from the user or from step 4.
For each comment, especially those classified as systemic (naming, pattern, anti-pattern, missing validation, etc.):
Search for duplicates / siblings of the flagged pattern:
rg "<pattern or symbol from the comment>" -n --hidden
Search for related TODOs that would be closed by the same fix:
rg "TODO|FIXME|HACK" -n <relevant_dir>
Search for callers of the enclosing symbol to see whether a fix ripples:
rg "\b<symbol>\b" -n -t <language>
Ask the user when signal is ambiguous:
I see the reviewer flagged
<X>at<file>:<lines>. Before planning, is there a broader pattern you'd like me to sweep for (e.g. other call sites, similar abstractions, sibling modules)? Or any area you explicitly want me to leave alone?
Collect each finding as an adjacent improvement candidate tagged with the originating comment. These do not become mandatory fixes — they become proposals in the plan that the user can accept, defer, or reject.
Now classify every comment and merge in the adjacent improvements so the plan is one coherent pass, not a comment-by-comment checklist.
| Category | Description | Example |
|---|---|---|
| Fix | Clear, actionable code change requested | "This should use === not ==" |
| Investigate | Needs codebase exploration before deciding | "Is this duplicated anywhere else?" |
| Discuss | Design question, trade-off, or needs clarification | "Should we use strategy A or B here?" |
| Acknowledge | FYI or praise, no action needed | "Nice refactor" |
| Outdated | Comment on code that has already changed | position is null or diff hunk no longer matches |
Rules:
[adjacent] and marked opt-in.Present the plan to the user in this format:
## PR Comment Triage: {pr_url}
### Fix ({count})
- [ ] **{file}:{start_line}-{end_line}** — {summary of what to change}
> {abbreviated reviewer comment}
- Context: {enclosing symbol, TODO/NOTE hits, relevant docstring}
- [adjacent, opt-in] {related site at other_file:lines} — {why it may want the same fix}
### Investigate ({count})
- [ ] **{file}:{start_line}-{end_line}** — {what to explore and why}
> {abbreviated reviewer comment}
### Discuss ({count})
- [ ] **{file}:{start_line}-{end_line}** — {question or design decision}
> {abbreviated reviewer comment}
### Acknowledge ({count})
- {comment summary} — propose resolving, no action needed
### Outdated ({count})
- {comment summary} — code has changed, propose resolving
### Adjacent Improvements (opt-in)
- [ ] {file:lines} — {summary, tied back to originating comment}
Then ask:
Here is the holistic plan for this PR's comments plus adjacent improvements I noticed. Do you want to:
- Proceed as-is
- Reclassify any items (e.g. move a Fix to Discuss)
- Skip specific items or adjacent improvements
- Add anything I missed
Let me know before I start making changes.
Do not proceed until the user confirms.
Work through the approved plan in this order:
If an Investigate or Discuss item becomes clear during execution, reclassify it to Fix and proceed.
After all items are addressed, show a summary:
## Changes Made
| File | Lines | Category | Action Taken |
|------|-------|----------|--------------|
| ... | ...-... | Fix | Changed X to Y |
| ... | ...-... | Fix [adjacent] | Applied same fix at sibling site |
| ... | ...-... | Investigate | Found Z, no change needed |
| ... | ...-... | Discuss | User decided to defer |
Do not auto-resolve. Ask the user first.
I'm ready to resolve the following {N} GitHub comment threads:
- {short list grouped by category}
Thumbs up to resolve all, or tell me which ones to keep open.
If the user gives a thumbs up (or names a subset), resolve those threads. Otherwise skip this step.
For each thread to resolve, look up the thread ID from the comment's node_id:
gh api graphql -f query='
query($nodeId: ID!) {
node(id: $nodeId) {
... on PullRequestReviewComment {
pullRequestReviewThread: thread {
id
isResolved
}
}
}
}' -f nodeId="{comment_node_id}"
Then resolve:
gh api graphql -f query='
mutation($threadId: ID!) {
resolveReviewThread(input: {threadId: $threadId}) {
thread {
isResolved
}
}
}' -f threadId="{thread_id}"
After threads are resolved (or skipped), look across the comments you just addressed for recurring themes — style rules, naming conventions, review preferences, pattern prohibitions — that would belong in AGENTS.md so future PRs avoid the same feedback.
Ask the user:
Based on these comments, I noticed a few patterns that could become durable rules (e.g. {one-line examples}). Want me to look for opportunities to improve the style guidance in
AGENTS.md?
If yes:
AGENTS.md (repo root first, then ~/.claude/CLAUDE.md / ~/workspace/agent-skills/agents/AGENTS.md if the user wants a global rule).AGENTS.md without explicit confirmation.If no: skip this step.
Trigger condition: one or more of the addressed comments were authored by @olshansk (the user). Determine this from each comment's user.login field captured in step 3. If no @olshansk comments are in scope, skip this step entirely.
When the condition is met, re-read the @olshansk comments you just addressed and look for durable, style-level signal — phrasing preferences, banned patterns, required conventions, TODO tagging rules — that belongs in the canonical code style template at ~/workspace/agent-skills/skills/cmd-olshanskify/templates/code.md.
Ask the user:
{N} of the resolved comments came from
@olshansk. I spotted {K} that read like durable style rules (e.g. {one-line examples}). Want me to propose updates tocmd-olshanskify/templates/code.mdso future code dodges the same feedback?
If yes:
~/workspace/agent-skills/skills/cmd-olshanskify/templates/code.md end-to-end.templates/docs.md, templates/blog.md, or templates/presentation.md instead — or suggest a brand-new template if no existing one fits.If no: skip this step.
Report final status:
## Done
- {N} comments addressed ({K} adjacent improvements included)
- {M} threads resolved on GitHub ({skipped} kept open)
- AGENTS.md: {updated | proposed | skipped}
- cmd-olshanskify templates: {updated | proposed | skipped | n/a — no @olshansk comments}
- PR: {pr_url}
Do not commit or push automatically. The user commits manually — see the global rule in ~/.claude/CLAUDE.md under "Git Workflow Integration".
testing
Ask the agent whether it finished everything or has more to do — a lightweight completeness gate for the end of any task
development
Audit personal skills for redundancy, verbosity, weak triggers, and overlap. Runs a Claude→Codex review loop, presents per-item approval checkboxes, then applies approved edits and updates README and agent metadata. Use when asked to "review my skills", "audit my skills", "revisit my skills", or "clean up my skills". Accepts an optional skill name to scope the review to a single skill.
development
Set up or extend golden/snapshot tests for a project. Covers fixture design, Makefile targets, snapshot storage, diff workflow, and update protocol.
development
Proofread posts before publishing for spelling, grammar, repetition, logic, weak arguments, broken links, and optionally reformat for skimmability or shape the writing vibe toward a known author's style