Skip to content
Development
Command

/devkit.github.review-pr

Provides comprehensive GitHub pull request review with code quality, security, and best practices analysis. Use when reviewing a PR before merging.

From plugin
developer-kit
36935 skills44 agents35 commands2 MCP
> /plugin marketplace add giuseppe-trisciuoglio/developer-kit
> /plugin install developer-kit@developer-kit

Command definition

devkit.github.review-pr.md
description: Provides comprehensive GitHub pull request review with code quality, security, and best practices analysis. Use when reviewing a PR before merging.
allowed-tools: Bash(gh *), Bash(git *), Read, Grep, Glob
argument-hint: "[pr-number] [review-focus] [output-format]"

GitHub Pull Request Comprehensive Review

Overview

Perform comprehensive code review of a GitHub pull request including code quality, security, architecture, performance, and best practices analysis.

Overview

  • **Title**: $PR_TITLE
  • **Author**: $PR_AUTHOR
  • **Branch**: $PR_HEAD → $PR_BASE
  • **Changes**: +$PR_ADDITIONS -$PR_DELETIONS across $PR_CHANGED_FILES files
  • **Review Focus**: $REVIEW_FOCUS

Usage

/devkit.github.review-pr $ARGUMENTS

Arguments

| Argument | Description | |--------------|------------------------------------------| | `$ARGUMENTS` | Combined arguments passed to the command |

Current Context

  • **Current Branch**: !`git branch --show-current`
  • **Remote Repository**: !`git config --get remote.origin.url`
  • **Git Status**: !`git status --porcelain`

Execution Instructions

**Agent Selection**: To execute this GitHub task, use the following approach:

  • Primary: Use `general-purpose` agent with GitHub CLI expertise and code analysis capabilities

Configuration

**Arguments received**: `$ARGUMENTS`

**$1**: PR number (required - e.g., `123`) **$2**: Review focus (optional - defaults to `full`) **$3**: Output format (optional - defaults to `summary`)

**Available review focuses**:

  • `full` - Complete comprehensive review (default)
  • `security` - Security vulnerabilities and risks only
  • `performance` - Performance bottlenecks and optimizations
  • `architecture` - Design patterns and architectural decisions
  • `testing` - Test coverage and quality
  • `style` - Code style and conventions

**Output formats**:

  • `summary` - Concise executive summary (default)
  • `detailed` - Comprehensive detailed report
  • `checklist` - Review checklist format
  • `issues` - GitHub issues-ready format

Phase 1: PR Information Extraction

1.1 Fetch PR Details

# Validate PR number
if [ -z "$1" ]; then
    echo "Error: PR number is required"
    echo "Usage: /developer-kit:devkit.github.review-pr <pr-number> [review-focus] [output-format]"
    exit 1
fi

PR_NUMBER=$1
REVIEW_FOCUS=${2:-full}
OUTPUT_FORMAT=${3:-summary}

# Check GitHub CLI authentication
if ! gh auth status > /dev/null 2>&1; then
    echo "Error: GitHub CLI not authenticated. Run: gh auth login"
    exit 1
fi

# Fetch PR information
echo "Fetching PR #$PR_NUMBER details..."

PR_TITLE=$(gh pr view $PR_NUMBER --json title -q .title)
PR_AUTHOR=$(gh pr view $PR_NUMBER --json author -q .author.login)
PR_STATE=$(gh pr view $PR_NUMBER --json state -q .state)
PR_BASE=$(gh pr view $PR_NUMBER --json baseRefName -q .baseRefName)
PR_HEAD=$(gh pr view $PR_NUMBER --json headRefName -q .headRefName)
PR_URL=$(gh pr view $PR_NUMBER --json url -q .url)
PR_CREATED=$(gh pr view $PR_NUMBER --json createdAt -q .createdAt)
PR_ADDITIONS=$(gh pr view $PR_NUMBER --json additions -q .additions)
PR_DELETIONS=$(gh pr view $PR_NUMBER --json deletions -q .deletions)
PR_CHANGED_FILES=$(gh pr view $PR_NUMBER --json changedFiles -q .changedFiles)

