GitHub Code Review
Coordinates parallel review agents (security, performance, architecture, style, accessibility) against a GitHub PR. Each agent focuses on one dimension; the swarm aggregates findings, posts inline comments, and enforces quality gates.
Contents
When to Use
- "Run a code review on PR #123"
- "Do a security review on this PR"
- "Set up automated review on every PR"
- "Generate inline review comments for the diff"
- "Add quality gates to branch protection"
Prerequisites
gh CLI installed and authenticated (gh auth status)
ruv-swarm and/or claude-flow MCP server configured
- Repository access permissions for the target PR
- For automated review:
GITHUB_TOKEN available in CI
Quick Start
PR=123
PR_DATA=$(gh pr view "$PR" --json files,additions,deletions,title,body)
PR_DIFF=$(gh pr diff "$PR")
npx ruv-swarm github review-init \
--pr "$PR" \
--pr-data "$PR_DATA" \
--diff "$PR_DIFF" \
--agents "security,performance,style,architecture,accessibility" \
--depth comprehensive
gh pr comment "$PR" --body "Multi-agent code review initiated"
Workflow
- Fetch PR context with
gh pr view --json and gh pr diff
- Pick topology based on PR size (ring < 100 LOC, mesh 100–500, hierarchical > 500) — see
references/swarm-management.md
- Dispatch agents in parallel — one per review dimension; see
references/review-agents.md
- Aggregate findings, post inline comments via the GitHub API; see
references/comments-and-gates.md
- Apply quality gates — block merge on critical security findings, warn on performance regressions, suggest on style
- Verify (see below)
Verification
After a review run, confirm:
If a gate misfires, see references/troubleshooting.md.
References
references/review-agents.md — security / performance / architecture / style agent commands and templates
references/swarm-management.md — swarm creation, label routing, topology, comment commands, webhook handler
references/configuration.md — review-swarm.yml, custom triggers, GitHub Actions, PR description template, auto-merge
references/comments-and-gates.md — inline comment generation, batch management, quality gates, metrics
references/advanced-features.md — context-aware review, learning, cross-PR analysis, custom agents
references/workflow-examples.md — five worked examples + Claude Code integration pattern
references/troubleshooting.md — agents not spawning, comments not posting, slow reviews, performance tips, webhook security caveats, security checklist
Related Skills
github-pr-manager — PR lifecycle management (open, label, merge)
github-workflow-automation — broader GitHub Actions automation
swarm-coordination — orchestration patterns shared across swarm-based skills
External Documentation
Maintained as part of the Claude Code Flow project. MIT licensed. Version 1.1.0.
1---2name: github-code-review3description: Run a multi-agent code review on a GitHub pull request, with parallel security / performance / architecture / style passes, inline comments, and quality-gate enforcement. Use when asked to "github code review", "review github pr", "run code review on PR", "swarm review", "automated PR review", or "post inline review comments".4---56# GitHub Code Review78Coordinates parallel review agents (security, performance, architecture, style, accessibility) against a GitHub PR. Each agent focuses on one dimension; the swarm aggregates findings, posts inline comments, and enforces quality gates.910## Contents1112- [When to Use](#when-to-use)13- [Prerequisites](#prerequisites)14- [Quick Start](#quick-start)15- [Workflow](#workflow)16- [Verification](#verification)17- [References](#references)1819## When to Use2021- "Run a code review on PR #123"22- "Do a security review on this PR"23- "Set up automated review on every PR"24- "Generate inline review comments for the diff"25- "Add quality gates to branch protection"2627## Prerequisites2829- `gh` CLI installed and authenticated (`gh auth status`)30- `ruv-swarm` and/or `claude-flow` MCP server configured31- Repository access permissions for the target PR32- For automated review: `GITHUB_TOKEN` available in CI3334## Quick Start3536```bash37PR=12338PR_DATA=$(gh pr view "$PR" --json files,additions,deletions,title,body)39PR_DIFF=$(gh pr diff "$PR")4041npx ruv-swarm github review-init \42 --pr "$PR" \43 --pr-data "$PR_DATA" \44 --diff "$PR_DIFF" \45 --agents "security,performance,style,architecture,accessibility" \46 --depth comprehensive4748gh pr comment "$PR" --body "Multi-agent code review initiated"49```5051## Workflow52531. **Fetch PR context** with `gh pr view --json` and `gh pr diff`542. **Pick topology** based on PR size (ring < 100 LOC, mesh 100–500, hierarchical > 500) — see [`references/swarm-management.md`](references/swarm-management.md)553. **Dispatch agents in parallel** — one per review dimension; see [`references/review-agents.md`](references/review-agents.md)564. **Aggregate findings**, post inline comments via the GitHub API; see [`references/comments-and-gates.md`](references/comments-and-gates.md)575. **Apply quality gates** — block merge on critical security findings, warn on performance regressions, suggest on style586. **Verify** (see below)5960## Verification6162After a review run, confirm:6364- [ ] Each requested agent posted at least one finding (or an explicit "no issues found")65- [ ] Inline comments resolve to actual lines in the diff (no stale `commit_id`)66- [ ] PR status reflects the outcome — `--approve`, `--request-changes`, or labelled67- [ ] Critical security findings blocked the merge (test by injecting a known-bad pattern, e.g. an obvious eval)68- [ ] Rate-limit budget after the run — `gh api rate_limit` — is not exhausted6970If a gate misfires, see [`references/troubleshooting.md`](references/troubleshooting.md).7172## References7374- [`references/review-agents.md`](references/review-agents.md) — security / performance / architecture / style agent commands and templates75- [`references/swarm-management.md`](references/swarm-management.md) — swarm creation, label routing, topology, comment commands, webhook handler76- [`references/configuration.md`](references/configuration.md) — `review-swarm.yml`, custom triggers, GitHub Actions, PR description template, auto-merge77- [`references/comments-and-gates.md`](references/comments-and-gates.md) — inline comment generation, batch management, quality gates, metrics78- [`references/advanced-features.md`](references/advanced-features.md) — context-aware review, learning, cross-PR analysis, custom agents79- [`references/workflow-examples.md`](references/workflow-examples.md) — five worked examples + Claude Code integration pattern80- [`references/troubleshooting.md`](references/troubleshooting.md) — agents not spawning, comments not posting, slow reviews, performance tips, webhook security caveats, security checklist8182## Related Skills8384- `github-pr-manager` — PR lifecycle management (open, label, merge)85- `github-workflow-automation` — broader GitHub Actions automation86- `swarm-coordination` — orchestration patterns shared across swarm-based skills8788## External Documentation8990- [GitHub CLI manual](https://cli.github.com/manual/)91- [ruv-swarm](https://github.com/ruvnet/ruv-swarm)92- [claude-flow](https://github.com/ruvnet/claude-flow)9394---9596*Maintained as part of the Claude Code Flow project. MIT licensed. Version 1.1.0.*