github-pr-manager
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseGitHub PR Manager Skill
GitHub PR Manager Skill
Overview
概述
Manage the complete pull request lifecycle with swarm coordination. This skill handles PR creation, multi-reviewer coordination, automated testing integration, conflict resolution, and intelligent merge strategies.
借助集群协调功能管理完整的拉取请求(PR)生命周期。该Skill可处理PR创建、多评审人员协调、自动化测试集成、冲突解决以及智能合并策略。
Quick Start
快速开始
bash
undefinedbash
undefinedCheck GitHub CLI authentication
Check GitHub CLI authentication
gh auth status
gh auth status
Create a PR with description
Create a PR with description
gh pr create --title "Feature: New API endpoint" --body "Implementation details..." --base main
gh pr create --title "Feature: New API endpoint" --body "Implementation details..." --base main
Review PR status
Review PR status
gh pr status
gh pr status
List open PRs
List open PRs
gh pr list --state open
undefinedgh pr list --state open
undefinedWhen to Use
使用场景
- Creating and managing pull requests
- Coordinating multi-reviewer workflows
- Resolving merge conflicts
- Automating PR testing and validation
- Managing branch synchronization
- Batch PR operations across repositories
- 创建并管理拉取请求(PR)
- 协调多评审人员工作流
- 解决合并冲突
- 自动化PR测试与验证
- 管理分支同步
- 跨仓库批量PR操作
Core Capabilities
核心功能
| Capability | Description |
|---|---|
| Multi-reviewer coordination | Swarm agents for parallel code review |
| Automated conflict resolution | Intelligent merge strategies |
| Comprehensive testing | Integration with CI/CD validation |
| Real-time progress tracking | GitHub issue coordination |
| Branch management | Synchronization and cleanup |
| 功能 | 描述 |
|---|---|
| 多评审人员协调 | 采用集群Agent进行并行代码评审 |
| 自动化冲突解决 | 智能合并策略 |
| 全面测试 | 与CI/CD验证集成 |
| 实时进度追踪 | 与GitHub议题协调 |
| 分支管理 | 同步与清理 |
Usage Examples
使用示例
1. Create PR with Swarm Coordination
1. 借助集群协调创建PR
javascript
// Initialize review swarm
// Orchestrate review process
task: "Complete PR review with testing and validation",
strategy: "parallel",
priority: "high"
})javascript
// Initialize review swarm
// Orchestrate review process
task: "Complete PR review with testing and validation",
strategy: "parallel",
priority: "high"
})2. Create and Manage PR with gh CLI
2. 使用gh CLI创建并管理PR
bash
undefinedbash
undefinedCreate PR
Create PR
gh pr create
--repo owner/repo
--title "feat: Integration between packages"
--head feature-branch
--base main
--body "## Summary
--repo owner/repo
--title "feat: Integration between packages"
--head feature-branch
--base main
--body "## Summary
- Added new integration
- Updated dependencies
- Fixed compatibility issues"
gh pr create
--repo owner/repo
--title "feat: Integration between packages"
--head feature-branch
--base main
--body "## Summary
--repo owner/repo
--title "feat: Integration between packages"
--head feature-branch
--base main
--body "## Summary
- Added new integration
- Updated dependencies
- Fixed compatibility issues"
View PR details
View PR details
gh pr view 54 --json files,additions,deletions,title,body
gh pr view 54 --json files,additions,deletions,title,body
Add reviewers
Add reviewers
gh pr edit 54 --add-reviewer user1,user2
gh pr edit 54 --add-reviewer user1,user2
Check PR status
Check PR status
gh pr checks 54
undefinedgh pr checks 54
undefined3. Review and Approve PR
3. 评审并批准PR
bash
undefinedbash
undefinedGet PR diff
Get PR diff
gh pr diff 54
gh pr diff 54
Approve PR
Approve PR
gh pr review 54 --approve --body "LGTM! All checks pass."
gh pr review 54 --approve --body "LGTM! All checks pass."
Request changes
Request changes
gh pr review 54 --request-changes --body "Please address the following..."
gh pr review 54 --request-changes --body "Please address the following..."
Comment on PR
Comment on PR
gh pr comment 54 --body "Consider refactoring this section."
undefinedgh pr comment 54 --body "Consider refactoring this section."
undefined4. Merge PR with Validation
4. 验证后合并PR
bash
undefinedbash
undefinedCheck merge readiness
Check merge readiness
gh pr status
gh pr status
Merge with squash
Merge with squash
gh pr merge 54 --squash --delete-branch
--subject "feat: Complete integration"
--body "Comprehensive integration with swarm coordination"
--subject "feat: Complete integration"
--body "Comprehensive integration with swarm coordination"
gh pr merge 54 --squash --delete-branch
--subject "feat: Complete integration"
--body "Comprehensive integration with swarm coordination"
--subject "feat: Complete integration"
--body "Comprehensive integration with swarm coordination"
Merge with rebase
Merge with rebase
gh pr merge 54 --rebase --delete-branch
undefinedgh pr merge 54 --rebase --delete-branch
undefined5. Batch PR Operations
5. 批量PR操作
javascript
[Single Message - Complete PR Management]:
// Initialize coordination
// Create and manage PR
Bash("gh pr create --repo owner/repo --title '...' --head '...' --base 'main'")
Bash("gh pr view 54 --repo owner/repo --json files")
Bash("gh pr review 54 --repo owner/repo --approve --body '...'")
// Execute tests and validation
Bash("npm test && npm run lint && npm run build")
// Track progress
TodoWrite({ todos: [
{ id: "review", content: "Complete code review", status: "completed" },
{ id: "test", content: "Run test suite", status: "completed" },
{ id: "merge", content: "Merge when ready", status: "pending" }
]})javascript
[Single Message - Complete PR Management]:
// Initialize coordination
// Create and manage PR
Bash("gh pr create --repo owner/repo --title '...' --head '...' --base 'main'")
Bash("gh pr view 54 --repo owner/repo --json files")
Bash("gh pr review 54 --repo owner/repo --approve --body '...'")
// Execute tests and validation
Bash("npm test && npm run lint && npm run build")
// Track progress
TodoWrite({ todos: [
{ id: "review", content: "Complete code review", status: "completed" },
{ id: "test", content: "Run test suite", status: "completed" },
{ id: "merge", content: "Merge when ready", status: "pending" }
]})MCP Tool Integration
MCP工具集成
Swarm Initialization
集群初始化
javascript
topology: "mesh", // mesh, hierarchical, star, ring
maxAgents: 4,
strategy: "balanced"
})javascript
topology: "mesh", // mesh, hierarchical, star, ring
maxAgents: 4,
strategy: "balanced"
})Agent Spawning
Agent生成
javascript
type: "reviewer",
name: "PR Reviewer",
capabilities: ["code-review", "security-audit", "performance-check"]
})javascript
type: "reviewer",
name: "PR Reviewer",
capabilities: ["code-review", "security-audit", "performance-check"]
})Memory Coordination
内存协调
javascript
// Store PR state
action: "store",
key: "pr/54/status",
value: JSON.stringify({
timestamp: Date.now(),
status: "approved",
reviewers: ["user1", "user2"]
})
})
// Retrieve PR state
action: "retrieve",
key: "pr/54/status"
})javascript
// Store PR state
action: "store",
key: "pr/54/status",
value: JSON.stringify({
timestamp: Date.now(),
status: "approved",
reviewers: ["user1", "user2"]
})
})
// Retrieve PR state
action: "retrieve",
key: "pr/54/status"
})Best Practices
最佳实践
1. Always Use Swarm Coordination
1. 始终使用集群协调
- Initialize swarm before complex PR operations
- Assign specialized agents for different review aspects
- Use memory for cross-agent coordination
- 在复杂PR操作前初始化集群
- 为不同评审环节分配专用Agent
- 利用内存实现跨Agent协调
2. Batch PR Operations
2. 批量PR操作
- Combine multiple GitHub API calls in single messages
- Parallel file operations for large PRs
- Coordinate testing and validation simultaneously
- 在单个消息中组合多个GitHub API调用
- 针对大型PR采用并行文件操作
- 同步协调测试与验证
3. Intelligent Review Strategy
3. 智能评审策略
- Automated conflict detection and resolution
- Multi-agent review for comprehensive coverage
- Performance and security validation integration
- 自动化冲突检测与解决
- 多Agent评审实现全面覆盖
- 集成性能与安全验证
4. Progress Tracking
4. 进度追踪
- Use TodoWrite for PR milestone tracking
- GitHub issue integration for project coordination
- Real-time status updates through swarm memory
- 使用TodoWrite追踪PR里程碑
- 集成GitHub议题进行项目协调
- 通过集群内存实现实时状态更新
Error Handling
错误处理
Automatic retry logic for:
针对以下场景的自动重试逻辑:
- Network failures during GitHub API calls
- Merge conflicts with intelligent resolution
- Test failures with automatic re-runs
- Review bottlenecks with load balancing
- GitHub API调用期间的网络故障
- 带有智能解决机制的合并冲突
- 自动重新运行的测试失败
- 带有负载均衡的评审瓶颈
Swarm coordination ensures:
集群协调可确保:
- No single point of failure
- Automatic agent failover
- Progress preservation across interruptions
- Comprehensive error reporting and recovery
- 无单点故障
- Agent自动故障转移
- 中断时保留进度
- 全面的错误报告与恢复
Integration with Other Skills
与其他Skill的集成
| Skill | Integration |
|---|---|
| Link PRs to issues |
| Coordinate release PRs |
| Detailed code analysis |
| SPARC development methodology |
| Skill | 集成方式 |
|---|---|
| 将PR与议题关联 |
| 协调发布PR |
| 详细代码分析 |
| SPARC开发方法论 |
Hooks
钩子
Pre-Task Hooks
任务前钩子
bash
gh auth status || (echo 'GitHub CLI not authenticated' && exit 1)
git status --porcelain
gh pr list --state open --limit 1 >/dev/null || echo 'No open PRs'
npm test --silent || echo 'Tests may need attention'bash
gh auth status || (echo 'GitHub CLI not authenticated' && exit 1)
git status --porcelain
gh pr list --state open --limit 1 >/dev/null || echo 'No open PRs'
npm test --silent || echo 'Tests may need attention'Post-Task Hooks
任务后钩子
bash
gh pr status || echo 'No active PR in current branch'
git branch --show-current
gh pr checks || echo 'No PR checks available'
git log --oneline -3bash
gh pr status || echo 'No active PR in current branch'
git branch --show-current
gh pr checks || echo 'No PR checks available'
git log --oneline -3Version History
版本历史
- 1.0.0 (2025-01-02): Initial release - converted from pr-manager agent
- 1.0.0 (2025-01-02): 初始版本 - 从pr-manager agent迁移而来