echo "PR Title: $PR_TITLE"
echo "Author: $PR_AUTHOR"
echo "State: $PR_STATE"
echo "Branch: $PR_HEAD -> $PR_BASE"
echo "Changes: +$PR_ADDITIONS -$PR_DELETIONS across $PR_CHANGED_FILES files"

1.2 Get Changed Files

# Get list of changed files with their status
gh pr diff $PR_NUMBER --name-only > changed_files.tmp

echo ""
echo "Changed files:"
cat changed_files.tmp
echo ""

# Categorize files by type
JAVA_FILES=$(grep '\.java$' changed_files.tmp | wc -l)
JS_FILES=$(grep -E '\.(js|jsx|ts|tsx)$' changed_files.tmp | wc -l)
PY_FILES=$(grep '\.py$' changed_files.tmp | wc -l)
CONFIG_FILES=$(grep -E '\.(xml|yml|yaml|json|properties)$' changed_files.tmp | wc -l)
TEST_FILES=$(grep -i 'test' changed_files.tmp | wc -l)
DOC_FILES=$(grep -E '\.(md|txt|adoc)$' changed_files.tmp | wc -l)

echo "File types:"
echo "- Java files: $JAVA_FILES"
echo "- JavaScript/TypeScript files: $JS_FILES"
echo "- Python files: $PY_FILES"
echo "- Configuration files: $CONFIG_FILES"
echo "- Test files: $TEST_FILES"
echo "- Documentation files: $DOC_FILES"

1.3 Fetch PR Diff

# Download full diff
gh pr diff $PR_NUMBER > pr_diff.tmp

# Get diff statistics
TOTAL_LINES=$(wc -l < pr_diff.tmp)
ADDED_LINES=$(grep '^+' pr_diff.tmp | grep -v '^+++' | wc -l)
REMOVED_LINES=$(grep '^-' pr_diff.tmp | grep -v '^---' | wc -l)

echo ""
echo "Diff statistics:"
echo "- Total lines in diff: $TOTAL_LINES"
echo "- Lines added: $ADDED_LINES"
echo "- Lines removed: $REMOVED_LINES"
echo ""

Phase 2: Code Quality Analysis

2.1 Code Structure and Organization

Analyze:

  • **Package/module structure**: Logical organization and naming
  • **File organization**: Single responsibility principle adherence
  • **Class/function size**: Manageable and focused components
  • **Naming conventions**: Consistency and clarity
  • **Code duplication**: DRY principle violations

2.2 Design Patterns and Best Practices

Review for:

  • **Design patterns**: Appropriate pattern usage
  • **SOLID principles**: Single responsibility, open/closed, etc.
  • **Dependency management**: Proper injection and coupling
  • **Error handling**: Comprehensive exception handling
  • **Logging**: Appropriate logging levels and messages

2.3 Code Complexity

Evaluate:

  • **Cyclomatic complexity**: Number of decision points
  • **Cognitive complexity**: Mental effort to understand
  • **Nesting depth**: Excessive nesting levels
  • **Method/function length**: Overly long implementations
  • **Parameter count**: Excessive parameters

Phase 3: Security Review

3.1 Common Vulnerabilities

Check for:

  • **SQL Injection**: Unsafe query construction
  • **XSS (Cross-Site Scripting)**: Unescaped user input
  • **CSRF**: Missing CSRF
Read more
@giuseppe-trisciuoglio
Ships withdeveloper-kit

Modular plugin marketplace for Claude Code and agentic CLIs, with validated, spec-driven skills, agents, commands, and workflows for Java, TypeScript, Python, PHP, AWS, and AI.

369116 skills44 agents2 MCP
Get the whole plugin

Stars on GitHub

Momentum

stars in total
369
Star history of giuseppe-trisciuoglio/developer-kit on GitHub, a chart by star-history.com

Other commands on developer-kit.

More commands from other plugins.

build
Auto-invoked

build

Command

Implement tasks incrementally — build, test, verify, commit. Add "auto" to run the whole plan in one approved pass.

@addyosmani@addyosmaniInstall Command