pr-automation
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChinesePR Automation Skill
PR自动化技能
Automate pull request workflows to streamline PR creation and validation.
自动化拉取请求(PR)工作流,简化PR的创建与验证流程。
When to Use
适用场景
Use this skill when:
- Before creating a PR
- When user requests PR creation
- Before pushing code to remote
- After completing a feature or fix
使用本技能的场景:
- 创建PR之前
- 用户请求创建PR时
- 向远程仓库推送代码之前
- 完成功能开发或问题修复之后
Capabilities
核心能力
1. Generate PR Descriptions
1. 自动生成PR描述
Automatically generate comprehensive PR descriptions:
- Analyze git diff to understand changes
- Extract commit messages for context
- Identify changed files and their purposes
- Generate structured PR description following template
- Include all required sections (description, changes, testing, etc.)
自动生成全面的PR描述:
- 分析git diff以理解代码变更
- 提取提交信息作为上下文
- 识别变更文件及其用途
- 遵循模板生成结构化的PR描述
- 包含所有必填章节(描述、变更内容、测试情况等)
2. Validate PR Requirements
2. 验证PR要求
Check PR requirements before creation:
- Verify tests exist for new features
- Check that tests pass
- Verify documentation is updated
- Validate code follows project conventions
- Check for linting errors
- Verify formatting is correct
- Ensure no secrets or credentials are committed
在创建PR前检查要求:
- 验证新功能是否有对应的测试
- 检查测试是否通过
- 验证文档是否已更新
- 确认代码符合项目规范
- 检查代码检查错误
- 验证代码格式是否正确
- 确保没有提交机密信息或凭证
3. Check for Missing Tests/Docs
3. 检查缺失的测试与文档
Identify missing requirements:
- Check if new features have tests
- Verify documentation is updated
- Check for missing type hints (Python)
- Verify error handling is documented
- Check for missing API documentation
识别缺失的必要内容:
- 检查新功能是否有测试
- 验证文档是否已更新
- 检查是否缺失Python类型提示
- 验证错误处理是否已文档化
- 检查是否缺失API文档
4. Link Issues Automatically
4. 自动关联议题
Automatically link related issues:
- Parse commit messages for issue references (#123)
- Search for related issues based on changes
- Add "Closes #123" or "Related to #123" to PR description
- Link to parent issues or epics
自动关联相关议题:
- 解析提交信息中的议题引用(#123)
- 根据代码变更搜索相关议题
- 在PR描述中添加"Closes #123"或"Related to #123"
- 关联父议题或史诗级议题
5. Suggest Reviewers
5. 推荐评审人员
Suggest appropriate reviewers:
- Based on files changed (domain expertise)
- Based on previous reviewers of similar changes
- Based on code owners (if CODEOWNERS file exists)
- Based on team structure
推荐合适的评审人员:
- 根据变更文件(领域专业知识)
- 根据类似变更的过往评审人员
- 根据代码所有者(如果存在CODEOWNERS文件)
- 根据团队架构
Workflow
工作流
- Analyze Changes: Review git diff and commit history
- Generate Description: Create comprehensive PR description
- Run Validation: Check all PR requirements
- Fix Issues: Address any validation failures
- Create PR: Generate PR with all information
- Post-Creation: Add labels, assign reviewers, link issues
- 分析变更:查看git diff和提交历史
- 生成描述:创建全面的PR描述
- 执行验证:检查所有PR要求
- 修复问题:处理所有验证不通过的问题
- 创建PR:生成包含所有信息的PR
- 创建后操作:添加标签、分配评审人员、关联议题
PR Description Template
PR描述模板
Follows the template from :
.cursor/rules/context-communication.mdc- Description of what changed and why
- Related issue links
- List of changes
- How it was verified
- Related code references
- Assumptions made
- Breaking changes (if any)
- Testing checklist
遵循中的模板:
.cursor/rules/context-communication.mdc- 变更内容及原因描述
- 相关议题链接
- 变更列表
- 验证方式
- 相关代码引用
- 做出的假设
- 破坏性变更(如有)
- 测试检查清单
Related Resources
相关资源
Rules
规则
- - Git workflow and PR process
.cursor/rules/git-workflow.mdc - - PR description best practices
.cursor/rules/context-communication.mdc - - Testing requirements
.cursor/rules/testing.mdc
- - Git工作流与PR流程
.cursor/rules/git-workflow.mdc - - PR描述最佳实践
.cursor/rules/context-communication.mdc - - 测试要求
.cursor/rules/testing.mdc
Subagents
子Agent
- - PR management subagent
.cursor/agents/pr-manager.md - - Code review subagent
.cursor/agents/code-reviewer.md - - Test runner subagent
.cursor/agents/test-runner.md
- - PR管理子Agent
.cursor/agents/pr-manager.md - - 代码评审子Agent
.cursor/agents/code-reviewer.md - - 测试运行子Agent
.cursor/agents/test-runner.md
Commands
命令
- - Generate PR with automation
/auto-pr - - Create pull request with proper description
/pr - - Review code before PR
/code-review
- - 自动生成PR
/auto-pr - - 创建带有规范描述的PR
/pr - - PR前代码评审
/code-review