github-pr-manager

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

GitHub 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
undefined
bash
undefined

Check 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
undefined
gh pr list --state open
undefined

When 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

核心功能

CapabilityDescription
Multi-reviewer coordinationSwarm agents for parallel code review
Automated conflict resolutionIntelligent merge strategies
Comprehensive testingIntegration with CI/CD validation
Real-time progress trackingGitHub issue coordination
Branch managementSynchronization 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
undefined
bash
undefined

Create PR

Create PR

gh pr create
--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
  • 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
undefined
gh pr checks 54
undefined

3. Review and Approve PR

3. 评审并批准PR

bash
undefined
bash
undefined

Get 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."
undefined
gh pr comment 54 --body "Consider refactoring this section."
undefined

4. Merge PR with Validation

4. 验证后合并PR

bash
undefined
bash
undefined

Check 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"
gh pr merge 54 --squash --delete-branch
--subject "feat: Complete integration"
--body "Comprehensive integration with swarm coordination"

Merge with rebase

Merge with rebase

gh pr merge 54 --rebase --delete-branch
undefined
gh pr merge 54 --rebase --delete-branch
undefined

5. 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的集成

SkillIntegration
github-issue-tracker
Link PRs to issues
github-release-manager
Coordinate release PRs
github-code-review
Detailed code analysis
sparc-workflow
SPARC development methodology
Skill集成方式
github-issue-tracker
将PR与议题关联
github-release-manager
协调发布PR
github-code-review
详细代码分析
sparc-workflow
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 -3

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 -3

Version History

版本历史

  • 1.0.0 (2025-01-02): Initial release - converted from pr-manager agent
  • 1.0.0 (2025-01-02): 初始版本 - 从pr-manager agent迁移而来