when-reviewing-github-pr-use-github-code-review
Comprehensive GitHub pull request code review using multi-agent swarm with specialized reviewers for security, performance, style, tests, and documentation. Coordinates security-auditor, perf-analyzer, code-analyzer, tester, and reviewer agents through mesh topology for parallel analysis. Provides detailed feedback with auto-fix suggestions and merge readiness assessment. Use when reviewing PRs, conducting code audits, or ensuring code quality standards before merge.
What this skill does
# GitHub Code Review Skill
## Overview
Execute comprehensive, multi-dimensional code reviews for GitHub pull requests using coordinated agent swarms. This skill orchestrates five specialized agents working in parallel to analyze security, performance, code quality, test coverage, and documentation, then synthesizes findings into actionable feedback with merge readiness assessment.
## When to Use This Skill
Activate this skill when reviewing pull requests before merge approval, conducting security audits on code changes, assessing performance implications of new code, validating test coverage and quality standards, or providing structured feedback to contributors.
Use this skill for both internal team PRs and external contributor submissions, complex feature additions requiring thorough review, refactoring changes that impact system architecture, or establishing code review standards and automation.
## Agent Coordination Architecture
### Swarm Topology
Initialize a **mesh topology** for maximum parallel execution and peer-to-peer communication between specialized reviewers. Mesh topology enables each agent to share findings directly with others, creating a comprehensive understanding through collective intelligence.
```bash
# Initialize mesh swarm for PR review
npx claude-flow@alpha swarm init --topology mesh --max-agents 5 --strategy specialized
```
### Specialized Agent Roles
**Security Auditor** (`security-auditor`): Analyze code for security vulnerabilities, injection risks, authentication/authorization flaws, secrets exposure, and dependency vulnerabilities. Check for OWASP Top 10 violations and compliance requirements.
**Performance Analyzer** (`perf-analyzer`): Evaluate performance implications including algorithmic complexity, memory usage patterns, database query efficiency, caching opportunities, and potential bottlenecks. Flag resource-intensive operations.
**Code Analyzer** (`code-analyzer`): Assess code quality, maintainability, and adherence to style guidelines. Check naming conventions, code organization, design patterns, complexity metrics, and architectural consistency.
**Test Engineer** (`tester`): Review test coverage, test quality, and testing best practices. Validate unit tests, integration tests, edge case handling, and test maintainability. Identify gaps in coverage.
**Documentation Reviewer** (`reviewer`): Evaluate documentation quality including code comments, API documentation, README updates, and inline documentation. Ensure clarity and completeness for future maintainers.
## Review Workflow (SOP)
### Phase 1: Initialization and Context Loading
**Step 1.1: Initialize Swarm Coordination**
Set up mesh topology for parallel agent execution:
```bash
# Use MCP tools to initialize coordination
mcp__claude-flow__swarm_init topology=mesh maxAgents=5 strategy=specialized
# Spawn specialized agents
mcp__claude-flow__agent_spawn type=analyst name=security-auditor
mcp__claude-flow__agent_spawn type=optimizer name=perf-analyzer
mcp__claude-flow__agent_spawn type=analyst name=code-analyzer
mcp__claude-flow__agent_spawn type=researcher name=tester
mcp__claude-flow__agent_spawn type=researcher name=reviewer
```
**Step 1.2: Fetch PR Context**
Use the bundled `github-api.sh` script to fetch PR details:
```bash
# Fetch PR metadata, files changed, and existing comments
bash scripts/github-api.sh fetch-pr <owner> <repo> <pr-number>
```
Store PR context in memory for agent access:
```bash
# Save PR context for swarm coordination
npx claude-flow@alpha hooks post-edit \
--file "pr-context.json" \
--memory-key "github/pr-review/context"
```
**Step 1.3: Load Review Criteria**
Reference `references/review-criteria.md` for comprehensive standards. This document contains security checklists, performance benchmarks, code style guidelines, test coverage requirements, and documentation standards.
### Phase 2: Parallel Agent Review Execution
Execute all five agents concurrently using Claude Code's Task tool. Each agent runs independently while coordinating through shared memory.
**Launch Concurrent Reviews:**
```plaintext
Task("Security Auditor", "
Analyze PR for security vulnerabilities:
1. Check for SQL injection, XSS, CSRF vulnerabilities
2. Validate authentication and authorization logic
3. Scan for exposed secrets and credentials
4. Review dependency security with npm audit / cargo audit
5. Check OWASP Top 10 compliance
Use scripts/security-scan.sh for automated scanning.
Store findings in memory: github/pr-review/security
Run hooks: npx claude-flow@alpha hooks pre-task --description 'security review'
", "security-auditor")
Task("Performance Analyzer", "
Evaluate performance implications:
1. Analyze algorithmic complexity (Big O notation)
2. Identify memory allocation patterns
3. Review database queries for N+1 problems
4. Check caching strategies
5. Flag synchronous blocking operations
Use scripts/perf-analysis.sh for profiling data.
Store findings in memory: github/pr-review/performance
Run hooks: npx claude-flow@alpha hooks pre-task --description 'performance analysis'
", "perf-analyzer")
Task("Code Quality Analyst", "
Assess code quality and maintainability:
1. Check adherence to style guide (references/style-guide.md)
2. Evaluate naming conventions and clarity
3. Calculate cyclomatic complexity
4. Review error handling patterns
5. Validate architectural consistency
Use scripts/code-quality.sh for automated linting.
Store findings in memory: github/pr-review/quality
Run hooks: npx claude-flow@alpha hooks pre-task --description 'code quality review'
", "code-analyzer")
Task("Test Coverage Engineer", "
Review testing comprehensiveness:
1. Measure test coverage percentage
2. Evaluate test quality and assertions
3. Check edge case handling
4. Validate test isolation and independence
5. Review test documentation
Use scripts/test-coverage.sh for coverage reports.
Store findings in memory: github/pr-review/testing
Run hooks: npx claude-flow@alpha hooks pre-task --description 'test review'
", "tester")
Task("Documentation Reviewer", "
Evaluate documentation completeness:
1. Review inline code comments
2. Check API documentation updates
3. Validate README changes
4. Assess documentation clarity
5. Verify examples and usage guides
Store findings in memory: github/pr-review/documentation
Run hooks: npx claude-flow@alpha hooks pre-task --description 'documentation review'
", "reviewer")
```
### Phase 3: Synthesis and Report Generation
After all agents complete their reviews, synthesize findings into a unified report.
**Step 3.1: Aggregate Agent Findings**
Retrieve all agent findings from memory:
```bash
# Collect all review findings
npx claude-flow@alpha memory retrieve --key "github/pr-review/*"
```
**Step 3.2: Generate Comprehensive Report**
Create structured report using the template in `references/review-report-template.md`:
**Report Structure:**
- Executive Summary (merge readiness decision)
- Security Findings (critical/high/medium/low severity)
- Performance Assessment (bottlenecks, optimizations)
- Code Quality Analysis (complexity, maintainability)
- Test Coverage Report (percentage, gaps, improvements)
- Documentation Review (completeness, clarity)
- Auto-Fix Suggestions (automated remediation options)
- Action Items (prioritized recommendations)
**Step 3.3: Calculate Merge Readiness Score**
Apply weighted scoring algorithm:
- Security: 35% weight (blocking if critical issues found)
- Performance: 20% weight
- Code Quality: 20% weight
- Test Coverage: 15% weight
- Documentation: 10% weight
Merge readiness thresholds:
- **Approved**: Score >= 85%, no critical security issues
- **Approved with Comments**: Score 70-84%, minor improvements suggested
- **Changes Requested**: Score < 70% or critical issues present
### Phase 4: Auto-Fix Suggestion Generation
For each identified issue, generate concrete fix suggRelated in AI Agents
skill-development
IncludedComprehensive meta-skill for creating, managing, validating, auditing, and distributing Claude Code skills and slash commands (unified in v2.1.3+). Provides skill templates, creation workflows, validation patterns, audit checklists, naming conventions, YAML frontmatter guidance, progressive disclosure examples, and best practices lookup. Use when creating new skills, validating existing skills, auditing skill quality, understanding skill architecture, needing skill templates, learning about YAML frontmatter requirements, progressive disclosure patterns, tool restrictions (allowed-tools), skill composition, skill naming conventions, troubleshooting skill activation issues, creating custom slash commands, configuring command frontmatter, using command arguments ($ARGUMENTS, $1, $2), bash execution in commands, file references in commands, command namespacing, plugin commands, MCP slash commands, Skill tool configuration, or deciding between skills vs slash commands. Delegates to docs-management skill for official documentation.
reprompter
IncludedTransform messy prompts into well-structured, effective prompts — single or multi-agent. Use when: "reprompt", "reprompt this", "clean up this prompt", "structure my prompt", rough text needing XML tags and best practices, "reprompter teams", "repromptception", "run with quality", "smart run", "smart agents", multi-agent tasks, audits, parallel work, anything going to agent teams. Don't use when: simple Q&A, pure chat, immediate execution-only tasks. See "Don't Use When" section for details. Outputs: Structured XML/Markdown prompt, quality score (before/after), optional team brief + per-agent sub-prompts, agent team output files. Success criteria: Single mode quality score ≥ 7/10; Repromptception per-agent prompt quality score 8+/10; all required sections present, actionable and specific.
adaptive-compaction
IncludedAdaptive add-on policy and recovery layer that decides WHEN to compact, prune, snapshot, or fork -- replacing fixed-percent auto-compaction across Claude Code, Codex, and MCP-capable hosts. Trigger on auto-compact timing or damage: "when should I compact", "is it safe to compact now or start a fresh session", "auto-compact fires too early/mid-task", "switching to an unrelated task but the window still has space", "context rot", "answers get worse the longer the session runs", "the agent forgot the plan or my decisions after it summarized", "add a layer on top that manages context without changing the agent", raising autoCompactWindow to give the policy room, or installing/tuning a cross-tool compaction policy or PreCompact hook -- even when "compaction" is never said but the problem is context-window pressure or post-summarization memory loss. Do NOT use to summarize a conversation, build RAG, write a summarization prompt (decides WHEN not HOW), or answer max-context-length trivia.
agent-skill-creator
IncludedCreate cross-platform agent skills from workflow descriptions. Activates when users ask to create an agent, automate a repetitive workflow, create a custom skill, or need advanced agent creation. Triggers on phrases like create agent for, automate workflow, create skill for, every day I have to, daily I need to, turn process into agent, need to automate, create a cross-platform skill, validate this skill, export this skill, migrate this skill. Supports single skills, multi-agent suites, transcript processing, template-based creation, interactive configuration, cross-platform export, and spec validation.
llm-wiki
IncludedUse when building or maintaining a persistent personal knowledge base (second brain) in Obsidian where an LLM incrementally ingests sources, updates entity/concept pages, maintains cross-references, and keeps a synthesis current. Triggers include "second brain", "Obsidian wiki", "personal knowledge management", "ingest this paper/article/book", "build a research wiki", "compound knowledge", "Memex", or whenever the user wants knowledge to accumulate across sessions instead of being re-derived by RAG on every query.
skill-master
IncludedAgent Skills authoring, evaluation, and optimization. Create, edit, validate, benchmark, and improve skills following the agentskills.io specification. Use when designing SKILL.md files, structuring skill folders (references, scripts, assets), ingesting external documentation into skills, running trigger evals, benchmarking skill quality, optimizing descriptions, or performing blind A/B comparisons. Keywords: agentskills.io, SKILL.md, skill authoring, eval, benchmark, trigger optimization.