sw-review
Fetches and displays PR review comments from GitHub, grouped by priority, and allows the user to reply to or resolve individual threads.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Fetches and displays PR review comments from GitHub, grouped by priority, and allows the user to reply to or resolve individual threads.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Specwright health check. Validates shared config, anchor docs, workflow and session state, commands, gates, and hooks. May backfill shipped PR metadata when it can prove the mapping safely.
Detects project stack and existing guardrails, then interactively configures deterministic quality checks across session, commit, push, and CI/CD layers.
Initializes Specwright in a project. Detects stack, asks about practices, creates constitution and charter, configures quality gates and hooks.
Shows current Specwright state for this worktree, the attached work, repo-wide active works, gate results, and lock status. Supports --reset, --cleanup, and --repair {unitId}.
Periodic codebase health check. Analyzes architecture, complexity, consistency, and debt across the full codebase. Produces persistent findings in AUDIT.md.
TDD implementation of one work unit. Delegates test writing to the tester agent and implementation to the executor agent. Commits per task.
| name | sw-review |
| description | Fetches and displays PR review comments from GitHub, grouped by priority, and allows the user to reply to or resolve individual threads. |
| argument-hint | [pr-number] |
| allowed-tools | ["Read","Bash","Grep","AskUserQuestion"] |
Surface PR review comments, triage autonomously per Google severity framework
(protocols/decision.md), draft replies, and present for approval before
posting. When the associated Specwright work can be resolved safely, use
review-packet.md, approvals.md, and unit evidence as the primary reply
context instead of reasoning from the diff alone. Stateless with respect to
Specwright state — never modifies workflow.json.
Fetch all comment types, group by status, apply autonomous triage:
The PR itself is the review surface — reviewers see replies directly. When no associated work can be matched, say so explicitly and use a diff-only fallback.
{projectArtifactsRoot}/config.json — git.prTool and git.baseBranch settingsgit branch --show-currentgh pr list --head {branch}gh api REST and GraphQL endpoints{repoStateRoot}/work/*/workflow.json{workDir}/review-packet.md{workArtifactsRoot}/{workId}/approvals.md{workDir}/evidence/*.mdgh api POST to the appropriate endpointresolveReviewThread GraphQL mutationPR detection (MEDIUM freedom):
git branch --show-current. If the result
is empty or HEAD is detached, report the detached HEAD condition and stop.gh pr list --head {branch} --json number,title,url.
If no open PR is found, retry with --state merged as a fallback for merged PRs.config.git.prTool before invoking gh; if the value is not gh or is
unset, degrade to URL display. sw-review only supports the gh CLI.Comment fetching (MEDIUM freedom):
gh api:
GET /repos/{owner}/{repo}/issues/{n}/commentsGET /repos/{owner}/{repo}/pulls/{n}/commentsreviewThreads with isResolved field.
To correlate: match REST review comment id against GraphQL
reviewThreads.comments.nodes[].databaseId. If correlation fails, treat
as unresolved.--per-page 50. If exactly 50
results are returned, assume more may exist and display: "Showing first 50 —
view full thread at {url}." Pagination state is in Link response headers,
not in the JSON body.user.login), timestamp (created_at),
file path and line number (path, line) for review comments, and body text.Comment grouping and prioritization (MEDIUM freedom):
Associated work context (MEDIUM freedom):
workUnits[].prNumber, then the PR head branch
against workflow.json.branch. If more than one work matches, report the
ambiguity and fall back instead of picking one silently.review-packet.md,
approvals.md, and unit evidence before drafting replies or validating bot
comments.review-packet.md as the primary reviewer-response context. Use
approvals.md to verify approval lineage claims and evidence files to verify
gate-status claims. Do not default to diff-only reasoning when these audit
artifacts are available.Responding and resolving (MEDIUM freedom):
gh api with an HTTP POST:
gh api --method POST /repos/{owner}/{repo}/pulls/{n}/comments/{id}/replies./repos/{owner}/{repo}/issues/{n}/comments with a body field. Issue
comments have no threading — there is no in_reply_to_id for this endpoint.resolveReviewThread GraphQL mutation
via gh api graphql. The gh pr edit command is for PR metadata only — it
cannot post replies or resolve threads; always use gh api instead.Graceful degradation without gh (LOW freedom):
gh is not available or not installed, degrade gracefully: construct the
PR URL from the git remote URL (convert SSH or HTTPS remote to a browser
URL), display it, and inform the user: "Install gh CLI to fetch and respond
to comments from the terminal." Do not abort or STOP — present the URL as a
fallback so the user can open the PR in a browser.protocols/headless.md.Stateless utility (LOW freedom):
prTool is permitted. No writes to
{projectArtifactsRoot}, {workArtifactsRoot}, {repoStateRoot}, or
{worktreeStateRoot}.protocols/decision.md — autonomous decision framework (Google severity triage, external reply gate)protocols/git.md — PR operations, remote URL conventions, gh CLI patternsprotocols/evidence.md — gate evidence as canonical detailprotocols/approvals.md — approval lineage contractprotocols/review-packet.md — reviewer packet contract for reply contextprotocols/headless.md — non-interactive execution and result file formatprotocols/context.md — logical-root config loadinggit branch --show-current returns empty. Report "Cannot
detect branch: HEAD is detached. Check out a branch and try again." Do not proceed.gh pr list --head returns no results and the --state merged
fallback also returns nothing. Report "No pull request found for branch
{branch}" and exit without error.gh api returns HTTP 429, or HTTP 403 with
X-RateLimit-Remaining: 0. Surface the error message and the
X-RateLimit-Reset time. Ask the user to retry after the reset window.gh api returns HTTP 403 without rate-limit
headers. Report "Access denied. Run gh auth status to check token scopes
and repository access." Do not retry automatically.