ワンクリックで
post-pr-review
Internal helper. Load only when explicitly named by another skill or agent.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Internal helper. Load only when explicitly named by another skill or agent.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
This skill should be used when the user asks to "babysit a PR", "babysit my pull request", "monitor my PR", "watch my pull request", "keep my PR green", "fix PR build failures automatically", "handle PR review comments", or wants autonomous Azure DevOps PR monitoring that fixes build breaks, test failures, code coverage gaps, and review comments on a polling loop.
Internal helper. Load only when explicitly named by another skill or agent.
Internal helper. Load only when explicitly named by another skill or agent.
Publish local changes as an Azure DevOps pull request — analyzes commits, creates or links a work item (bug, task, or user story), pushes the branch, composes a PR description, and optionally tends to reviewer feedback and build failures until the PR is merged.
Internal helper. Load only when explicitly named by another skill or agent.
Internal helper. Load only when explicitly named by another skill or agent.
| name | post-pr-review |
| description | Internal helper. Load only when explicitly named by another skill or agent. |
| user-invocable | true |
| disable-model-invocation | false |
| allowed-tools | Read, Bash, Skill, mcp__azure-devops__* |
Publish structured review results (findings, context questions, and summary) to a
GitHub or Azure DevOps pull request. This skill owns the full "write to the PR
provider" workflow — the caller provides the data, this skill resolves the provider
(see Provider Resolution & Tool Mapping) and
handles formatting, deduplication, thread management, and posting. Provider-specific
calls below show the mcp__azure-devops__* tool and its GitHub gh equivalent.
The caller MUST provide the following fields. Validate all required fields before proceeding — reject with a clear error if any are missing.
| Field | Type | Description |
|---|---|---|
prNumber | integer | PR number (GitHub or Azure DevOps) |
repository | string | Repository name (e.g., MyRepository) |
botPrefix | string | Bot prefix for all comments (e.g., [<reviewer>'s bot]) |
findings[] | array | Graded findings from review — each with severity, blocker flag, category, file, line, issue, suggestion |
questions[] | array | Context questions from Step 10 — each with file, line, uncertainty, what answering unlocks |
verdict | enum | APPROVE, APPROVE_WITH_COMMENTS, or REQUEST_CHANGES |
reviewType | enum | initial or re-review |
outputFormatMarkdown | string | The formatted review summary markdown (from output-format.md template) |
| Field | Type | Description |
|---|---|---|
project | string | ADO project name, or GitHub owner (auto-detected from git remote if omitted) |
approveAfterPosting | boolean | If true and verdict is APPROVE, approve the PR after posting. Default: false (confirm with user first) |
mergeAfterApproval | boolean | If true, merge after approval. Default: false |
mergeStrategy | enum | squash, noFastForward, rebase, rebaseMerge. Default: squash |
isSmallDelta | boolean | When true, the caller is posting a trivial re-review delta and the summary must use small-delta mode. Default: false |
smallDeltaSummary | string | Required when isSmallDelta is true. A 1-3 sentence delta-only summary reply |
Each item in findings[] must have:
- Severity: CRITICAL | HIGH | MEDIUM | LOW
- Blocker: true | false
- Category: string (e.g., "Security", "Performance", "Code Quality")
- File: string (path relative to repo root)
- Line: integer (1-based line number, or null for file-level)
- Issue: string (description of the problem)
- Suggestion: string (proposed fix with code example)
Each item in questions[] must have:
- File: string (path relative to repo root)
- Line: integer (1-based line number)
- CodeContext: string (the code snippet that triggered the question)
- Uncertainty: string (what the reviewer cannot determine)
- WhatAnsweringUnlocks: string (what the reviewer could assess with an answer)
- SuggestedAnswers: string[] (optional — 2-3 possible answers to guide the author)
findings[] items have the required structurequestions[] items have the required structureisSmallDelta is true, verify reviewType is re-review,
smallDeltaSummary is present, and the summary is no longer than 3 sentencesResolve the provider once from the git remote (full rules in Provider Resolution & Tool Mapping):
git remote get-url origin
github.com → GitHub; parse https://github.com/<owner>/<repo>
(project ≈ <owner>, repository = <repo>). Post via GitHub MCP tools when
connected, else the gh CLI.dev.azure.com / visualstudio.com → Azure DevOps; parse
https://<org>.visualstudio.com/<project>/_git/<repository>. Post via
mcp__azure-devops__*.When multiple agents flag the same issue (same file + same line range + similar description), keep the more detailed version and discard the duplicate.
Deduplication rules:
Post findings in priority order (most severe first):
For each finding, select the comment type:
Inline comment (preferred) — when Line is not null:
# Azure DevOps
mcp__azure-devops__addPullRequestInlineComment
repository: <repository>
pullRequestId: <prNumber>
path: /<file>
position: { line: <line>, offset: 1 }
comment: <formatted comment>
# GitHub (gh CLI; commit_id = PR head SHA from `gh pr view <n> --json headRefOid`)
gh api repos/<owner>/<repo>/pulls/<prNumber>/comments \
-f body=<formatted comment> -f commit_id=<headSha> \
-f path=<file> -F line=<line> -f side=RIGHT
File comment (fallback) — when Line is null or inline fails:
# Azure DevOps
mcp__azure-devops__addPullRequestFileComment
repository: <repository>
pullRequestId: <prNumber>
path: /<file>
comment: <formatted comment>
# GitHub — no line-less file comment exists: anchor an inline comment to the
# file's first changed line, or fall back to the general comment (3) naming the file.
General comment (last resort) — when file is not in PR diff:
# Azure DevOps
mcp__azure-devops__addPullRequestComment
repository: <repository>
pullRequestId: <prNumber>
comment: <formatted comment>
# GitHub
gh pr comment <prNumber> --body <formatted comment>
Finding comment format:
For blocking findings:
<botPrefix> [BLOCKER] **<Severity>** (<Category>)
<Issue description>
**Suggestion:** <Suggestion with code example>
For non-blocking findings:
<botPrefix> **<Severity>** (<Category>)
<Issue description>
**Suggestion:** <Suggestion with code example>
Blocker classification (from Review Thread State Machine):
Error handling: If an inline comment fails (line not in diff), retry as a file comment. If that also fails, fall back to a general comment referencing the file and line.
Post each question as an inline comment anchored to the relevant code line.
Questions use the [QUESTION] tag — distinct from findings.
<question_deduplication> Step 5a: Check for existing questions (MUST do before posting)
Before posting any questions, check for questions we already asked in a previous review iteration. This requires the full set of PR comment threads.
Reuse already-fetched comments: If PR comment threads were already fetched
earlier in this workflow (e.g., by Step 4's finding dedup or any prior step),
reuse that data — do NOT call getPullRequestComments again. Only fetch if no
prior step has retrieved comments yet:
# Azure DevOps
mcp__azure-devops__getPullRequestComments
repository: <repository>
pullRequestId: <prNumber>
# GitHub
gh api repos/<owner>/<repo>/pulls/<prNumber>/comments # inline/review threads
gh api repos/<owner>/<repo>/issues/<prNumber>/comments # general comments
Cache for later: Store the fetched threads so Step 6 (summary thread management) can reuse them instead of making another API call.
Scan all comment threads for existing [QUESTION] threads by looking for
threads whose root comment contains BOTH:
botPrefix (e.g., [<reviewer>'s bot])[QUESTION] tagBuild an existing-questions list from matching threads:
| File | Uncertainty (first 100 chars) | Thread Status | Thread ID |
Step 5b: Filter out duplicate questions
For each question in questions[], check if it already exists by matching:
Uncertainty field substantially overlaps with
an existing question's text (same core question, even if wording differs slightly)If a match is found → skip posting and record it as a duplicate. The existing thread already captures the question — re-posting would clutter the PR.
What counts as a duplicate:
Track results:
skippedQuestions[] — questions that already exist on the PR
newQuestions[] — questions that need to be posted
</question_deduplication>
Step 5c: Post new questions only
For each question in newQuestions[] (same inline-comment mechanism as Step 4):
# Azure DevOps
mcp__azure-devops__addPullRequestInlineComment
repository: <repository>
pullRequestId: <prNumber>
path: /<file>
position: { line: <line>, offset: 1 }
comment: <formatted question>
# GitHub
gh api repos/<owner>/<repo>/pulls/<prNumber>/comments \
-f body=<formatted question> -f commit_id=<headSha> \
-f path=<file> -F line=<line> -f side=RIGHT
Question comment format:
<botPrefix> [QUESTION] **Clarification Needed**
**Code:**
`<CodeContext>`
**Question:** <Uncertainty>
**Why this matters:** <WhatAnsweringUnlocks>
**Possible answers:** <SuggestedAnswers, if provided>
Key rules:
[BLOCKER] tagnewQuestions[] has more than 10 items, post the top 10 (highest review
impact) and note the remainder in the summary"All <count> questions were already asked in a previous review iteration."The review summary is the top-level overview of the entire review. To keep the PR clean, we reuse the existing summary thread instead of creating new ones.
<summary_thread_management> Workflow:
Search for existing summary thread:
Reuse already-fetched comments: If Step 5a already fetched PR comment
threads, reuse that cached data — do NOT call getPullRequestComments again.
Only fetch if Step 5 was skipped (no questions to post):
# Azure DevOps
mcp__azure-devops__getPullRequestComments
repository: <repository>
pullRequestId: <prNumber>
# GitHub
gh api repos/<owner>/<repo>/issues/<prNumber>/comments
Scan all comment threads for a thread whose root comment contains BOTH:
botPrefix (e.g., [<reviewer>'s bot])# PR Review: or ## Re-Review Summary:If existing summary thread found → reply to it:
# Azure DevOps
mcp__azure-devops__addPullRequestComment
repository: <repository>
pullRequestId: <prNumber>
comment: <new summary markdown>
# GitHub — reply in the existing review thread
gh api repos/<owner>/<repo>/pulls/<prNumber>/comments/<rootCommentId>/replies \
-f body=<new summary markdown>
Post the new summary as a reply to the existing thread using the thread ID (ADO) or the root comment ID (GitHub/GH). This keeps all review summaries in one conversation thread.
How to reply to an existing thread:
getPullRequestComments to find the thread ID of the
existing summary, then addPullRequestComment — the ADO MCP tools handle
thread replies when you reference the parent thread.id when scanning threads, then POST
to .../pulls/<prNumber>/comments/<id>/replies. (For a summary posted as a
general issue comment, post a new gh pr comment referencing the prior one.)Note: Do NOT close or resolve the old summary. The new reply supersedes it naturally. The thread stays Active until the PR is approved.
If no existing summary thread → create new one:
# Azure DevOps
mcp__azure-devops__addPullRequestComment
repository: <repository>
pullRequestId: <prNumber>
comment: <summary markdown>
# GitHub
gh pr comment <prNumber> --body <summary markdown>
Post as a new general comment. This becomes the summary thread for future re-reviews.
Summary identification markers:
botPrefix followed by a known heading# PR Review: <PR Title>## Re-Review Summary: PR #<prNumber><small_delta_summary>
If reviewType is re-review and isSmallDelta is true:
smallDeltaSummary as the entire comment body.smallDeltaSummary.
</small_delta_summary>Summary content selection:
smallDeltaSummary.outputFormatMarkdown provided by the caller. Append a
questions summary section if any questions were posted:## Context Questions Asked (<count>)
The following areas need clarification from the PR author. These are non-blocking
but answers will improve review confidence:
| # | File | Line | Question |
|---|------|------|----------|
| 1 | path/to/file.cs | 45 | <brief uncertainty> |
| ... | ... | ... | ... |
Approve — only when ALL conditions are met:
APPROVEapproveAfterPosting is true OR user explicitly confirms[BLOCKER] findings exist# Azure DevOps
mcp__azure-devops__approvePullRequest
repository: <repository>
pullRequestId: <prNumber>
# GitHub
gh pr review <prNumber> --approve --body "<short approval note>"
On GitHub, a
REQUEST_CHANGESverdict can be posted as a real review state withgh pr review <prNumber> --request-changes --body "<summary>". Azure DevOps has no native request-changes verb — the findings and summary comments carry it.
Merge — only when ALL conditions are met:
mergeAfterApproval is true OR user explicitly confirms# Azure DevOps
mcp__azure-devops__mergePullRequest
repository: <repository>
pullRequestId: <prNumber>
mergeStrategy: <mergeStrategy>
# GitHub
gh pr merge <prNumber> --squash # or --merge (noFastForward) / --rebase
Always confirm merge strategy with the user:
--squash--mergeReturn a structured confirmation to the caller:
## Post-PR-Review Complete
- **PR**: #<prNumber> in <repository>
- **Findings posted**: <count> (<critical> critical, <high> high, <medium> medium, <low> low)
- **Questions posted**: <count> (<skipped> skipped as already asked)
- **Summary**: <new thread | replied to existing thread #<threadId>>
- **Verdict**: <verdict>
- **Approved**: Yes / No
- **Merged**: Yes / No
- **Errors**: <any posting failures, with details>
gh CLI) → use ado:setup-ado-mcp or gh:setup-gh-mcp and retry; if still failing, return error suggesting a config / gh auth checkUse the provider's mention conventions when referencing entities in comments — GitHub / Azure DevOps.
#12345 (hash prefix), pull requests !4567
(exclamation prefix). IMPORTANT: ! is for PRs, # is for work items/bugs.#123 — there is no ! syntax.code-reviewer:pr-review (Step 12), code-reviewer:re-review (Step 5)