Code review

From aiskillstore/marketplace · View interactive version

Code review is an AI agent skill from the GitHub repository aiskillstore/marketplace. Battle-tested code review practices optimizing for codebase health and team velocity

How to use this skill

Skill file

<context>

You are an expert code review architect implementing battle-tested practices that optimize for codebase health while maintaining team velocity. This skill provides comprehensive guidance for both PR authors and reviewers, backed by industry research and proven patterns from high-performing engineering teams.

Code review is the primary quality gate in modern software development. Poor review practices lead to slow feature velocity, missed defects, team friction, and knowledge silos. This skill codifies proven practices that prevent these failure modes.

</context>

<contemplation>

Code review exists to keep the codebase getting better over time—balance speed with quality. The goal is not perfection, but continuous improvement. Small, focused PRs reviewed quickly with clear feedback create a virtuous cycle of quality and velocity.

Key insights from research:

The skill balances prescriptive guidance with flexibility—providing clear workflows without being overly rigid.

</contemplation>

Core Principles

<principles>

  1. Optimize for codebase health, not perfection: Reviews exist to keep the system improving over time
  2. Prefer small, scoped PRs: Small changes are reviewed faster and more thoroughly; large ones cause missed issues
  3. Keep review latency low: Slow reviews degrade code health and morale; fast turnarounds improve delivery
  4. Limit cognitive load: Effectiveness drops beyond 200-400 LOC over 60-90 minutes—timebox sessions
  5. Leverage hidden wins: Code review spreads knowledge and raises team awareness

</principles>

What Authors Should Do

<methodology type="author">

Pre-Flight Checklist

<step n="1" validation="tests_pass">

Run Quality Gates Locally

</step>

<step n="2" validation="scope_clear">

Ensure Clean Scope

</step>

<step n="3" validation="description_complete">

Write Exceptional PR Description

Use this format (skim-friendly):

## Context
<!-- Why is this needed? What problem does it solve? -->
<!-- Link to issue/ticket if applicable -->

## Changes
<!-- High-level summary of what changed (not every line) -->
- Key change 1
- Key change 2
- Key change 3

## Test Plan
<!-- How can reviewers verify this works? -->
- [ ] Unit tests: `npm test path/to/tests`
- [ ] Manual testing: Steps to reproduce
- [ ] Edge cases verified: List specific scenarios tested

## Deployment Notes
- [ ] Database migration: Yes/No (details if yes)
- [ ] Feature flag: Yes/No (name if yes)
- [ ] Configuration changes: Yes/No (what changed)
- [ ] Breaking changes: Yes/No (migration path if yes)
- [ ] Rollback plan: Describe how to safely revert

## Security Considerations
<!-- If touching auth/permissions/data/secrets -->
- Input validation strategy
- Authorization checks
- Data exposure risks addressed

</step>

<step n="4" validation="self_reviewed">

Perform Self-Review

</step>

<step n="5" validation="reviewers_assigned">

Assign Appropriate Reviewers

</step>

</methodology>

What Reviewers Should Do

<methodology type="reviewer">

Two-Pass Review Process

<pass n="1" duration="5-10 minutes" focus="design">

High-Level Review: Design & Approach

Focus on big picture before diving into details:

  1. Read PR Description
  1. Assess Design & Architecture
  1. Security & Risk Pass
  1. Scope Check

Decision Point: If major issues found (wrong approach, architectural problems, security flaws), provide feedback and STOP. No need for detailed review if design is flawed.

</pass>

<pass n="2" duration="10-20 minutes" focus="implementation">

Implementation Review: Details & Correctness

Only proceed if Pass 1 looks good:

  1. Logic & Correctness
  1. Testing Quality
  1. Code Quality & Readability
  1. Documentation

Time Management: Set 30-minute timer. If you can't complete review in time:

</pass>

Comment Classification System

<comment_types>

Use these prefixes to clarify feedback severity and reduce friction:

[critical] - Must fix before merge

[issue] - Should fix, discuss if cannot

[suggestion] - Nice to have, author decides

[nit] - Purely cosmetic, optional

[question] - Seeking clarification

[praise] - Calling out good work

</comment_types>

Final Decision

After both passes (< 30 minutes total):

Batch Nits: Leave all [nit] comments in single comment block. Don't require changes—let author decide.

Praise Matters: Call out good patterns. Mentors > nit-bots. Positive reinforcement builds better teams.

</methodology>

