fix-coderabbit-review

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Fix CodeRabbit Review

修复CodeRabbit审查问题

Execute PR review remediation in a strict sequence: export issues, fix all issues, commit once, resolve threads.
Core principle: evaluate each review item technically before changing code. Do not apply suggestions blindly.
严格按顺序执行PR审查修复:导出问题、修复所有问题、单次提交、解决线程。
核心原则:修改代码前需从技术层面评估每个审查项,请勿盲目采纳建议。

Required Inputs

所需输入

  • PR number (integer).
  • GITHUB_TOKEN
    in environment.
  • gh
    authenticated for the target repository.
  • PR编号(整数)
  • 环境变量中的
    GITHUB_TOKEN
  • 已针对目标仓库完成身份认证的
    gh

Workflow

工作流

  1. Export review issues for the PR.
  2. Triage and validate every unresolved issue.
  3. Fix every validated issue completely.
  4. Commit all remediation changes together in one commit.
  5. Resolve review threads and mark exported issues resolved.
Run commands from repository root.
  1. 导出该PR的审查问题。
  2. 对所有未解决问题进行分类校验。
  3. 完整修复所有校验通过的问题。
  4. 将所有修复改动合并为单次提交。
  5. 解决审查线程并将导出的问题标记为已解决。
请在仓库根目录下运行所有命令。

Step 1: Export CodeRabbit Issues

步骤1:导出CodeRabbit问题

Use bundled exporter script:
bash
PR_NUMBER=<pr-number>
pnpm exec tsx .claude/skills/fix-coderabbit-review/scripts/pr-review.ts "$PR_NUMBER" --hide-resolved
Read generated files in:
  • ai-docs/reviews-pr-<PR_NUMBER>/_summary.md
  • ai-docs/reviews-pr-<PR_NUMBER>/issues/*.md
If
_summary.md
shows unresolved issues, continue until all are addressed in code.
使用内置的导出脚本:
bash
PR_NUMBER=<pr-number>
pnpm exec tsx .claude/skills/fix-coderabbit-review/scripts/pr-review.ts "$PR_NUMBER" --hide-resolved
生成的文件读取路径:
  • ai-docs/reviews-pr-<PR_NUMBER>/_summary.md
  • ai-docs/reviews-pr-<PR_NUMBER>/issues/*.md
如果
_summary.md
显示存在未解决问题,请持续处理直到代码中所有问题都被修复。

Step 2: Triage and Validate Issues

步骤2:问题分类与校验

Review each unresolved issue file before implementation.
For each issue:
  1. Restate the concrete technical change required.
  2. Verify against current codebase behavior and tests.
  3. Decide one of:
    • VALID
      : suggestion is correct and should be implemented.
    • INVALID
      : suggestion is incorrect or not actionable for this codebase.
Rules:
  • If an issue is ambiguous, treat it as
    INVALID
    , document rationale and assumptions in the issue file, and continue execution.
  • If an issue is
    INVALID
    , document technical rationale directly in the issue file and do not force a bad change.
  • Prefer technical evidence over agreement language.
实现前请逐一审查所有未解决问题文件。
针对每个问题:
  1. 明确所需的具体技术改动内容。
  2. 结合当前代码库行为和测试结果进行验证。
  3. 选择以下任一处理方式:
    • VALID
      :建议正确,应当实现。
    • INVALID
      :建议有误,或不适用于当前代码库。
规则:
  • 如果问题表述模糊,将其标记为
    INVALID
    ,在问题文件中记录判断依据和假设,再继续后续流程。
  • 如果问题被标记为
    INVALID
    ,直接在问题文件中记录技术层面的判断依据,请勿强行引入不合理的改动。
  • 优先以技术证据为准,而非一致性表述。

Step 3: Fix Issues Completely

步骤3:完整修复所有问题

Process all unresolved issue files under
ai-docs/reviews-pr-<PR_NUMBER>/issues/
.
  • Implement production-quality fixes in source code.
  • Add or update tests so each fix is verified.
  • Execute fixes one issue at a time and validate each before moving to the next.
  • Do not leave partial fixes.
  • Do not skip issues unless they are invalid; for invalid issues, keep rationale in the issue file.
After finishing all issue fixes, run full verification before commit:
bash
pnpm run lint
pnpm run typecheck
pnpm run test
处理
ai-docs/reviews-pr-<PR_NUMBER>/issues/
目录下所有未解决的问题文件。
  • 在源代码中实现生产级质量的修复。
  • 新增或更新测试用例,确保每个修复都得到验证。
  • 逐个处理问题,完成单个问题的修复并验证通过后再处理下一个。
  • 请勿留下未完成的部分修复。
  • 除非问题无效,否则请勿跳过问题;对于无效问题,请在问题文件中保留判断依据。
完成所有问题修复后,提交前运行完整的校验:
bash
pnpm run lint
pnpm run typecheck
pnpm run test

Step 4: Commit All Fixes Together

步骤4:将所有修复合并为单次提交

Create exactly one remediation commit containing all related code, test, and issue-tracking changes.
bash
git add -A
git commit -m "fix(repo): resolve PR #<PR_NUMBER> review issues"
Do not split fixes across multiple commits.
仅创建一个修复提交,包含所有相关的代码、测试以及问题追踪改动。
bash
git add -A
git commit -m "fix(repo): resolve PR #<PR_NUMBER> review issues"
请勿将修复拆分到多个提交中。

Step 5: Resolve Review Threads

步骤5:解决审查线程

After the single commit is created, resolve exported issue threads.
Determine the issue range from issue files (example:
001
to
018
) and run:
bash
bash .claude/skills/fix-coderabbit-review/scripts/resolve_pr_issues.sh \
  --pr-dir ai-docs/reviews-pr-<PR_NUMBER> \
  --from <first-issue-number> \
  --to <last-issue-number>
Re-open
ai-docs/reviews-pr-<PR_NUMBER>/_summary.md
and confirm unresolved count is
0
.
If thread resolution fails for specific IDs, keep those issues marked unresolved and report exact failures instead of claiming completion.
创建完单次提交后,解决导出的问题对应的审查线程。
从问题文件中确定问题编号范围(示例:
001
018
),然后运行:
bash
bash .claude/skills/fix-coderabbit-review/scripts/resolve_pr_issues.sh \
  --pr-dir ai-docs/reviews-pr-<PR_NUMBER> \
  --from <first-issue-number> \
  --to <last-issue-number>
重新打开
ai-docs/reviews-pr-<PR_NUMBER>/_summary.md
,确认未解决问题计数为
0
如果特定ID的线程解决失败,保持这些问题的未解决标记,上报具体的失败原因,不要声称已完成。

Output Contract

输出约定

Deliver:
  • One commit containing all remediation changes.
  • Per-issue technical disposition (
    VALID
    or
    INVALID
    ) recorded during triage.
  • Updated
    ai-docs/reviews-pr-<PR_NUMBER>/issues/*.md
    statuses.
  • Updated
    ai-docs/reviews-pr-<PR_NUMBER>/_summary.md
    counts/checklist.
  • Resolved review threads for addressed issues.
交付物:
  • 包含所有修复改动的单次提交。
  • 分类过程中记录的每个问题的技术处理结果(
    VALID
    INVALID
    )。
  • 状态已更新的
    ai-docs/reviews-pr-<PR_NUMBER>/issues/*.md
    文件。
  • 计数/检查清单已更新的
    ai-docs/reviews-pr-<PR_NUMBER>/_summary.md
    文件。
  • 已解决的已处理问题对应的审查线程。