pr-retro

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

PR 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}.md
When 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 document

1.  PR 发现    -> 找到要分析的PR
2.  结果分析 -> 已合并/已拒绝/需要修改
3.  反馈提取 -> 评审者提出了哪些意见?
4.  模式识别 -> 哪些做法有效/无效
5.  经验提取 -> 可复用的经验
6.  输出 -> 撰写回顾文档

Phase 1: PR Discovery

阶段1:PR 发现

bash
undefined
bash
undefined

If 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:结果分析

OutcomeMeaningFocus
MergedSuccessWhat worked?
Closed (not merged)RejectedWhy?
Open (stale)Ignored/abandonedWhat went wrong?
Changes requestedNeeds workWhat feedback?
bash
undefined
结果含义关注重点
已合并成功哪些做法有效?
已关闭(未合并)被拒绝原因是什么?
已打开(停滞)被忽略/已放弃哪里出了问题?
需要修改有待完善收到了哪些反馈?
bash
undefined

Get 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
undefined
bash
undefined

Get 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")'
undefined
gh pr view <number> --json reviews --jq '.reviews[] | select(.state == "CHANGES_REQUESTED")'
undefined

Feedback Categories

反馈分类

CategoryExamples
StyleNaming, formatting, conventions
TechnicalAlgorithm, architecture, patterns
ScopeToo big, scope creep, unrelated changes
TestingMissing tests, coverage, edge cases
DocumentationMissing docs, unclear comments
ProcessWrong branch, missing sign-off

分类示例
风格命名、格式、规范
技术算法、架构、模式
范围过大、范围蔓延、无关变更
测试缺少测试、覆盖率、边缘案例
文档缺少文档、注释不清晰
流程分支错误、缺少签署

Phase 4: Pattern Identification

阶段4:模式识别

Success Patterns (If Merged)

成功模式(若已合并)

What WorkedEvidence
Small, focused PR< 5 files
Followed conventionsNo style comments
Good testsNo "add tests" requests
Clear descriptionQuick approval
有效做法证据
小型、聚焦的PR< 5个文件
遵循规范无风格类评论
测试完善无“添加测试”的要求
描述清晰快速获得批准

Failure Patterns (If Rejected)

失败模式(若被拒绝)

What FailedEvidence
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
undefined
markdown
undefined

Lesson: [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: [引用或摘要]
undefined

Common Lessons

常见经验

LessonAction
PR too largeSplit PRs under 200 lines
Missing contextAdd "## Context" section
Style mismatchRun linter before PR
Missing testsAdd tests for new code
Slow reviewPing after 1 week

经验行动
PR过大将PR拆分至200行代码以内
缺少上下文添加“## 上下文”章节
风格不符提交PR前运行代码检查工具
缺少测试为新增代码添加测试
评审缓慢1周后提醒评审者

Phase 6: Output

阶段6:输出

Write to
.agents/retros/YYYY-MM-DD-pr-{repo}-{outcome}.md
markdown
undefined
写入文件
.agents/retros/YYYY-MM-DD-pr-{repo}-{outcome}.md
markdown
undefined

PR 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

时间线

DateEvent
{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'TDO INSTEAD
Skip retros on merged PRsLearn from success too
Blame maintainersFocus on what YOU can change
Generic lessonsSpecific, actionable learnings
Skip rejected PRsMost valuable learning source
不要做建议做法
跳过已合并PR的回顾也要从成功中学习
指责维护者专注于自身可改变的部分
泛泛而谈的经验具体、可落地的总结
跳过被拒绝的PR这是最有价值的学习来源

Examples

示例

Learn From Rejected PR

从被拒绝的PR中学习

User says: "Run a retro on why this PR was rejected."
What happens:
  1. Analyze reviewer feedback and timeline.
  2. Identify preventable process and scope issues.
  3. Capture reusable lessons for future PRs.
用户指令: “运行回顾,分析此PR被拒绝的原因。”
执行流程:
  1. 分析评审反馈和时间线。
  2. 识别可避免的流程和范围问题。
  3. 记录可复用的经验,用于未来的PR。

Learn From Successful Merge

从成功合并的PR中学习

User says: "Extract what worked from this merged PR."
What happens:
  1. Identify patterns that sped review/approval.
  2. Distill actionable playbook updates.
  3. Save lessons for future contribution flows.
用户指令: 提取此合并PR中的有效做法。
执行流程:
  1. 识别加速评审/批准的模式。
  2. 提炼可落地的流程更新内容。
  3. 保存经验,用于未来的贡献流程。

Troubleshooting

问题排查

ProblemCauseSolution
Retro is genericFeedback not tied to evidenceCite specific comments/decisions and outcomes
No clear lesson extractedAnalysis stayed descriptiveConvert observations into behavior changes
Maintainer signal is mixedContradictory review commentsSeparate hard blockers from preference feedback
Process changes not adoptedLessons not operationalizedAdd explicit updates to prep/plan/validate workflow
问题原因解决方案
回顾内容泛泛而谈反馈未关联具体证据引用具体评论/决策和结果
未提炼出清晰的经验分析停留在描述层面将观察结果转化为行为改变
维护者意见不一致评审评论相互矛盾区分硬性阻塞问题与偏好性反馈
流程变更未被采纳经验未落地在准备/规划/验证工作流中添加明确的更新内容