pr

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Pull Request Skill

Pull Request 技能

Create a draft pull request with a clear title and explicit description of changes.
创建一个带有清晰标题和明确变更描述的草稿拉取请求(PR)。

Instructions

操作说明

  1. Analyze branch changes: Understand all commits since diverging from main
  2. Push to remote: Ensure all commits are pushed
  3. Create draft PR: Always open as draft for review before merging
  1. 分析分支变更:了解从main分支分叉以来的所有提交
  2. 推送到远程仓库:确保所有提交已推送至远程
  3. 创建草稿PR:在合并前始终以草稿形式创建以便审核

PR Title Format

PR标题格式

Follow conventional commit format for the PR title:
<type>: <description>
PR标题需遵循规范提交格式:
<type>: <description>

Types

类型

  • feat
    : New feature or capability
  • fix
    : Bug fix
  • refactor
    : Code restructuring
  • docs
    : Documentation changes
  • chore
    : Maintenance tasks
  • perf
    : Performance improvements
  • feat
    : 新功能或能力
  • fix
    : Bug修复
  • refactor
    : 代码重构
  • docs
    : 文档变更
  • chore
    : 维护任务
  • perf
    : 性能优化

Title Rules

标题规则

  • Keep under 70 characters
  • Use lowercase, imperative mood
  • No period at the end
  • 长度不超过70个字符
  • 使用小写、祈使语气
  • 结尾不加句号

PR Body Format

PR正文格式

The body MUST be explicit about what changed. Structure:
markdown
undefined
正文必须明确说明变更内容,结构如下:
markdown
undefined

Summary

Summary

<Clear description of what this PR does and why>
<清晰描述此PR的作用及原因>

Changes

Changes

  • <Specific change 1>
  • <Specific change 2>
  • <Specific change 3>
  • <具体变更1>
  • <具体变更2>
  • <具体变更3>

Test plan

Test plan

  • <How to verify change 1>
  • <How to verify change 2>

Generated with Claude Code
undefined
  • <如何验证变更1>
  • <如何验证变更2>

Generated with Claude Code
undefined

Execution Steps

执行步骤

  1. Run
    git status
    to check for uncommitted changes
  2. Run
    git log main..HEAD --oneline
    to see all commits in this branch
  3. Run
    git diff main...HEAD
    to see the full diff against main
  4. Check if remote branch exists and is up to date:
    bash
    git rev-parse --abbrev-ref --symbolic-full-name @{u} 2>/dev/null || echo "no upstream"
  5. Push to remote if needed:
    git push -u origin HEAD
  6. Create draft PR using gh CLI:
    bash
    gh pr create --draft --title "<type>: <description>" --body "$(cat <<'EOF'
    ## Summary
    <description>
    
    ## Changes
    - <change 1>
    - <change 2>
    
    ## Test plan
    - [ ] <test 1>
    - [ ] <test 2>
    
    ---
    Generated with [Claude Code](https://claude.com/claude-code)
    EOF
    )"
  7. Return the PR URL to the user
  1. 运行
    git status
    检查未提交的变更
  2. 运行
    git log main..HEAD --oneline
    查看当前分支的所有提交
  3. 运行
    git diff main...HEAD
    查看与main分支的完整差异
  4. 检查远程分支是否存在且为最新版本:
    bash
    git rev-parse --abbrev-ref --symbolic-full-name @{u} 2>/dev/null || echo "no upstream"
  5. 如有需要,推送到远程仓库:
    git push -u origin HEAD
  6. 使用gh CLI创建草稿PR:
    bash
    gh pr create --draft --title "<type>: <description>" --body "$(cat <<'EOF'
    ## Summary
    <描述>
    
    ## Changes
    - <变更1>
    - <变更2>
    
    ## Test plan
    - [ ] <测试1>
    - [ ] <测试2>
    
    ---
    Generated with [Claude Code](https://claude.com/claude-code)
    EOF
    )"
  7. 将PR链接返回给用户