解决代码审查
- 作者仓库星标 0
- 作者仓库 skills-registry
- 领域
- 写作
- 作者声明的智能体
- 未找到明确声明;不据此推断已兼容或已测试
- 静态检查
- 88 / 100 · 启发式扫描,不代表运行安全
- 运行环境证据
- 未执行;当前没有隔离运行测试证据
- 作者 / 版本 / 许可证
- @tomevault-io · 未声明许可证
- 上下文用量评级
- 低消耗
- 接入复杂程度
- 需简单配置
- 是否需要外部接口密钥
- 不需要
- 兼容的系统
- 未声明(默认跨平台)
- 运行环境要求
- 未检出明确要求
- 检测到的文件与系统行为
-
- 只读
- 命令执行
- 网络行为
- 允许外网请求
- 安装命令数
- 无(仅作为资料)
需要注意: 未声明工具权限范围;实际权限由运行环境决定。
# Resolve Code Review
Read code review feedback on a pull request, resolve each item, reply in comment threads, and post a summary comment. Follows the PR conventions in CLAUDE.md.
**Complementary skill:** `superpowers:receiving-code-review` — use it alongside this one to ensure technical rigor when evaluating feedback.
## Usage
```
/resolve-code-review [PR_NUMBER]
```
If no PR number is provided, detect from the current branch with `gh pr view --json number -q .number`.
## Process
```dot
digraph resolve_review {
rankdir=TB;
fetch [label="1. Fetch PR comments" shape=box];
read [label="2. Read & categorize each comment" shape=box];
fix [label="3. Implement fixes" shape=box];
reply [label="4. Reply in each comment thread" shape=box];
summary [label="5. Post summary comment" shape=box];
push [label="6. Push fixes" shape=box];
fetch -> read -> fix -> reply -> summary -> push;
}
```
### 1. Fetch PR Comments
Detect the repo owner/name from the current git remote (do not hardcode).
> **Permission compatibility:** Always run `gh` commands as standalone statements — never chain with `&&` or wrap in `$()` variable assignments in the same Bash call. Claude Code's shell-aware permission matching evaluates each part of a chain independently, so `REPO=$(gh repo view ...) && echo "$REPO"` won't match a `Bash(gh repo view *)` permission even though the `gh` command itself would. Instead, run the `gh` command alone and capture the tool result.
```bash
gh repo view --json nameWithOwner -q .nameWithOwner
```
Store the result as `REPO` for subsequent commands.
Fetch review context:
```bash
gh pr view <PR> --repo ${REPO} --comments
gh pr diff <PR> --repo ${REPO}
```
**Fetch ALL inline comments with pagination** (default `per_page` is 30 — PRs with many review rounds will have more):
```bash
gh api "repos/${REPO}/pulls/<PR>/comments?per_page=100" \
--jq '[.[] | {id, in_reply_to_id, line, path, body, created_at, pull_request_review_id, user: .user.login}]'
```
If the response has 100 items, there may be more pages. Use `--paginate` to get all:
```bash
gh api "repos/${REPO}/pulls/<PR>/comments" --paginate \
--jq '[.[] | {id, in_reply_to_id, line, path, body, created_at, pull_request_review_id, user: .user.login}]'
```
**Find unreplied comments** using two separate queries with positive-match selectors only.
> **zsh compatibility:** Never use `!=` in jq expressions passed via `--jq` — zsh interprets `!` as history expansion and the command will fail. Always use positive `==` selectors in separate queries instead.
```bash
# Step 1: Get all original Gemini comments (not replies)
gh api "repos/${REPO}/pulls/<PR>/comments?per_page=100" \
--jq '[.[] | select(.in_reply_to_id == null) | select(.user.login == "gemini-code-assist[bot]") | {id, path, created_at, body_preview: (.body[0:120])}]'
# Step 2: Get IDs already replied to by dshaevel
gh api "repos/${REPO}/pulls/<PR>/comments?per_page=100" \
--jq '[.[] | select(.in_reply_to_id > 0) | select(.user.login == "dshaevel") | .in_reply_to_id]'
# Step 3: Compare — any ID in Step 1 not in Step 2 is unreplied
```
To fetch the **full body** of specific unreplied comments by ID:
```bash
gh api "repos/${REPO}/pulls/<PR>/comments?per_page=100" \
--jq '[.[] | select(.id == 12345 or .id == 67890) | {id, path, line, body}]'
```
Alternatively, fetch comments for the **latest review** specifically:
```bash
# Get the latest gemini review ID and summary
gh api "repos/${REPO}/pulls/<PR>/reviews" \
--jq '[.[] | select(.user.login == "gemini-code-assist[bot]")] | last | {id, body, state}'
# Fetch only that review's inline comments
REVIEW_ID=<id-from-above>
gh api "repos/${REPO}/pulls/<PR>/reviews/${REVIEW_ID}/comments" \
--jq '[.[] | {id, line, path, body, created_at}]'
```
If the review has a top-level summary comment (gemini-code-assist often posts one), read it first to understand the overall assessment.
### 2. Read and Categorize
For each review comment:
- **Read the file and surrounding code** to understand context before deciding
- **Determine severity** from the reviewer's language (critical, high, medium, low)
- **Decide resolution:** fix or decline
**Rules:**
- CRITICAL and HIGH: **Must fix**
- MEDIUM: Evaluate — fix if reasonable, decline with technical reasoning if not
- LOW: Fix if trivial, decline if YAGNI
### 3. Implement Fixes
For each item being fixed:
1. Read the relevant file
2. Make the change
3. Commit with a descriptive message (conventional commits format)
Group related fixes into a single commit when they address the same concern.
### 4. Reply to Each Comment Thread
Reply **in the comment thread** (not top-level). Every reply MUST:
- Start with `@gemini-code-assist` (required for notification)
- Explain what was fixed and how (if fixed)
- Provide technical reasoning (if declining)
```bash
gh api repos/${REPO}/pulls/<PR>/comments/<COMMENT_ID>/replies \
-f body="@gemini-code-assist Fixed. Changed X to Y."
```
### 5. Post Summary Comment
After all items are resolved, post a top-level PR comment:
```bash
gh pr comment <PR> --body "$(cat <<'EOF'
@gemini-code-assist Review addressed:
| # | Feedback | Resolution |
|---|----------|------------|
| 1 | Issue X | Fixed in <commit> - Description of fix |
| 2 | Issue Y | Declined - Technical reasoning |
EOF
)"
```
**Resolution column format:** Include both the **commit reference** AND a **brief summary**.
### 6. Push
Push fixes to the PR branch so the reviewer can verify.
```bash
git push
```
---
> Source: [davidshaevel-dot-com/davidshaevel-marketplace](https://github.com/davidshaevel-dot-com/davidshaevel-marketplace) — distributed by [TomeVault](https://tomevault.io).
<!-- tomevault:4.0:skill_md:2026-05-23 -->
章节与文件索引
按说明文件中的顺序排列。
用途
1. 获取公关评论
2.阅读并分类
3. 实施修复
4.回复每个评论主题
文件/命令 -> superpowers:receiving-code-review · gh pr view --json number -q .number · $() · REPO=$(gh repo view ...) && echo "$REPO" · Bash(gh repo view *) · REPO · per_page · --paginate
内容校验值 -> ea6db6b38646
当前原文的自动摘译,尚未人工审校。
用途
如果没有提供 PR 编号,则使用
gh pr view --json number -q .number从当前分支进行检测。1. 获取公关评论
从当前 git 远程检测存储库所有者/名称(不要硬编码)。权限兼容性:始终将
gh命令作为独立语句运行 — 切勿与&&链接或在同一 Bash 调用中将$()变量赋值包装起来。 Claude Code 的 shell 感知权限匹配独立评估链的每个部分,因此REPO=$(gh repo view ...) && echo "$REPO"不会匹配Bash(gh repo view *)权限,即使gh命令本身可以匹配。相反,单独运行gh命令并捕获工具结果。2.阅读并分类
对于每条审阅意见: 在决定之前阅读文件和周围的代码以了解上下文 根据审阅者的语言确定严重性(严重、高、中、低) 决定解决方案:修复或拒绝 规则:
3. 实施修复
对于要修复的每个项目: 读取相关文件 进行更改 使用描述性消息提交(传统提交格式) 当相关修复解决相同问题时,将它们分组到单个提交中。
4.回复每个评论主题
在评论线程中回复(不是顶级)。每个回复必须: 以
@gemini-code-assist开头(通知所需) 解释修复了什么以及如何修复(如果已修复) 提供技术推理(如果拒绝)