ワンクリックで
review-pr
Review and address PR feedback using 6-dimensional code review
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Review and address PR feedback using 6-dimensional code review
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Open a PR for the current feature branch — validate, self-review, simplify, organize commits, push, create the PR, wait for CI and review, then address feedback. Use when implementation is complete and ready for review.
Respond to PR review comments systematically in thread context
Add a field to NULLABLE_FIELDS in scripts/regenerate_client.py and regenerate the client. Use when a TypeError appears in logs or tests because a generated model expected a non-null value but the StockTrim API returned null.
Regenerate the StockTrim OpenAPI client from the live spec, run quality checks, and commit the result. Use when the StockTrim API spec changes, a new endpoint is added, or NULLABLE_FIELDS in scripts/regenerate_client.py is updated.
Add a new MCP tool to stocktrim_mcp_server, including the tool function, service layer, and test. Use when exposing an existing helper to AI clients via the Model Context Protocol.
Run the full CLAUDE.md zero-tolerance quality gate before declaring any task done. Checks lint, type, tests (root + MCP), forbidden patterns, feature branch, and commits. Use as the final pre-PR check.
| name | review-pr |
| description | Review and address PR feedback using 6-dimensional code review |
| argument-hint | [PR number or URL] |
| allowed-tools | Bash(gh pr *), Bash(gh api *), Bash(gh repo *), Bash(git status), Bash(git branch *), Bash(git diff *), Bash(git log *), Bash(git show *), Bash(git add *), Bash(git commit *), Bash(git push *), Bash(git pull *), Bash(git rebase *), Bash(git stash *), Bash(git fetch *), Bash(git merge *), Bash(jq *), Bash(.claude/skills/review-pr/*), Bash(.claude/skills/shared/*), Bash(.claude/skills/pr-comments/reply-to-comment.sh*), Read |
Review a PR using 6 dimensions or address unresolved review feedback systematically.
Analyze code changes thoroughly and respond to review comments without missing issues or duplicating automated findings.
mergeStateStatus=BEHIND or git log HEAD..origin/<base> --oneline shows anything,
rebase before reading comments or making code changes. Reasons: (a) comments may be
obsolete after the base advanced; (b) fixes pushed onto a stale branch trigger CI
against the still-stale base; (c) auto-merge stays blocked on BEHIND even when CI is
green and threads are resolved; (d) fixup-and-push autosquash collides with
intervening base commits — this is exactly the PR #203 failure mode, where a
mid-review force-push hit simplify commits because the rebase step was skipped. Use
git rebase origin/<base> directly, or invoke /rebase for conflict resolution +
uv.lock bundling.--force-with-lease after a fixup.gh pr view or gh api repos/{owner}/{repo}/pulls/{number}/comments),
always verify the PR number matches the PR you're actually working on. Replying to the
wrong PR is invisible to reviewers and leaves the actual PR unaddressed.gh) installed and authenticated/review-pr [PR#] # Or: /review-pr (current branch)
gh pr view <PR#> --json state,reviews
Check out the PR's head branch, then rebase against the latest base. See CRITICAL — this is not optional:
head_ref=$(gh pr view <PR#> --json headRefName --jq '.headRefName')
base_ref=$(gh pr view <PR#> --json baseRefName --jq '.baseRefName')
gh pr checkout <PR#>
test "$(git branch --show-current)" = "$head_ref"
git fetch origin "$base_ref"
git log "HEAD..origin/$base_ref" --oneline # any commits? rebase before doing anything else.
git rebase "origin/$base_ref"
If uv.lock or other artifacts drift post-rebase, bundle them into the rebased commit
(git add uv.lock && git commit --amend --no-edit) and git push --force-with-lease.
After the rebase, re-fetch the comment list — some comments may now reference
deleted/moved lines and need to be re-classified.
gh pr view <PR#> --json title,body,diff
[Invoke code-reviewer agent with PR context]
Organize findings: BLOCKING → SUGGESTION → NITPICK
Post structured review via gh pr review
[For each unresolved comment]
1. Read affected code
2. Fix or acknowledge
3. Run project verification (test suite, lint, type-check)
4. Re-rebase if base advanced again, then commit, push
5. Reply to EVERY comment in-thread (this step is NOT optional)
Steps 4-5 are atomic. Never finish at "pushed fixes" — always continue to reply to every comment before reporting done. See DETAIL: Mode B Workflow.
For PRs with many changed files or thousands of lines:
Example:
This PR is quite large (47 files, 2500 lines). I've reviewed:
- Core auth changes (critical path)
- Data mutation logic (sampled 5 files for pattern)
- Tests (coverage spot-check)
Blocked on: Vendor update changes (auto-generated, skipping).
Recommendation: For future PRs, split refactors by domain
(auth, API, database) for focused reviews.
If the PR has merge conflicts, the rebase from STANDARD PATH step 2 will surface them. Resolve in place:
# You're already on the PR's head branch from gh pr checkout.
# $base_ref was set in STANDARD PATH step 2 (gh pr view ... --json baseRefName).
git rebase "origin/$base_ref"
# Resolve conflicts in each file (keep our branch's intent integrated with base changes)
git add <resolved-files>
git rebase --continue
git push --force-with-lease origin HEAD:refs/heads/<branch-name>
If the conflicts originated from an explicit git merge instead (e.g., GitHub's "Update
branch" button created a merge commit on the remote), pull that merge first with
git pull --no-rebase and resolve normally.
Conflicts can invalidate prior comments — recheck affected sections after resolving.
Check CI status before responding to review comments:
gh pr view {number} --json mergeable,mergeStateStatus
gh pr checks {number}
If code-related (lint, type, test failure):
If infrastructure-related (flaky CI, timeout, infrastructure issue):
Always sync the branch and resolve conflicts/build failures before addressing review comments — review comments may no longer apply after a rebase + base advance.
Use this structure for consistent, thorough reviews (avoid repeating automated findings):
# Review: [PR Title]
## What This Changes
[1-2 sentences summarizing the change and its impact]
## 6-Dimensional Analysis
### Correctness
- [Semantic correctness, type safety, logic]
- [Any potential bugs or edge cases]
### Design
- [Architecture, interfaces, patterns vs. project conventions]
- [Trade-offs and alternatives considered?]
### Readability
- [Naming clarity, documentation, code flow]
- [Any confusing sections?]
### Performance
- [Efficiency, algorithms, resource usage]
- [Any obvious optimizations possible?]
### Testing
- [Test coverage for new code]
- [Edge cases and error conditions covered?]
### Security
- [Input validation, auth, secrets, injection risks]
- [Any exposed internals or vulnerabilities?]
## Findings
### BLOCKING (must fix before merge)
[Only items that break functionality or violate critical constraints]
### SUGGESTION (worth addressing)
[Improvements that enhance quality, maintainability, or safety]
### NITPICK (nice-to-have)
[Style, naming, minor clarity suggestions]
### What Looks Good
[Highlight strong aspects: good patterns, clever solutions, solid testing]
## Summary
- Verdict: Approved / Changes requested / Comment
- Ready to merge after addressing blocking items
Reply to each comment with one of these patterns:
Fixed — [describe what changed].
[If tests added: Also added tests for X].
This was addressed in [commit hash] — [brief explanation].
Acknowledged — [reason for deferral].
Tracked in #NNN [link to GitHub issue].
I wasn't able to reproduce this. Can you clarify [specific question]?
Initial PR review (no comments yet).
ctx=$(.claude/skills/shared/resolve-github-context.sh <PR#>)
owner_repo=$(echo "$ctx" | jq -r '"\(.owner)/\(.repo)"')
.claude/skills/shared/fetch-pr-context.sh "$owner_repo" <PR#>
Pass compiled context:
PR Title: [title]
Author: [author]
Description: [body]
Labels: [labels]
Diff: [patch]
Existing Comments: [any automated reviewer comments]
Agent returns: 6D analysis + findings organized by severity.
BLOCKING: [list items that must be fixed]
SUGGESTION: [list improvements]
NITPICK: [list nice-to-haves]
What Looks Good: [highlight strengths]
gh pr review <PR#> --approve # or --request-changes / --comment
Address unresolved review feedback.
See STANDARD PATH step 2 — gh pr checkout, fetch base, rebase. This is mandatory
and must happen before fetching comments (some may become obsolete after the rebase).
ctx=$(.claude/skills/shared/resolve-github-context.sh {number})
owner_repo=$(echo "$ctx" | jq -r '"\(.owner)/\(.repo)"')
.claude/skills/review-pr/fetch-unresolved-comments.sh "$owner_repo" {number}
Returns JSON array of unresolved comments with id, path, line, body, author. Resolved threads are already filtered out.
Read affected code. Classify:
Make code changes. Validate:
cmd=$(.claude/skills/shared/discover-verification-cmd.sh)
eval "$cmd" # ALL must pass
Before every force-push, re-check the base (see CRITICAL — autosquash conflicts with stale branches are the exact PR #203 failure mode):
# $base_ref was set in STANDARD PATH step 2; re-fetch if it's not in scope.
git fetch origin "$base_ref"
git log "HEAD..origin/$base_ref" --oneline # any commits? rebase first.
git rebase "origin/$base_ref" # only if commits appeared
Then use the fixup-and-push script (stages, creates fixup commit, autosquash rebases, force-pushes):
.claude/skills/review-pr/fixup-and-push.sh "$base_ref" "original commit subject" <file1> <file2> ...
Verify the PR number first — confirm you're replying on the correct PR (e.g., via
gh pr view or the web UI). If fixes were made in a follow-up PR, reply on that PR, not
the original.
Use the reply script — it validates the comment belongs to the correct PR before posting:
.claude/skills/pr-comments/reply-to-comment.sh {owner}/{repo} {number} {comment_id} 'Fixed — [explanation]'
Never reply before pushing — replies confirm fix is live.
After replying to all comments, resolve all review threads to clear the "changes requested" status:
resolved=$(.claude/skills/shared/resolve-all-threads.sh {owner}/{repo} {number})
echo "Resolved $resolved review threads"
Print results:
--no-verify, # noqa, type: ignoregh issue create
ticketgit add -A or git add .Some of the skills below come from the harness-kit plugin at runtime (e.g.
/rebase); others (/code-reviewer,/pr-comments,/commit) have local overlays in.claude/skills/that extend or specialize the upstream version. When both exist, the local overlay wins.
/rebase — Canonical conflict-resolution wrapper with uv.lock bundling
(harness-kit)/code-reviewer — 6-dimensional review reference — local overlay/pr-comments — Systematic reply workflow (alternative to this skill's Mode B) —
local overlay/commit — Quality-gated conventional commits — local overlaycode-reviewer agent — Automated 6D analysis (spawned by this skill)