pr-creator
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChinesePull Request Creator
拉取请求创建工具
This skill guides the creation of high-quality Pull Requests that adhere to the
repository's standards.
此技能可指导创建符合仓库标准的高质量拉取请求(PR)。
Workflow
工作流程
Follow these steps to create a Pull Request:
-
Branch Management: Check the current branch to avoid working directly on.
main- Run .
git branch --show-current - If the current branch is , create and switch to a new descriptive branch:
mainbashgit checkout -b <new-branch-name>
- Run
-
Locate Template: Search for a pull request template in the repository.
- Check
.github/pull_request_template.md - Check
.github/PULL_REQUEST_TEMPLATE.md - If multiple templates exist (e.g., in ), ask the user which one to use or select the most appropriate one based on the context (e.g.,
.github/PULL_REQUEST_TEMPLATE/vsbug_fix.md).feature.md
- Check
-
Read Template: Read the content of the identified template file.
-
Draft Description: Create a PR description that strictly follows the template's structure.
- Headings: Keep all headings from the template.
- Checklists: Review each item. Mark with if completed. If an item is not applicable, leave it unchecked or mark as
[x](depending on the template's instructions) or remove it if the template allows flexibility (but prefer keeping it unchecked for transparency).[ ] - Content: Fill in the sections with clear, concise summaries of your changes.
- Related Issues: Link any issues fixed or related to this PR (e.g., "Fixes #123").
-
Preflight Check: Before creating the PR, run the workspace preflight script to ensure all build, lint, and test checks pass.bash
npm run preflightIf any checks fail, address the issues before proceeding to create the PR. -
Create PR: Use theCLI to create the PR. To avoid shell escaping issues with multi-line Markdown, write the description to a temporary file first.
ghbash# 1. Write the drafted description to a temporary file # 2. Create the PR using the --body-file flag gh pr create --title "type(scope): succinct description" --body-file <temp_file_path> # 3. Remove the temporary file rm <temp_file_path>- Title: Ensure the title follows the
Conventional Commits format if the
repository uses it (e.g., ,
feat(ui): add new button).fix(core): resolve crash
- Title: Ensure the title follows the
Conventional Commits format if the
repository uses it (e.g.,
按照以下步骤创建拉取请求:
-
分支管理:检查当前分支,避免直接在分支上工作。
main- 运行命令。
git branch --show-current - 如果当前分支是,创建并切换到一个具有描述性的新分支:
mainbashgit checkout -b <new-branch-name>
- 运行
-
查找模板:在仓库中搜索拉取请求模板。
- 检查文件
.github/pull_request_template.md - 检查文件
.github/PULL_REQUEST_TEMPLATE.md - 如果存在多个模板(例如在目录下),询问用户使用哪个模板,或者根据上下文选择最合适的模板(例如
.github/PULL_REQUEST_TEMPLATE/或bug_fix.md)。feature.md
- 检查
-
阅读模板:读取找到的模板文件内容。
-
撰写描述草稿:严格按照模板结构创建PR描述。
- 标题:保留模板中的所有标题。
- 复选清单:检查每一项。已完成的项标记为。如果某一项不适用,可保持未勾选状态或标记为
[x](取决于模板说明),如果模板允许灵活调整也可删除该项(但为了透明性,建议保持未勾选状态)。[ ] - 内容:在各个部分填写清晰、简洁的变更摘要。
- 相关问题:关联此PR修复或涉及的所有问题(例如:"Fixes #123")。
-
预检检查:创建PR之前,运行工作区预检脚本,确保所有构建、代码检查和测试都能通过。bash
npm run preflight如果有任何检查未通过,请先解决问题,再继续创建PR。 -
创建PR:使用CLI工具创建PR。为避免多行Markdown的shell转义问题,请先将描述写入临时文件。
ghbash# 1. Write the drafted description to a temporary file # 2. Create the PR using the --body-file flag gh pr create --title "type(scope): succinct description" --body-file <temp_file_path> # 3. Remove the temporary file rm <temp_file_path>- 标题:如果仓库使用Conventional Commits格式,请确保标题符合该格式(例如:、
feat(ui): add new button)。fix(core): resolve crash
- 标题:如果仓库使用Conventional Commits格式,请确保标题符合该格式(例如:
Principles
原则
- Compliance: Never ignore the PR template. It exists for a reason.
- Completeness: Fill out all relevant sections.
- Accuracy: Don't check boxes for tasks you haven't done.
- 合规性:切勿忽略PR模板,它的存在是有原因的。
- 完整性:填写所有相关部分。
- 准确性:不要为未完成的任务勾选复选框。