pre-pr-review
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChinesePre-PR Review
PR前审查
Review the full branch before opening or updating a PR. This skill sees the branch as one coherent change, then adds checks that a single-diff review cannot catch. If the working tree is dirty, it also reviews the local changes against the same rubric — the operator is one step away from committing them into the PR, so they get reviewed too.
在创建或更新PR前审查完整分支。该工具将分支视为一个连贯的变更,进而发现单次差异审查无法捕捉到的问题。如果工作区存在未提交内容,它还会按照相同准则审查本地更改——因为操作者即将把这些内容提交到PR中,所以也需要进行审查。
Source of Truth
事实依据
Use for the shared per-diff rubric: severity, categories, fix policy, and language-agnostic checklist.
references/review-rubric.md使用作为通用的逐差异审查准则,包括严重程度、分类、修复策略以及与语言无关的检查清单。
references/review-rubric.mdWhen to Use
使用场景
- reviews staged, unstaged, and untracked local changes only.
pre-commit-review - reviews committed branch state (
pre-pr-review) plus branch-level history/intent. If the tree is dirty, it folds local changes into the same review.<base>..HEAD - Run it before opening a PR, or before updating a PR after meaningful branch rewrites.
- 仅审查暂存、未暂存和未跟踪的本地更改。
pre-commit-review - 审查已提交的分支状态(
pre-pr-review)以及分支级别的历史/意图。如果工作区存在未提交内容,它会将本地更改纳入同一审查流程。<base>..HEAD - 在创建PR前,或在对分支进行重大改写后更新PR前运行该工具。
Workflow
工作流程
- Resolve the base branch:
.turkit.yaml → base_branchgit symbolic-ref refs/remotes/origin/HEAD- fallback
main
- Inspect . Set
git status --shortif anything is staged, unstaged, or untracked. Do not redirect the operator toLOCAL_DIRTY = true— they invokedpre-commit-reviewdeliberately. Continue.pre-pr-review - Count commits with . If > 20, warn and ask whether to proceed.
git rev-list --count <base>..HEAD - Gather:
git log --oneline <base>..HEADgit log --stat <base>..HEADgit diff <base>..HEADgit diff <base>..HEAD --name-only- only when a cross-commit finding needs deeper inspection
git show <hash> - If : also
LOCAL_DIRTY,git diff --cached, andgit diff. Treat the union of staged + unstaged + untracked content as the Local scope; the committedgit ls-files --others --exclude-standarddiff is the Branch scope.<base>..HEAD
- Load project rules before judging:
- Read if present.
.turkit.yaml - If it defines , read the relevant listed docs.
rules.docs - Otherwise read relevant defaults when present: ,
CLAUDE.md, andAGENTS.md.docs/conventions/*.md
- Read
- Run the project's lint command (, fallback per
.turkit.yaml → commands.lint). If unavailable, continue and report it.references/build-tool-detection.md - Walk the shared rubric against the full branch diff, then apply any loaded
project rules that are relevant to the branch. If , walk the same rubric against the Local scope (changed hunks for staged/unstaged, full file for untracked). Label every finding with its scope (
LOCAL_DIRTYorBranch).Local - Walk the branch-level checklist and use the branch output sections in . The checklist applies to the Branch scope; the Local scope is judged on per-diff rubric only.
references/branch-review.md - Apply only the shared rubric's Auto-fix bucket. Auto-fixes land unstaged on current ; do not create/amend commits or rewrite history.
HEAD - Re-run lint. If auto-fixes landed, the verdict cannot be ; the operator must commit/amend and re-run this review.
Ready for PR - Report using the output format below.
- 确定基准分支:
.turkit.yaml → base_branchgit symbolic-ref refs/remotes/origin/HEAD- 默认回退为
main
- 检查输出。如果存在暂存、未暂存或未跟踪内容,设置
git status --short。不要引导操作者使用LOCAL_DIRTY = true——他们是特意调用pre-commit-review的,继续执行流程。pre-pr-review - 使用统计提交数量。如果超过20个,发出警告并询问是否继续。
git rev-list --count <base>..HEAD - 收集以下信息:
git log --oneline <base>..HEADgit log --stat <base>..HEADgit diff <base>..HEADgit diff <base>..HEAD --name-only- 仅当跨提交的问题需要深入检查时,使用
git show <hash> - 如果为true:同时收集
LOCAL_DIRTY、git diff --cached和git diff的输出。将暂存+未暂存+未跟踪内容的合集视为本地范围;已提交的git ls-files --others --exclude-standard差异视为分支范围。<base>..HEAD
- 在评估前加载项目规则:
- 如果存在文件则读取它。
.turkit.yaml - 如果文件中定义了,读取列出的相关文档。
rules.docs - 否则读取相关默认文档(如果存在):、
CLAUDE.md以及AGENTS.md。docs/conventions/*.md
- 如果存在
- 运行项目的lint命令(,默认规则参考
.turkit.yaml → commands.lint)。如果无法运行,继续流程并报告该情况。references/build-tool-detection.md - 针对完整分支差异执行通用审查准则,然后应用所有与该分支相关的已加载项目规则。如果为true,针对本地范围执行相同的审查准则(暂存/未暂存内容检查变更块,未跟踪内容检查完整文件)。为每个问题标记其所属范围(
LOCAL_DIRTY或Branch)。Local - 执行分支级检查清单,并使用中的分支输出部分。该检查清单适用于分支范围;本地范围仅按照逐差异准则评估。
references/branch-review.md - 仅应用通用审查准则中的自动修复项。自动修复将应用于当前的未暂存状态;不要创建/修改提交或重写历史。
HEAD - 重新运行lint。如果应用了自动修复,则审查结论不能为;操作者必须提交/修改并重新运行该审查。
Ready for PR - 按照以下输出格式生成报告。
Branch-Level Checklist
分支级检查清单
Walk the branch-level checklist and use the branch output sections in . It owns the checklist (B1–B4) and the branch output sections (Branch summary, Per-Commit, Cross-Commit, Branch-Level, Verdict). The checklist applies to the Branch scope; the Local scope is judged on per-diff rubric only.
references/branch-review.md执行分支级检查清单,并使用中的分支输出部分。该文档包含检查清单(B1–B4)和分支输出章节(分支摘要、逐提交、跨提交、分支级别、结论)。检查清单适用于分支范围;本地范围仅按照逐差异准则评估。
references/branch-review.mdOutput Format
输出格式
The Branch summary, Per-Commit, Cross-Commit, Branch-Level, and Verdict sections live in. The per-diff sections below are specific to this skill.references/branch-review.md
markdown
undefined分支摘要、逐提交、跨提交、分支级别和结论章节位于中。以下逐差异章节为该工具特有。references/branch-review.md
markdown
undefinedMechanical Pre-pass (lint)
机械预检查(lint)
- Ran:
<exact command> - Findings kept: N
- Findings dropped as false positives: N — list with reasons
- Notable rules triggered: short list with file:line
- 已运行:<具体命令>
- 保留的问题:N
- 标记为误报的问题:N — 列出问题及原因
- 触发的重要规则:简短列表,包含文件:行号
Local (uncommitted)
本地(未提交)
Only present when the working tree was dirty. Findings against the per-diff rubric on staged + unstaged + untracked.
- [P0|P1] [Category] [Local] [file:line] What and why
- Or: "No findings — local diff is clean and ready to commit."
仅当工作区存在未提交内容时显示。针对暂存+未暂存+未跟踪内容,按照逐差异准则发现的问题。
- [P0|P1] [分类] [Local] [文件:行号] 问题描述及原因
- 或:“无问题——本地差异已清理,可提交。”
Fixes Applied
已应用的修复
Auto-fixes from the shared rubric. All landed unstaged on current HEAD.
- [Category] [file:line] What changed
来自通用审查准则的自动修复项。所有修复均应用于当前HEAD的未暂存状态。
- [分类] [文件:行号] 变更内容
Required Changes
必需变更
- [P0|P1] [Category] [file:line | commit:<hash>] What must change and why it cannot be auto-fixed
- Suggested rebase plan, if history rewrite is required (do not execute it)
- [P0|P1] [分类] [文件:行号 | commit:<哈希值>] 必须修改的内容及无法自动修复的原因
- 建议的变基方案(如果需要重写历史)——不要执行该操作
Blocking Issues
阻塞性问题
- [P0|P1] [Category] [file:line | commit:<hash>] Rare issue not covered above
- [P0|P1] [分类] [文件:行号 | commit:<哈希值>] 上述未涵盖的罕见问题
Suggested Improvements
建议改进项
- [Category] Improvement and expected benefit
- [分类] 改进建议及预期收益
Positive Signals
积极信号
- Short bullet only when it reduces review ambiguity
- 仅在减少审查歧义时使用简短项目符号
Verification
验证
- Ran: exact commands
- Residual failures, if any
- Skipped: relevant checks not run and why
- 已运行:具体命令
- 剩余失败项(如有)
- 已跳过:未执行的相关检查及原因
Residual Risks
剩余风险
- Remaining uncertainty
undefined- 仍存在的不确定性
undefinedGuardrails
约束规则
- Never stage, commit, amend, rebase, reset, push, force-push, or rewrite history.
- Never edit outside branch diff scope unless an in-scope auto-fix requires a sibling/shared file.
- Branch history changes are recommendations only.
- Apply for operator-facing language/style.
references/output-preferences.md
- 绝不要暂存、提交、修改、变基、重置、推送、强制推送或重写历史。
- 除非范围内的自动修复需要修改关联/共享文件,否则不要编辑分支差异范围外的内容。
- 分支历史变更仅作为建议。
- 面向操作者的语言/风格需遵循。
references/output-preferences.md