skills/mine-address-pr-issues/SKILL.md
Use when the user says: "address PR comments", "fix review feedback", "fix failing CI", or "resolve merge conflicts". Triages and resolves PR blockers on GitHub or Azure DevOps.
npx skillsauth add NodeJSmith/Claudefiles mine-address-pr-issuesInstall 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.
Triage and resolve everything blocking a PR from merging: unresolved review comments, merge conflicts, and failing CI checks. Works on both GitHub and Azure DevOps — detects the platform automatically.
/mine-address-pr-issues [PR#]
If no PR number is given, auto-detect from the current branch.
git-platform
Output is github, ado, or unknown. If unknown, tell the user the platform could not be detected from the git remote and stop.
GitHub:
gh pr view {PR} --json number,title,url,baseRefName,headRefName,mergeable,mergeStateStatus,statusCheckRollup,isDraft,reviewDecision
If mergeable is UNKNOWN, retry up to 3 times with backoff (3s, 6s, 12s) — GitHub computes mergeability asynchronously. If still UNKNOWN after retries, warn the user and continue.
ADO:
ado-api pr show {PR} --json
Returns pullRequestId, title, status, sourceRefName, targetRefName, repository.webUrl. URL: repository.webUrl + "/pullrequest/" + pullRequestId. Note: mergeStatus is optional and only present after a merge attempt.
CRITICAL: gh pr view --json does NOT return review threads (inline comments from reviewers or Copilot). You MUST run the fetching command below. Do not conclude "no review comments" based on PR metadata alone — that field doesn't exist in the metadata response.
GitHub:
gh-pr-threads {PR} --json --all
Returns a JSON object with three surfaces — all three need triage:
.threads — inline review threads (resolvable). Each has id (PRRT_…), isResolved, isOutdated, path, line, startLine, diffSide, and comments (with databaseId, body, author.login, author.__typename)..reviewComments — review-summary bodies carrying findings that are not inline threads. CodeRabbit posts substantial findings here ("Outside diff range comments", "Duplicate comments", "Nitpick comments") when it can't anchor to the diff. Not resolvable — no PRRT_ id; reply with a normal PR comment. Each has author, state, url, body..issueComments — PR conversation comments (human comments, bot chat replies). Machine-generated status noise (walkthroughs, build reports) is already filtered out. Not resolvable. Each has author, databaseId, url, body.Do NOT skip .reviewComments — it is the surface most often missed, and CodeRabbit routinely puts Major findings there.
ADO:
ado-api pr threads {PR} --json --all
Returns all threads as JSON. Threads with threadContext are inline comments; threads without are general conversation. ADO has no isOutdated concept. ADO carries general comments in the same thread list, so it has no separate .reviewComments/.issueComments split.
GitHub: From statusCheckRollup in metadata. Filter for conclusion in FAILURE, TIMED_OUT, ACTION_REQUIRED.
ADO:
az repos pr policy list --id {PR_ID} -o json
Filter for status in rejected, broken.
Check and display as informational warnings (NOT blockers):
Categorize all issues into three groups: review comments, merge conflicts, CI failures.
Prerequisite: This section requires the gh-pr-threads / ado-api pr threads output from Phase 1. If you skipped that step, go back and run it now before triaging.
Exclude resolved threads: GitHub isResolved: true, ADO status != "active".
Triage outdated threads (GitHub only): For each thread with isOutdated: true:
Do NOT blanket-exclude outdated threads. Do NOT confidently dismiss concerns without citing evidence.
General comment assessment: For non-inline comments, determine if actionable vs. discussion/approval/acknowledgment. Include only actionable, unaddressed comments.
Already-addressed detection: For each unresolved thread, read the current code at the referenced location and compare against what the reviewer requested. If already present, categorize as "already addressed."
For each issue, assign a depth based on the comment's nature:
| Comment type | Depth | Description |
|---|---|---|
| Rename, docstring, formatting, typo | light | Skip call-site investigation |
| Logic change, bug fix, error handling | medium | Read call sites, understand usage |
| Architectural concern, design pattern, API contract | deep | Read all callers, tests, adjacent modules |
Group related comments for efficient execution — e.g., all error-handling comments together, all comments on a single feature together.
GitHub: mergeable == "CONFLICTING" or mergeStateStatus == "DIRTY"
ADO: mergeStatus == "conflicts" (if present)
Fetch failure logs and categorize: test failures, lint/type errors, build errors, other.
GitHub: gh run view <run-id> --log-failed
ADO: ado-api logs errors <build-id> — fetches and filters failure logs. Run ado-api logs --help for full usage.
Print the plan as a numbered list before the AskUserQuestion. Each entry must include:
fetch_user() in try/except for ConnectionError in auth.py:42" is.light / medium / deepMark items that need a user decision with [DECISION NEEDED] — these are comments where:
For [DECISION NEEDED] items, state the options and your recommendation.
Also include:
AskUserQuestion:
question: "Here's my plan for PR #{N}. Items marked [DECISION NEEDED] have options listed — choosing 'Looks good' accepts my recommendation for those. Review and tell me if anything should change."
header: "PR Plan"
multiSelect: false
options:
- label: "Looks good — address all"
description: "Proceed with the full plan, using the proposed recommendations for [DECISION NEEDED] items"
- label: "Adjust items"
description: "I'll tell you what to change, skip, or decide differently"
- label: "Cancel"
description: "Exit without making changes"
If "Adjust items": ask which numbered items to skip or change. For items the user wants changed, ask what they want instead and update the plan entry before proceeding.
If conflicts exist, ask the user:
AskUserQuestion:
question: "Merge conflicts detected. How should I resolve them?"
header: "Conflicts"
options:
- label: "Merge (Recommended)"
description: "git merge origin/<base> — creates a merge commit, preserves history"
- label: "Rebase"
description: "git rebase origin/<base> — rewrites history, requires force-push"
get-skill-tmpdir mine-address-pr
For each group from the plan, launch a general-purpose subagent (model: sonnet) with:
[DECISION NEEDED] items: the resolved decisionlight, medium, or deep)<tmpdir>/group-N/result.mdSubagent prompt template:
You are addressing PR review feedback. Your output goes to
{output_path}.Comments to address: {comment_details}
Approved fix: {proposed_fix_from_plan}
Investigation depth: {depth}
If
light: Read the target file. Apply the fix. Run the project's test suite. If tests fail: fix or escalate. Max 3 retries.If
medium: Read the target file fully. Grep for call sites of the function/class being modified. Read at least one call site to understand usage. Apply the fix. Run the project's test suite (follow the test execution discovery order fromreferences/common/testing.md). If tests fail: fix the code. Max 3 retries, then escalate to user.If
deep: Read the target file fully. Grep for call sites — read ALL callers. Read related test files. Read adjacent modules in the same package/directory. Apply the fix. Run the project's test suite. If tests fail: fix or escalate. Max 3 retries.CRITICAL: Never explain away a test failure or CI error. If tests fail after your fix, the fix is wrong — revise it. Do not suggest the test is outdated, flaky, or testing the wrong thing. Do not suggest skipping or marking the test as expected failure. Fix the code until tests pass, or escalate to the user after 3 attempts.
Write a one-line summary as the first line of your output file, then details below.
Read only the first line of each result file for the summary — do not read full subagent output into main context.
After all subagents complete:
Do NOT commit until both reviewers pass. If CRITICAL/HIGH findings remain after 3 iterations, present them to the user before proceeding.
Commit per logical group with descriptive messages:
fix(auth): use logging instead of print per review
fix(config): add LOGIN_REDIRECT_URL to test settings
Push once after all commits.
After push is confirmed, reply to threads. For each addressed thread:
<!-- addressed-pr-issues -->. If found, skip the reply.<!-- addressed-pr-issues --> marker in the body. Keep replies concise and professional:
| Thread author | Action | |---|---| | Bot | Reply + resolve | | Human reviewer | Reply only — reviewer resolves after verifying | | PR author (self-review) | Reply + resolve |
Bot detection:
author.__typename == "Bot" is the primary signal. Fall back to [bot] suffix check on author.login if __typename is unavailable.[bot] suffix on author.uniqueName. Also check if uniqueName matches service account patterns (no @ domain, or matches the project's build service identity).GitHub resolution: Use gh-pr-reply {PR} {comment-database-id} "{body}" --resolve {thread-id} for combined reply+resolve.
ADO resolution: Two calls: ado-api pr reply {PR} {thread-id} "{body}" then ado-api pr resolve {PR} {thread-id}.
Rate limiting: 1-second delay between mutative API calls.
Present a structured summary:
## Summary
### Review Comments
- Resolved (bot threads): N threads [replied & resolved]
- Replied (human threads): M threads [reply posted, awaiting reviewer]
- Already addressed: K threads [replied]
- Skipped: J threads [reason]
### Merge Conflicts
- Resolved: N files — [merge/rebase] origin/<base> into <head>
### CI Failures
- Fixed: N checks — [brief description of each fix]
- Still pending: CI will re-run on push
### Commits
- [list each commit with its message]
### Needs Manual Review
- [any items that could not be resolved automatically]
IMPORTANT: Use these helper scripts instead of inline commands. They handle authentication, pagination, and output formatting.
gh-pr-threads, gh-pr-reply (with --resolve), git-platform — run --help on each for usageado-api pr (show/list/create/update/threads/reply/resolve/resolve-pattern), ado-api logs (CI failure logs), ado-api work-item — run ado-api --help for usagegit-platform — prints github, ado, or unknowngh auth login (GitHub) or az login (ADO)gh auth refresh -s repodevelopment
Use when the user says: "document how X works", "write up how this works", "durable explanation", "explain this for the docs", "document this subsystem". Writes a durable, architectural-altitude explanation that survives code churn.
development
Use when picking up a fresh session after /clear, a stop, or an unanswered AskUserQuestion. Reconstructs the prior session's intent from its transcript tail and surfaces any unresolved decision; user-invoked only — for a hand-written end-of-day handoff use /mine-good-morning instead.
development
Use when the user says: "what did we discuss", "continue where we left off", "remember when", "as I mentioned", "you suggested", "we decided", "search my conversations", "find the conversation where", "what did we work on", or uses implicit signals like past-tense references, possessives without context, or assumptive questions. Direct search over past Claude Code sessions via cass.
tools
Use when the user says: "what context do I have", "relevant history for this task", "what have we done related to this". Also usable proactively when starting work that likely has prior history. Assembles a structured context brief from past session history via cass, scoped to the current task and workspace.