pr-retro
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChinesePR Retro Skill
PR Retro Skill
Learn from PR outcomes by analyzing accept/reject patterns.
通过分析接受/拒绝模式,从PR结果中学习。
Overview
概述
After a PR is merged or rejected, analyze what worked and what didn't to
improve future contributions.
Output:
.agents/retros/YYYY-MM-DD-pr-{repo}-{outcome}.mdWhen to Use:
- After a PR is merged (capture success patterns)
- After a PR is rejected (understand why)
- After receiving significant review feedback
- Periodically to review contribution patterns
在PR被合并或拒绝后,分析哪些做法有效、哪些无效,以改进未来的贡献。
输出:
.agents/retros/YYYY-MM-DD-pr-{repo}-{outcome}.md适用场景:
- PR合并后(总结成功模式)
- PR被拒绝后(了解原因)
- 收到重要评审反馈后
- 定期回顾贡献模式
Workflow
工作流
1. PR Discovery -> Find the PR to analyze
2. Outcome Analysis -> Merged/rejected/changes requested
3. Feedback Extraction -> What did reviewers say?
4. Pattern Identification -> What worked/didn't
5. Lesson Extraction -> Reusable learnings
6. Output -> Write retro document1. PR 发现 -> 找到要分析的PR
2. 结果分析 -> 已合并/已拒绝/需要修改
3. 反馈提取 -> 评审者提出了哪些意见?
4. 模式识别 -> 哪些做法有效/无效
5. 经验提取 -> 可复用的经验
6. 输出 -> 撰写回顾文档Phase 1: PR Discovery
阶段1:PR 发现
bash
undefinedbash
undefinedIf PR number provided
如果提供了PR编号
gh pr view <number> --json state,reviews,comments,mergedAt,closedAt
gh pr view <number> --json state,reviews,comments,mergedAt,closedAt
Find recent PRs by you
查找你提交的近期PR
gh pr list --state all --author @me --limit 10
gh pr list --state all --author @me --limit 10
Find PRs to a specific repo
查找指定仓库的PR
gh pr list -R <owner/repo> --state all --author @me --limit 10
---gh pr list -R <owner/repo> --state all --author @me --limit 10
---Phase 2: Outcome Analysis
阶段2:结果分析
| Outcome | Meaning | Focus |
|---|---|---|
| Merged | Success | What worked? |
| Closed (not merged) | Rejected | Why? |
| Open (stale) | Ignored/abandoned | What went wrong? |
| Changes requested | Needs work | What feedback? |
bash
undefined| 结果 | 含义 | 关注重点 |
|---|---|---|
| 已合并 | 成功 | 哪些做法有效? |
| 已关闭(未合并) | 被拒绝 | 原因是什么? |
| 已打开(停滞) | 被忽略/已放弃 | 哪里出了问题? |
| 需要修改 | 有待完善 | 收到了哪些反馈? |
bash
undefinedGet PR outcome
获取PR结果
gh pr view <number> --json state,mergedAt,closedAt,reviews
---gh pr view <number> --json state,mergedAt,closedAt,reviews
---Phase 3: Feedback Extraction
阶段3:反馈提取
bash
undefinedbash
undefinedGet all review comments
获取所有评审评论
gh pr view <number> --json reviews --jq '.reviews[] | "(.author.login): (.body)"'
gh pr view <number> --json reviews --jq '.reviews[] | "(.author.login): (.body)"'
Get all comments
获取所有评论
gh api repos/<owner>/<repo>/pulls/<number>/comments --jq '.[].body'
gh api repos/<owner>/<repo>/pulls/<number>/comments --jq '.[].body'
Get requested changes
获取需要修改的请求
gh pr view <number> --json reviews --jq '.reviews[] | select(.state == "CHANGES_REQUESTED")'
undefinedgh pr view <number> --json reviews --jq '.reviews[] | select(.state == "CHANGES_REQUESTED")'
undefinedFeedback Categories
反馈分类
| Category | Examples |
|---|---|
| Style | Naming, formatting, conventions |
| Technical | Algorithm, architecture, patterns |
| Scope | Too big, scope creep, unrelated changes |
| Testing | Missing tests, coverage, edge cases |
| Documentation | Missing docs, unclear comments |
| Process | Wrong branch, missing sign-off |
| 分类 | 示例 |
|---|---|
| 风格 | 命名、格式、规范 |
| 技术 | 算法、架构、模式 |
| 范围 | 过大、范围蔓延、无关变更 |
| 测试 | 缺少测试、覆盖率、边缘案例 |
| 文档 | 缺少文档、注释不清晰 |
| 流程 | 分支错误、缺少签署 |
Phase 4: Pattern Identification
阶段4:模式识别
Success Patterns (If Merged)
成功模式(若已合并)
| What Worked | Evidence |
|---|---|
| Small, focused PR | < 5 files |
| Followed conventions | No style comments |
| Good tests | No "add tests" requests |
| Clear description | Quick approval |
| 有效做法 | 证据 |
|---|---|
| 小型、聚焦的PR | < 5个文件 |
| 遵循规范 | 无风格类评论 |
| 测试完善 | 无“添加测试”的要求 |
| 描述清晰 | 快速获得批准 |
Failure Patterns (If Rejected)
失败模式(若被拒绝)
| What Failed | Evidence |
|---|---|
| Too large | "Please split this PR" |
| Scope creep | "This is out of scope" |
| Missing tests | "Please add tests" |
| Wrong approach | "Consider using X instead" |
| 无效做法 | 证据 |
|---|---|
| PR过大 | “请拆分此PR” |
| 范围蔓延 | “此内容超出范围” |
| 缺少测试 | “请添加测试” |
| 方案错误 | “考虑使用X替代” |
Phase 5: Lesson Extraction
阶段5:经验提取
Lesson Template
经验模板
markdown
undefinedmarkdown
undefinedLesson: [Title]
经验:[标题]
Context: [When does this apply?]
Learning: [What did we learn?]
Action: [What to do differently?]
Evidence:
- PR #N: [quote or summary]
undefined场景: [适用于哪些情况?]
收获: [我们学到了什么?]
行动: [后续应做出哪些改变?]
证据:
- PR #N: [引用或摘要]
undefinedCommon Lessons
常见经验
| Lesson | Action |
|---|---|
| PR too large | Split PRs under 200 lines |
| Missing context | Add "## Context" section |
| Style mismatch | Run linter before PR |
| Missing tests | Add tests for new code |
| Slow review | Ping after 1 week |
| 经验 | 行动 |
|---|---|
| PR过大 | 将PR拆分至200行代码以内 |
| 缺少上下文 | 添加“## 上下文”章节 |
| 风格不符 | 提交PR前运行代码检查工具 |
| 缺少测试 | 为新增代码添加测试 |
| 评审缓慢 | 1周后提醒评审者 |
Phase 6: Output
阶段6:输出
Write to
.agents/retros/YYYY-MM-DD-pr-{repo}-{outcome}.mdmarkdown
undefined写入文件
.agents/retros/YYYY-MM-DD-pr-{repo}-{outcome}.mdmarkdown
undefinedPR Retro: {repo} #{number}
PR Retro: {repo} #{number}
Date: YYYY-MM-DD
PR: {url}
Outcome: Merged / Rejected / Stale
日期: YYYY-MM-DD
PR: {url}
结果: 已合并 / 已拒绝 / 停滞
Summary
摘要
{What was the PR about? What happened?}
{该PR的内容是什么?发生了什么?}
Timeline
时间线
| Date | Event |
|---|---|
| {date} | PR opened |
| {date} | First review |
| {date} | {outcome} |
| 日期 | 事件 |
|---|---|
| {date} | PR已提交 |
| {date} | 首次评审 |
| {date} | {结果} |
Feedback Analysis
反馈分析
Positive Feedback
正面反馈
- {quote}
- {引用内容}
Requested Changes
需要修改的请求
- {quote}
- {引用内容}
Rejection Reasons (if applicable)
拒绝原因(若适用)
- {quote}
- {引用内容}
Lessons Learned
学到的经验
Lesson 1: {title}
经验1:{标题}
Context: {when this applies}
Learning: {what we learned}
Action: {what to do differently}
场景: {适用于哪些情况}
收获: {我们学到了什么}
行动: {后续应做出哪些改变}
Updates to Process
流程更新
{Any changes to make to pr-prep, pr-plan, or other skills}
{对pr-prep、pr-plan或其他技能的任何修改}
Next Steps
下一步行动
{Future actions based on this retro}
---{基于本次回顾的未来行动}
---Anti-Patterns
反模式
| DON'T | DO INSTEAD |
|---|---|
| Skip retros on merged PRs | Learn from success too |
| Blame maintainers | Focus on what YOU can change |
| Generic lessons | Specific, actionable learnings |
| Skip rejected PRs | Most valuable learning source |
| 不要做 | 建议做法 |
|---|---|
| 跳过已合并PR的回顾 | 也要从成功中学习 |
| 指责维护者 | 专注于自身可改变的部分 |
| 泛泛而谈的经验 | 具体、可落地的总结 |
| 跳过被拒绝的PR | 这是最有价值的学习来源 |
Examples
示例
Learn From Rejected PR
从被拒绝的PR中学习
User says: "Run a retro on why this PR was rejected."
What happens:
- Analyze reviewer feedback and timeline.
- Identify preventable process and scope issues.
- Capture reusable lessons for future PRs.
用户指令: “运行回顾,分析此PR被拒绝的原因。”
执行流程:
- 分析评审反馈和时间线。
- 识别可避免的流程和范围问题。
- 记录可复用的经验,用于未来的PR。
Learn From Successful Merge
从成功合并的PR中学习
User says: "Extract what worked from this merged PR."
What happens:
- Identify patterns that sped review/approval.
- Distill actionable playbook updates.
- Save lessons for future contribution flows.
用户指令: 提取此合并PR中的有效做法。
执行流程:
- 识别加速评审/批准的模式。
- 提炼可落地的流程更新内容。
- 保存经验,用于未来的贡献流程。
Troubleshooting
问题排查
| Problem | Cause | Solution |
|---|---|---|
| Retro is generic | Feedback not tied to evidence | Cite specific comments/decisions and outcomes |
| No clear lesson extracted | Analysis stayed descriptive | Convert observations into behavior changes |
| Maintainer signal is mixed | Contradictory review comments | Separate hard blockers from preference feedback |
| Process changes not adopted | Lessons not operationalized | Add explicit updates to prep/plan/validate workflow |
| 问题 | 原因 | 解决方案 |
|---|---|---|
| 回顾内容泛泛而谈 | 反馈未关联具体证据 | 引用具体评论/决策和结果 |
| 未提炼出清晰的经验 | 分析停留在描述层面 | 将观察结果转化为行为改变 |
| 维护者意见不一致 | 评审评论相互矛盾 | 区分硬性阻塞问题与偏好性反馈 |
| 流程变更未被采纳 | 经验未落地 | 在准备/规划/验证工作流中添加明确的更新内容 |