pr-hygiene
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChinesePR Hygiene
PR 规范
Turn the current work into a PR a human can review in one pass.
将当前工作转化为便于人工一次评审通过的PR。
Before opening
创建前检查
- Branch contains one logical change (or clearly labeled stacked commits)
- No leftover ,
console.log,debugger, commented-out blocks you addedTODO: temp - No unrelated formatting-only churn
- Secrets, , and local-only files are not staged
.env - Diff matches the stated goal — nothing "extra helpful"
- 分支仅包含一项逻辑变更(或带有清晰标签的堆叠提交)
- 无遗留的、
console.log、debugger以及你添加的注释代码块TODO: temp - 无无关的仅格式变更内容
- 未暂存密钥、及仅本地使用的文件
.env - 代码变更与既定目标一致——无“额外帮助”的冗余内容
Description template
描述模板
Use this structure (adapt section names to the host: GitHub/GitLab):
markdown
undefined使用以下结构(可根据托管平台调整章节名称:GitHub/GitLab):
markdown
undefinedSummary
概述
<1–3 bullets: what and why>
<1–3条要点:内容及原因>
Test plan
测试计划
- <how you verified>
- <edge case worth checking>
- <验证方式>
- <值得检查的边缘情况>
Notes
说明
<risks, follow-ups, screenshots if UI>
undefined<风险、后续工作、若涉及UI则附截图>
undefinedCommit / PR title
提交/PR标题
- Imperative, specific:
fix checkout: reject expired discount codes - Not: ,
update stuff,fix,WIPaddress comments
- 使用命令式、具体表述:
fix checkout: reject expired discount codes - 避免:、
update stuff、fix、WIPaddress comments
Reviewer empathy
评审者友好提示
Call out:
- Files that look scary but are mechanical (renames, generated)
- Behavior that changed for callers/API consumers
- Anything you are unsure about
需特别指出:
- 看似复杂但实际是机械性操作的文件(重命名、自动生成)
- 对调用方/API消费者产生变更的行为
- 任何你不确定的内容
Anti-patterns
反模式
- NEVER mix refactor + feature + dependency bump in one PR unless required
- NEVER force-push shared branches without warning
- NEVER open a PR with "tests TBD" and no plan
- NEVER bury breaking changes in the middle of the description
- 除非必要,绝不要在一个PR中混合重构、功能开发和依赖版本升级
- 绝不要在未提前告知的情况下强制推送共享分支
- 绝不要创建带有“测试待完成”且无计划的PR
- 绝不要将破坏性变更隐藏在描述的中间部分
If asked to open the PR
若被要求创建PR
- Summarize the diff in your own words first
- Draft title + body with the template
- List residual risks in one short section
- 先用自己的话总结代码变更内容
- 使用模板草拟标题和正文
- 在一个简短章节中列出剩余风险