关于 agent-pr-manager
用于管理 GitHub Pull Request 的开发技能,通过 Claude Flow 多 Agent 协作协调代码审查、测试验证与合并流程。适合需要集中处理 PR 生命周期的开发团队。
主要功能
- 01多 Agent 协作审查
- 02测试与验证协调
- 03冲突处理与合并协调
- 04分支管理与同步
- 05PR 状态跟踪
适用场景
- 01并行审查大型 PR
- 02合并前协调测试与验证
- 03跟踪 PR 进度和检查状态
MCP 相关
通过 Claude Flow 的 MCP 工具协调 Agent、编排任务并管理 GitHub PR。还提供 GitHub CLI 检查钩子,用于验证认证、测试和 PR 状态。
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ ruvnet/ ruflo --skill agent-pr-manager安装后在 Claude Code 中输入/agent-pr-manager确认已加载。
详细介绍
name: pr-manager description: 借助群集协作,全面管理拉取请求,自动完成审查、测试和合并工作流 type: development color: "#4ECDC4" tools:
- Bash
- Read
- Write
- Edit
- Glob
- Grep
- LS
- TodoWrite
- mcp__claude-flow__swarm_init
- mcp__claude-flow__agent_spawn
- mcp__claude-flow__task_orchestrate
- mcp__claude-flow__swarm_status
- mcp__claude-flow__memory_usage
- mcp__claude-flow__github_pr_manage
- mcp__claude-flow__github_code_review
- mcp__claude-flow__github_metrics
hooks:
pre:
- "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:
- "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"
GitHub PR 管理器
用途
借助群集协作,全面管理拉取请求,自动完成审查、测试和合并工作流。
功能
- 多审查者协作,由群集 Agent 协同完成
- 自动冲突解决和合并策略
- 全面集成测试与验证
- 实时进度跟踪,并协调 GitHub issue
- 智能分支管理与同步
使用模式
1. 通过群集协作创建和管理 PR
// Initialize review swarm
mcp__claude-flow__swarm_init { topology: "mesh", maxAgents: 4 }
mcp__claude-flow__agent_spawn { type: "reviewer", name: "Code Quality Reviewer" }
mcp__claude-flow__agent_spawn { type: "tester", name: "Testing Agent" }
mcp__claude-flow__agent_spawn { type: "coordinator", name: "PR Coordinator" }
// Create PR and orchestrate review
mcp__github__create_pull_request {
owner: "ruvnet",
repo: "ruv-FANN",
title: "Integration: claude-code-flow and ruv-swarm",
head: "integration$claude-code-flow-ruv-swarm",
base: "main",
body: "Comprehensive integration between packages..."
}
// Orchestrate review process
mcp__claude-flow__task_orchestrate {
task: "Complete PR review with testing and validation",
strategy: "parallel",
priority: "high"
}
2. 自动审查多个文件
// Get PR files and create parallel review tasks
mcp__github__get_pull_request_files { owner: "ruvnet", repo: "ruv-FANN", pull_number: 54 }
// Create coordinated reviews
mcp__github__create_pull_request_review {
owner: "ruvnet",
repo: "ruv-FANN",
pull_number: 54,
body: "Automated swarm review with comprehensive analysis",
event: "APPROVE",
comments: [
{ path: "package.json", line: 78, body: "Dependency integration verified" },
{ path: "src$index.js", line: 45, body: "Import structure optimized" }
]
}
3. 协调合并与测试
// Validate PR status and merge when ready
mcp__github__get_pull_request_status { owner: "ruvnet", repo: "ruv-FANN", pull_number: 54 }
// Merge with coordination
mcp__github__merge_pull_request {
owner: "ruvnet",
repo: "ruv-FANN",
pull_number: 54,
merge_method: "squash",
commit_title: "feat: Complete claude-code-flow and ruv-swarm integration",
commit_message: "Comprehensive integration with swarm coordination"
}
// Post-merge coordination
mcp__claude-flow__memory_usage {
action: "store",
key: "pr/54$merged",
value: { timestamp: Date.now(), status: "success" }
}
批量操作示例
并行完成 PR 生命周期:
[Single Message - Complete PR Management]:
// Initialize coordination
mcp__claude-flow__swarm_init { topology: "hierarchical", maxAgents: 5 }
mcp__claude-flow__agent_spawn { type: "reviewer", name: "Senior Reviewer" }
mcp__claude-flow__agent_spawn { type: "tester", name: "QA Engineer" }
mcp__claude-flow__agent_spawn { type: "coordinator", name: "Merge Coordinator" }
// Create and manage PR using gh CLI
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")
Bash("npm run lint")
Bash("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" }
]}
最佳实践
1. 始终使用群集协作
- 在执行复杂的 PR 操作前初始化群集
- 为不同的审查方面分配专用 Agent
- 使用记忆实现跨 Agent 协作
2. 批量执行 PR 操作
- 在单条消息中合并多个 GitHub API 调用
- 并行处理大型 PR 涉及的文件
- 同时协调测试与验证
3. 智能审查策略
- 自动检测并解决冲突
- 通过多 Agent 审查实现全面覆盖
- 集成性能与安全验证
4. 进度跟踪
- 使用 TodoWrite 跟踪 PR 里程碑
- 集成 GitHub issue 以协调项目
- 通过群集记忆实时更新状态
与其他模式集成
可无缝配合:
$github issue-tracker- 用于项目协调$github branch-manager- 用于分支策略$github ci-orchestrator- 用于 CI/CD 集成$sparc reviewer- 用于详细代码分析$sparc tester- 用于全面测试
错误处理
自动重试逻辑适用于:
- GitHub API 调用期间的网络故障
- 通过智能解决处理合并冲突
- 自动重新运行测试以应对测试失败
- 通过负载均衡处理审查瓶颈
群集协作可确保:
- 不存在单点故障
- Agent 自动故障转移
- 中断期间保留进度
- 全面的错误报告与恢复
评论
支持 Markdown