create-pr
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCreate PR — pre-pull-request validation orchestration
创建PR — 拉取请求前的验证编排
Orchestrates every check a PR needs before it's opened. Does NOT open the PR — that's a separate action the user takes after this skill reports "ready."
协调PR打开前所需的所有检查。不会打开PR —— 此技能报告“就绪”后,由用户执行单独的打开PR操作。
Before You Start
开始之前
- — "Quick Reference" section lists the project's test, lint, and build commands.
CLAUDE.md - — tells you what CI will run. The local gates should mirror these.
.github/workflows/ - ,
skills/workflow/merge-main/SKILL.md— this skill delegates to them.skills/workflow/review-diff/SKILL.md
- —— “快速参考”部分列出了项目的测试、Lint和构建命令。
CLAUDE.md - —— 显示CI将运行的任务。本地检查应与这些任务保持一致。
.github/workflows/ - 、
skills/workflow/merge-main/SKILL.md—— 此技能会委托给这些技能。skills/workflow/review-diff/SKILL.md
Step 1: commit current work
步骤1:提交当前工作
Same discipline as step 1 — uncommitted changes block the rest.
merge-mainbash
git status
git diff
git add <specific-files>
git commit -m "type(scope): concise message"Follow the project's commit convention (check root or ). Common patterns: with types from .
CLAUDE.md.github/type(scope): subjectfix | feat | test | doc | chore | refactorKeep commits focused — one logical change per commit. Imperative mood ("Add X", not "Added X").
与技能的步骤1要求相同 —— 未提交的更改会阻碍后续操作。
merge-mainbash
git status
git diff
git add <specific-files>
git commit -m "type(scope): concise message"遵循项目的提交规范(查看根目录下的或)。常见格式:,其中type可选值包括。
CLAUDE.md.github/type(scope): subjectfix | feat | test | doc | chore | refactor保持提交聚焦 —— 每次提交对应一个逻辑变更。使用祈使语气(如“Add X”而非“Added X”)。
Step 2: sync with main
步骤2:与主分支同步
Delegate to the skill. It commits any stragglers, fetches, merges, resolves conflicts, and validates post-merge. After it returns, the branch is up to date.
merge-main委托给技能。它会提交所有未提交的变更、拉取远程代码、合并分支、解决冲突并验证合并后的状态。返回后,当前分支将与主分支保持同步。
merge-mainStep 3: format and lint
步骤3:格式化与Lint检查
Run the project's format + lint command (from root Quick Reference). Common patterns:
CLAUDE.mdbash
undefined运行项目的格式化+Lint命令(来自根目录的快速参考)。常见示例:
CLAUDE.mdbash
undefinedpick the one your project uses; these are illustrative
选择项目使用的命令;以下仅为示例
make pr-ready
pnpm lint:fix
ruff format . && ruff check --fix .
cargo fmt && cargo clippy --fix --allow-dirty
Fix any remaining errors until the command exits clean. Re-run after fixes — lint rules sometimes interact.make pr-ready
pnpm lint:fix
ruff format . && ruff check --fix .
cargo fmt && cargo clippy --fix --allow-dirty
修复所有剩余错误,直到命令执行成功。修复后重新运行 —— Lint规则有时会相互影响。Step 4: run tests
步骤4:运行测试
Run the project's test command, scoped to the affected paths when the project supports it:
bash
undefined运行项目的测试命令,若项目支持,可限定在受影响的路径范围内:
bash
undefinedpick the project's pattern
选择项目使用的格式
make test
pnpm test
pytest tests/
cargo test
**Every test must pass.** Never disable or skip a test to "get to green." Fix root causes.make test
pnpm test
pytest tests/
cargo test
**所有测试必须通过**。绝不能为了“通过测试”而禁用或跳过测试。需修复根本原因。Step 5: review changes
步骤5:审查变更
Delegate to for a senior-level review against the project's conventions. Fix every Critical and Important finding. Re-run step 3 (format + lint) and step 4 (tests) for any scopes touched while fixing.
review-diff委托给技能,按照项目规范进行资深级别的审查。修复所有**Critical(严重)和Important(重要)**问题。修复过程中涉及的代码范围,需重新运行步骤3(格式化+Lint)和步骤4(测试)。
review-diffStep 6: update documentation
步骤6:更新文档
If the changes touched:
- API contracts, schemas, or public behavior — update the relevant docs (,
docs/, OpenAPI specs, etc.). Delegate toREADME.mdif the project has multiple doc locations.update-doc - Architecture-level decisions — an ADR may be required. Delegate to .
document-decision - -level invariants — if you discovered a new gotcha while implementing, add it to
CLAUDE.mdunder Things to Know.CLAUDE.md
若变更涉及以下内容:
- API契约、Schema或公开行为 —— 更新相关文档(、
docs/、OpenAPI规范等)。若项目有多个文档位置,可委托给README.md技能。update-doc - 架构层面的决策 —— 可能需要编写ADR(架构决策记录)。委托给技能。
document-decision - 中的核心规则 —— 若在实现过程中发现新的注意事项,将其添加到
CLAUDE.md的“Things to Know”部分。CLAUDE.md
Step 7: declare ready
步骤7:声明就绪
Print a summary for the user:
markdown
undefined为用户打印总结:
markdown
undefinedPR Readiness: {branch}
PR就绪状态:{branch}
- Committed ({N} commits on this branch)
- Synced with origin/main
- Format + lint clean
- Tests pass ({N} passed)
- Reviewed — {critical resolved, important resolved, suggestions noted}
- Docs updated: {list}
- PR not yet opened — run when ready
gh pr create
Summary of changes for the PR body:
{2–4 bullet points}
undefined- 已提交(此分支上共{N}次提交)
- 已与origin/main同步
- 格式化+Lint检查通过
- 测试通过(共{N}项测试通过)
- 已审查 —— {严重问题已解决,重要问题已解决,建议已记录}
- 文档已更新:{列表}
- 尚未打开PR —— 就绪后运行
gh pr create
PR正文的变更摘要:
{2–4个要点}
undefinedCritical Rules
关键规则
- Do NOT open the PR. This skill stops at "ready." The user runs themselves.
gh pr create - Do NOT skip any failing test.
- Fix the actual problem, not the symptom.
- Commit fixes from the review as separate commits, not amended into feature commits.
- Do NOT add backwards-compatibility shims unless the user explicitly asked.
- 请勿打开PR。此技能仅负责将代码准备至“就绪”状态。由用户自行运行。
gh pr create - 请勿跳过任何失败的测试。
- 修复实际问题,而非仅解决表面症状。
- 将审查后的修复作为单独提交,不要合并到功能提交中。
- 请勿添加向后兼容垫片,除非用户明确要求。
Verify
验证
bash
undefinedbash
undefinedOn a feature branch (not main)
在功能分支上(而非主分支)
git branch --show-current
git branch --show-current
Expected: not "main" / "master"
预期结果:不是"main" / "master"
Branch is up to date with origin/main
分支已与origin/main同步
git fetch origin main && git log --oneline HEAD..origin/main | wc -l
git fetch origin main && git log --oneline HEAD..origin/main | wc -l
Expected: 0
预期结果:0
Working tree clean
工作区干净
git status --short
git status --short
Expected: empty output
预期结果:无输出
Project-specific final gate (pull from CLAUDE.md Quick Reference)
项目特定的最终检查(来自CLAUDE.md的快速参考)
undefinedundefinedCommon Mistakes
常见错误
| Mistake | Correction |
|---|---|
| Amending feature commits with review-fix commits | Keep review fixes as separate commits. The PR reviewer sees the progression; amending erases it. |
| Running tests against a stale branch | Sync with main first (step 2). Tests passing on an old base prove nothing. |
| Opening the PR before fixing Important findings | "Important" from |
| Updating docs in a separate later PR | Doc drift compounds. Keep code and docs in the same PR — easier to review and less likely to be forgotten. |
| 错误 | 修正方法 |
|---|---|
| 将审查修复合并到功能提交中 | 将审查修复作为单独提交。PR审查者可以看到变更过程;合并会抹除这些记录。 |
| 在过时分支上运行测试 | 先与主分支同步(步骤2)。在旧分支上测试通过毫无意义。 |
| 未修复**Important(重要)**问题就打开PR | |
| 在后续单独的PR中更新文档 | 文档偏差会不断累积。将代码和文档更新放在同一个PR中 —— 更易于审查,也更不容易被遗忘。 |