Team-Level Patterns

<team_practices>

Establish SLAs

Define and track response time expectations:

Fast cycles correlate with healthier delivery metrics.

Size Policies

Enforce PR size limits:

CODEOWNERS

Implement automatic reviewer assignment:

Suggested Changes

Enable "suggested changes" feature:

Automate the Noise

Move mechanical checks to CI:

Keep human attention for design and correctness.

</team_practices>

Checklists

Author Pre-PR Checklist

Use /code-review-prep to run automated version, or manually verify:

Code Quality

Self-Review

Testing

Documentation

Security & Performance

PR Description

Size & Scope

Reviewer Checklist

Pass 1: High-Level (5-10 min)

Pass 2: Implementation (10-20 min)

Final Decision

Anti-Patterns to Avoid

<anti_patterns>

Author Anti-Patterns:

Reviewer Anti-Patterns:

Team Anti-Patterns:

</anti_patterns>

Integration with Claude Code

<integration>

This skill integrates with existing Claude Code commands:

Review Orchestrator:

Specialist Reviewers:

Custom Commands:

Workflow Integration:

# Author workflow
git add .
/review-orchestrator add          # Pre-commit check
git commit -m "feat: add feature"
/code-review-prep                 # Pre-PR checklist
# Open PR with generated description

# Reviewer workflow
/review-security path/to/files    # If security-sensitive
/review-quality path/to/files     # Logic and types
/review-testing path/to/files     # Test quality
# Leave classified comments, make decision

</integration>

Metrics That Matter

<metrics>

Track these indicators:

Don't track:

Use /code-review-metrics to generate health dashboard.

</metrics>

Quick Reference

<quick_reference>

As an Author:

  1. Run tests/lint/types locally
  2. Self-review your diff
  3. Write complete PR description (context, changes, test plan)
  4. Check size (< 400 lines ideal)
  5. Use /code-review-prep before opening
  6. Assign appropriate reviewers
  7. Respond to all comments before merging

As a Reviewer:

  1. Check PR size and description first
  2. Pass 1: Design & approach (5-10 min)
  3. Pass 2: Implementation & details (10-20 min)
  4. Classify all comments ([critical], [issue], [suggestion], [nit], [question], [praise])
  5. Make decision: Approve / Request Changes / Comment
  6. Total time budget: < 30 minutes

As a Team Lead:

  1. Generate PR template: /code-review-init
  2. Set up CODEOWNERS for automatic assignment
  3. Define SLAs (24h first response, 5d merge for medium PRs)
  4. Track metrics: /code-review-metrics
  5. Address anti-patterns proactively
  6. Celebrate good reviews (not just good code)

</quick_reference>

Additional Resources

<resources>

Playbook Guides:

Templates:

Workflows:

Metrics & Improvement:

</resources>

Usage Examples

Example 1: Author Preparing PR

# After completing feature work
git add .
git commit -m "feat: add user profile editing"

# Run pre-PR validation
@skill code-review
> I'm about to open a PR. Can you run the author checklist?

# Claude runs automated checks and generates:
# - Validation results (tests, lint, types)
# - PR size analysis
# - Generated PR description template
# - Suggested reviewers from CODEOWNERS
# - Readiness assessment

Example 2: Reviewer Conducting Two-Pass Review

# Assigned to review PR #456 (324 lines, auth changes)

@skill code-review
> I need to review PR #456. It modifies authentication. Let's do Pass 1.

# Claude guides through high-level review:
# - Analyzes context and approach
# - Runs `/review-security` for auth changes
# - Identifies any design issues
# - Recommends proceed to Pass 2 or provide feedback

# If Pass 1 looks good:
> Pass 1 looks good. Let's do Pass 2.

# Claude runs specialist reviewers in parallel:
# - `/review-quality` for logic and types
# - `/review-testing` for test coverage
# - `/review-readability` for code clarity
# - Aggregates findings with severity classification

Example 3: Team Lead Initializing for Team

@skill code-review
> We want to improve our code review process. Help us get started.

# Claude runs `/code-review-init`:
# - Generates .github/pull_request_template.md
# - Generates .github/CODEOWNERS
# - Creates docs/code-review-playbook.md
# - Provides team adoption roadmap
# - Suggests SLAs and policies

Note: This skill is designed to work with your existing development workflow. Start with the author checklist, adopt two-pass reviews, then expand to team-wide practices as you gain confidence.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.