npx skills add https://github.com/boshu2/agentops --skill pr-prep系统化的 PR 准备,验证测试并生成高质量的 PR 正文。
通过分析目标仓库的惯例、git 历史、测试覆盖率,并生成格式正确的 PR 正文,来准备贡献。
使用时机:
不应使用的时机:
-1. 先前工作检查 -> 阻塞性检查:最终检查是否存在冲突的 PR
0. 隔离性检查 -> 如果 PR 混合了不相关的更改,则阻塞
1. 上下文发现 -> 理解目标仓库的惯例
2. Git 考古学 -> 分析提交模式、PR 历史
3. 预检检查 -> 运行测试、代码检查、构建
4. 变更分析 -> 总结更改了什么以及为什么
5. PR 正文生成 -> 创建结构化的 PR 描述
6. 用户审核关卡 -> 停止。用户必须在提交前批准。
7. 提交 -> 仅在获得用户明确批准后
关键:首先运行此检查。如果 PR 混合了不相关的更改,请不要继续。
# 从分支提取提交类型前缀
git log --oneline main..HEAD | sed 's/^[^ ]* //' | grep -oE '^[a-z]+(\([^)]+\))?:' | sort -u
规则:如果存在多个提交类型前缀,则 PR 混合了关注点。
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
# 列出所有相对于 main 分支更改的文件
git diff --name-only main..HEAD
# 按目录分组
git diff --name-only main..HEAD | cut -d'/' -f1-2 | sort -u
| 检查项 | 通过标准 |
|---|---|
| 单一提交类型 | 所有提交共享相同的前缀 |
| 主题性文件 | 所有更改的文件都与 PR 范围相关 |
| 不与 main 分支重叠 | 更改尚未被合并 |
| 原子化范围 | 可以用一句话解释清楚 |
如果隔离性检查失败,请勿继续。
未经用户明确批准,切勿提交 PR。
在生成 PR 正文(阶段 5)之后,必须:
gh pr create 之前,等待明确的批准# 将 PR 正文写入文件
cat > /tmp/pr-body.md << 'EOF'
<生成的 PR 正文>
EOF
# 展示给用户
cat /tmp/pr-body.md
# 询问 - 未得到回答前不要继续
echo "审核完成。提交此 PR 吗?[y/N]"
# Go 项目
go build ./...
go vet ./...
go test ./... -v -count=1
# Node 项目
npm run build
npm test
# Python 项目
pytest -v
## 摘要
简要描述更改了什么以及为什么。1-3 句话。
以动作动词开头(添加、修复、更新、重构)。
## 变更内容
修改内容的技术细节。
## 测试计划
- [x] `go build ./...` 通过
- [x] `go test ./...` 通过
- [x] 手动测试:<测试的具体场景>
修复 #NNN
关键惯例:
[x](你在 PR 前已运行过它们)修复 #NNN 放在末尾# 使用审核过的正文创建 PR
gh pr create --title "type(scope): brief description" \
--body "$(cat /tmp/pr-body.md)" \
--base main
记住:此命令应仅在用户明确批准后运行。
| 不要做 | 应该这样做 |
|---|---|
| 未经批准就提交 | 始终为用户审核而停止 |
| 跳过隔离性检查 | 首先运行阶段 0 |
| 将代码检查修复捆绑到功能 PR 中 | 代码检查修复应有自己的 PR |
| 巨大的 PR | 拆分成逻辑块 |
| 模糊的 PR 正文 | 包含上下文的详细摘要 |
| 跳过预检 | 始终在本地运行测试 |
用户说: "准备将此分支用于 PR 提交。"
会发生什么:
用户说: "生成一个包含清晰验证步骤的高质量 PR 描述。"
会发生什么:
| 问题 | 原因 | 解决方案 |
|---|---|---|
| PR 正文质量差 | 缺少来自提交/测试的上下文 | 重新运行证据收集并扩展摘要 |
| 提交被阻止 | 强制性审核关卡未通过 | 在运行 gh pr create 前获取明确的用户批准 |
| 测试计划不完整 | 未捕获命令/结果 | 明确添加已执行的检查及其结果 |
| 标题/正文不匹配 | 编辑过程中范围漂移 | 根据最新的分支差异和约束重新生成 |
每周安装次数
130
仓库
GitHub 星标数
198
首次出现
2026年2月18日
安全审计
安装于
opencode130
github-copilot126
codex126
kimi-cli126
gemini-cli126
amp126
Systematic PR preparation that validates tests and generates high-quality PR bodies.
Prepares contributions by analyzing the target repo's conventions, git history, test coverage, and generating properly-formatted PR bodies.
When to Use :
When NOT to Use :
-1. Prior Work Check -> BLOCKING: Final check for competing PRs
0. Isolation Check -> BLOCK if PR mixes unrelated changes
1. Context Discovery -> Understand target repo conventions
2. Git Archaeology -> Analyze commit patterns, PR history
3. Pre-Flight Checks -> Run tests, linting, build
4. Change Analysis -> Summarize what changed and why
5. PR Body Generation -> Create structured PR description
6. USER REVIEW GATE -> STOP. User must approve before submission.
7. Submission -> Only after explicit user approval
CRITICAL : Run this FIRST. Do not proceed if PR mixes unrelated changes.
# Extract commit type prefixes from branch
git log --oneline main..HEAD | sed 's/^[^ ]* //' | grep -oE '^[a-z]+(\([^)]+\))?:' | sort -u
Rule : If more than one commit type prefix exists, the PR is mixing concerns.
# List all files changed vs main
git diff --name-only main..HEAD
# Group by directory
git diff --name-only main..HEAD | cut -d'/' -f1-2 | sort -u
| Check | Pass Criteria |
|---|---|
| Single commit type | All commits share same prefix |
| Thematic files | All changed files relate to PR scope |
| No main overlap | Changes not already merged |
| Atomic scope | Can explain in one sentence |
DO NOT PROCEED IF ISOLATION CHECK FAILS.
NEVER submit a PR without explicit user approval.
After generating the PR body (Phase 5), ALWAYS:
gh pr create# Write PR body to file
cat > /tmp/pr-body.md << 'EOF'
<generated PR body>
EOF
# Show user
cat /tmp/pr-body.md
# ASK - do not proceed without answer
echo "Review complete. Submit this PR? [y/N]"
# Go projects
go build ./...
go vet ./...
go test ./... -v -count=1
# Node projects
npm run build
npm test
# Python projects
pytest -v
## Summary
Brief description of WHAT changed and WHY. 1-3 sentences.
Start with action verb (Add, Fix, Update, Refactor).
## Changes
Technical details of what was modified.
## Test plan
- [x] `go build ./...` passes
- [x] `go test ./...` passes
- [x] Manual: <specific scenario tested>
Fixes #NNN
Key conventions:
[x] (you ran them before PR)Fixes #NNN goes at the end# Create PR with reviewed body
gh pr create --title "type(scope): brief description" \
--body "$(cat /tmp/pr-body.md)" \
--base main
Remember : This command should ONLY run after user explicitly approves.
| DON'T | DO INSTEAD |
|---|---|
| Submit without approval | ALWAYS stop for user review |
| Skip isolation check | Run Phase 0 FIRST |
| Bundle lint fixes into feature PRs | Lint fixes get their own PR |
| Giant PRs | Split into logical chunks |
| Vague PR body | Detailed summary with context |
| Skip pre-flight | Always run tests locally |
User says: "Prepare this branch for PR submission."
What happens:
User says: "Generate a high-quality PR description with clear verification steps."
What happens:
| Problem | Cause | Solution |
|---|---|---|
| PR body is weak | Missing context from commits/tests | Re-run evidence collection and expand summary |
| Submission blocked | Mandatory review gate not passed | Get explicit user approval before gh pr create |
| Test plan incomplete | Commands/results not captured | Add executed checks and outcomes explicitly |
| Title/body mismatch | Scope drift during edits | Regenerate from latest branch diff and constraints |
Weekly Installs
130
Repository
GitHub Stars
198
First Seen
Feb 18, 2026
Security Audits
Gen Agent Trust HubPassSocketFailSnykWarn
Installed on
opencode130
github-copilot126
codex126
kimi-cli126
gemini-cli126
amp126
agent-browser 浏览器自动化工具 - Vercel Labs 命令行网页操作与测试
150,000 周安装