一键导入
fix-pr-review
Fetch unresolved review comments from the GitHub PR associated with the current branch, apply fixes, run test/lint, and report the results.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Fetch unresolved review comments from the GitHub PR associated with the current branch, apply fixes, run test/lint, and report the results.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | fix-pr-review |
| description | Fetch unresolved review comments from the GitHub PR associated with the current branch, apply fixes, run test/lint, and report the results. |
| allowed-tools | ["Bash(git:*)","Bash(gh:*)","Bash(jq:*)","Bash(command -v gh:*)","Bash(mise:*)","Bash(task:*)","Bash(just:*)","Bash(make test:*)","Bash(make lint:*)","Bash(npm run test:*)","Bash(npm run lint:*)","Bash(pnpm test:*)","Bash(pnpm lint:*)","Bash(yarn test:*)","Bash(yarn lint:*)"] |
Identify the GitHub PR associated with the current branch, address all unresolved review comments (thread comments, PR body comments, and review bodies), run test/lint where possible, and report the outcomes and changes to the user.
git commit.git push (including --force).Verify the following.
git rev-parse --is-inside-work-tree
command -v gh
gh auth status
If any check fails, report the missing condition to the user and stop.
Fetch the PR associated with the current branch.
BRANCH="$(git branch --show-current)"
PR_JSON="$(gh pr view --json number,title,url,headRefName,baseRefName 2>/dev/null)"
If gh pr view fails, search by head branch name.
PR_JSON="$(gh pr list --head "$BRANCH" --state open --limit 1 --json number,title,url,headRefName,baseRefName)"
If no PR is found, stop and report to the user.
Extract PR_NUMBER and retrieve threads via GraphQL.
PR_NUMBER="$(printf '%s' "$PR_JSON" | jq -r '.number // .[0].number')"
OWNER_REPO="$(gh repo view --json nameWithOwner -q .nameWithOwner)"
OWNER="${OWNER_REPO%/*}"
REPO="${OWNER_REPO#*/}"
gh api graphql -f query='\
query($owner:String!, $repo:String!, $number:Int!) {\
repository(owner:$owner, name:$repo) {\
pullRequest(number:$number) {\
number\
title\
url\
headRefName\
baseRefName\
comments(first: 100) {\
nodes {\
body\
url\
createdAt\
author { login }\
}\
}\
reviewThreads(first: 100) {\
nodes {\
isResolved\
isOutdated\
path\
line\
comments(first: 50) {\
nodes {\
body\
url\
createdAt\
author { login }\
}\
}\
}\
}\
reviews(first: 50) {\
nodes {\
state\
body\
submittedAt\
author { login }\
}\
}\
}\
}\
}' -f owner="$OWNER" -f repo="$REPO" -F number="$PR_NUMBER"
Extraction rules:
comments): include all, including GitHub Actions bot comments.reviewThreads): include only isResolved == false and isOutdated == false.reviews): include state of CHANGES_REQUESTED or COMMENTED.Priority order:
For ambiguous comments, flag them as "needs clarification" and surface them to the user — do not silently change behavior.
Before making any changes, present the following table and wait for the user's approval.
| # | Priority | File:Line | Comment | Planned action |
|---|---|---|---|---|
| 1 | Bug | foo.dart:30 | Exception not caught | Add on FooException |
| 2 | Improvement | bar.dart:59 | No log on catch | Add Log.xxx |
Run verification starting from the scope closest to the changed code. Detection order:
mise taskstask -ljust --listmake test / make linttest / lint scripts in package.jsonIf no applicable command is found or it cannot be run, report the reason and skip.
Return results in the following format.
## PR Review Fix Results
### Target PR
- #<number> <title>
- <head> -> <base>
- <url>
### Addressed comments
- [Priority] <file:line> <summary> -> <action taken>
### Skipped / Needs clarification
- <category>: <reason>
### Commands run
- <command>
### Test result
- ✅ Passed / ⚠️ Partial failure or skipped (reason) / ❌ Failed
### Lint result
- ✅ Passed / ⚠️ Partial failure or skipped (reason) / ❌ Failed
### Changed files
- <path>
- commit / push not executed
/fix-pr-review