关于 pr-plan
pr-plan 是一项将 `$pr-research` 调研结果转化为开源贡献计划的技能,供贡献者在编码前明确目标、验收标准、风险和实施策略。
主要功能
- 01将调研转为贡献计划
- 02界定范围与目标区域
- 03制定验收标准
- 04评估风险和实施策略
- 05生成带日期的计划文件
适用场景
- 01完成仓库调研后规划开源贡献
- 02编码前缩小拟议改动范围
- 03将过大的贡献拆分为多个阶段
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ boshu2/ agentops --skill pr-plan安装后在 Claude Code 中输入/pr-plan确认已加载。
附带文件scripts/validate.sh
详细介绍
PR 计划技能
为开源贡献制定战略计划。
概述
创建一份衔接调研与实现的贡献计划。接收
$pr-research 的输出并生成一份可执行的计划。
输出: .agents/plans/YYYY-MM-DD-pr-plan-{repo-slug}.md
适用场景:
- 完成
$pr-research后 - 规划贡献策略
- 开始实现之前
不适用场景:
- 尚未调研代码仓库
- 微小贡献(修正拼写错误)
- 内部项目规划(使用
$plan)
工作流
0. Input Discovery -> Find/load pr-research artifact
1. Scope Definition -> What exactly to contribute
2. Target Selection -> Which issues/areas to address
3. Criteria Definition -> Acceptance criteria from research
4. Risk Assessment -> What could go wrong
5. Strategy Formation -> Implementation approach
6. Output -> Write plan artifact
阶段 1:定义范围
范围问题
| 问题 | 重要性 |
|---|---|
| 具体要实现什么功能? | 明确交付内容 |
| 涉及哪些文件/软件包? | 限定影响范围 |
| 明确不包含哪些内容? | 防止范围蔓延 |
| 是一个 PR 还是一系列 PR? | 明确预期 |
范围模板
## Scope
**Contribution**: [1-2 sentences describing the change]
**Affected Areas**:
- `path/to/file.go` - [what changes]
**Out of Scope**:
- [Related but excluded work]
阶段 3:验收标准
从维护者的角度定义成功标准:
## Acceptance Criteria
### Code Quality
- [ ] Follows project coding style
- [ ] Passes existing tests
- [ ] Adds tests for new functionality
- [ ] No linting warnings
### PR Requirements
- [ ] Title follows convention
- [ ] Body uses project template
- [ ] Size within acceptable range
- [ ] Single logical change
### Project-Specific
- [ ] [Any project-specific requirements from research]
阶段 4:风险评估
| 风险 | 可能性 | 影响 | 缓解措施 |
|---|---|---|---|
| PR 审核耗时超过 2 周 | 中 | 中 | 从小处着手,及时响应 |
| 审核期间范围扩大 | 中 | 高 | 提前明确界定范围 |
| 发现破坏性变更 | 低 | 高 | 针对多个版本进行测试 |
阶段 5:实现策略
## Implementation Strategy
### Approach
1. **Setup**: Fork repo, configure dev environment
2. **Understand**: Read existing code in affected area
3. **Implement**: Make changes following project patterns
4. **Test**: Run existing tests + add new tests
5. **Document**: Update any affected documentation
6. **Submit**: Create PR following project conventions
### Pre-Implementation Checklist
- [ ] Fork created and up-to-date with upstream
- [ ] Dev environment working
- [ ] Issue claimed or comment posted
- [ ] Recent repo activity reviewed
输出模板
写入 .agents/plans/YYYY-MM-DD-pr-plan-{repo-slug}.md
# PR Plan: {repo-name}
## Executive Summary
{2-3 sentences: what you're contributing, why, expected outcome}
## Scope
**Contribution**: {description}
**Affected Areas**: [list]
**Out of Scope**: [list]
## Target
**Primary Issue**: #{N} - {title}
## Acceptance Criteria
[checklist]
## Risk Assessment
[table]
## Implementation Strategy
[numbered steps]
## Next Steps
1. Claim/comment on target issue
2. Fork and set up development environment
3. Implement following strategy
4. Run `$pr-prep` when ready
工作流集成
$pr-research <repo> -> $pr-plan <research> -> implement -> $pr-prep
示例
规划一项范围明确的外部贡献
用户说:“根据我的 PR 调研文档创建一份贡献计划。”
执行内容:
- 提取已认可的惯例和约束。
- 明确范围边界和验收标准。
- 制定包含风险评估的实现策略。
编码前收紧范围
用户说:“检查这份 PR 计划是否过大,不适合一次提交。”
执行内容:
- 将拟议变更与历史 PR 的规模模式进行比较。
- 将过大的范围拆分为分阶段贡献。
- 输出修订后的计划和后续步骤清单。
故障排除
| 问题 | 原因 | 解决方案 |
|---|---|---|
| 计划的验收标准含糊 | 标准不可衡量 | 将标准转化为具体的行为检查 |
| 范围过宽 | 混杂了多个关注点 | 按用户可见的变更或子系统边界拆分 |
| 风险部分不充分 | 缺少故障模式分析 | 明确补充集成、审核和回滚风险 |
| 计划与代码仓库规范冲突 | 调研文档不完整 | 重新运行 $pr-research 并更新约束 |
评论
支持 Markdown