diff-review

Structured code review of git diffs or pull requests. Analyzes changes for impact, risk, documentation staleness, and test coverage gaps. Produces a review report that can guide both human reviewers and automated follow-up actions.

23 stars

Best use case

diff-review is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Structured code review of git diffs or pull requests. Analyzes changes for impact, risk, documentation staleness, and test coverage gaps. Produces a review report that can guide both human reviewers and automated follow-up actions.

Teams using diff-review should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/diff-review/SKILL.md --create-dirs "https://raw.githubusercontent.com/christophacham/agent-skills-library/main/skills/code-review/diff-review/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/diff-review/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How diff-review Compares

Feature / Agentdiff-reviewStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Structured code review of git diffs or pull requests. Analyzes changes for impact, risk, documentation staleness, and test coverage gaps. Produces a review report that can guide both human reviewers and automated follow-up actions.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

# Skill: Diff Review

## What This Skill Does

Performs a **structured code review** of a git diff, commit range, or pull request. Instead of unstructured "looks good" or scattered comments, this skill produces a systematic review covering impact assessment, risk identification, documentation implications, and test coverage analysis.

This makes the AI agent an effective **code review partner** that catches things humans often miss: documentation that needs updating, edge cases in error handling, and cross-module impact.

## When to Use

- When the user asks "review my changes" or "review this PR"
- Before merging a feature branch
- After a significant refactoring to validate nothing was missed
- When preparing a PR description

Do NOT use this skill for reviewing external/upstream code or for security audits (those require specialized tools).

## Execution Model

- **Always**: the primary agent runs this skill directly.
- **Rationale**: the review needs conversation context (user can explain intent, answer questions about design choices). Running in a subagent would lose this dialogue capability.
- **Output**: chat-based review report. Optionally written to `docs/reviews/` if the user requests a persistent record.

## Workflow

### Step 1: Identify the Diff Scope

Determine what to review:

- **Uncommitted changes**: `git diff` + `git diff --staged`
- **Branch diff**: `git diff main..HEAD` (or the appropriate base branch)
- **Specific commits**: `git diff <commit1>..<commit2>`
- **PR**: `git diff $(git merge-base main HEAD)..HEAD`

Use the `question` tool if the scope is ambiguous.

Get the diff stats first for an overview:

```bash
git diff <scope> --stat
```

### Step 2: Categorize Changes

Group the changed files by type:

- **Source code**: implementation changes
- **Tests**: new or modified tests
- **Configuration**: build, CI, lint, deploy configs
- **Documentation**: README, docs/, comments
- **Dependencies**: package.json, go.mod, requirements.txt

For each category, note the volume of changes (files changed, lines added/removed).

### Step 3: Analyze Impact

For source code changes, assess:

1. **Scope**: Is this a localized change or does it touch multiple modules?
2. **Public API changes**: Are any exported functions, types, or interfaces modified?
3. **Breaking changes**: Could this break existing consumers (renamed exports, changed signatures, removed functionality)?
4. **Data model changes**: Are database schemas, config formats, or serialization formats affected?
5. **Error handling**: Are new error cases handled? Are existing error paths preserved?

### Step 4: Assess Risk

Evaluate risk factors:

| Risk Factor | Check |
|-------------|-------|
| Complexity | Large diffs (>500 lines) are higher risk |
| Cross-module | Changes spanning multiple modules increase integration risk |
| Concurrency | Changes to async/parallel code need careful review |
| Security | Auth, crypto, input validation changes are high-risk |
| Data loss | Delete operations, migrations, schema changes |
| Rollback | Can this change be easily reverted? |

### Step 5: Check Documentation Impact

Cross-reference the changed files against existing documentation:

- If module source files changed → is the module doc still accurate?
- If public API changed → does the feature doc reflect this?
- If build/deploy changed → is the README still accurate?
- If new module/feature added → is there documentation for it?

This is a lightweight version of `validate-docs` scoped to only the changed files.

### Step 6: Check Test Coverage

Analyze whether the changes are adequately tested:

- New functions/methods → are there corresponding tests?
- Changed behavior → are existing tests updated?
- Error paths → are error cases tested?
- Edge cases → are boundary conditions covered?

Note: this is a heuristic check, not a coverage tool. Flag obvious gaps.

### Step 7: Present the Review

Present the review using the format below. Use the `question` tool to discuss findings with the user.

## Review Format

```markdown
## Diff Review

### Overview

| Metric | Value |
|--------|-------|
| Files Changed | N |
| Lines Added | +N |
| Lines Removed | -N |
| Modules Affected | <list> |

### Impact Assessment

**Scope**: <localized | cross-module | system-wide>
**Breaking Changes**: <none | list>
**Public API Changes**: <none | list>

### Risk Matrix

| Area | Risk | Detail |
|------|------|--------|
| <area> | Low/Medium/High | <explanation> |

### Documentation Impact

| Doc | Status | Action Needed |
|-----|--------|---------------|
| <doc> | needs update | <what changed> |
| <doc> | still accurate | – |

### Test Coverage

| Change | Test Status |
|--------|------------|
| <change> | Covered / Gap / Missing |

### Recommendations

1. <prioritized recommendation>
2. <next recommendation>
```

## Rules

1. **Review the diff, not the entire codebase**: focus on what changed and its immediate impact. Do not do a full codebase audit.
2. **Be specific**: reference file names, line numbers, and function names. Vague feedback is useless.
3. **Separate concerns**: distinguish between "must fix" issues (bugs, breaking changes) and "consider" suggestions (style, optimization).
4. **Acknowledge intent**: if the user explained why they made a change, factor that into the review. Don't flag intentional trade-offs as issues.
5. **Documentation impact is mandatory**: always check whether the diff affects existing documentation. This is the unique value-add over generic code review.
6. **No built-in explore agent**: do NOT use the built-in `explore` subagent type.

Related Skills

web-design-reviewer

23
from christophacham/agent-skills-library

This skill enables visual inspection of websites running locally or remotely to identify and fix design issues. Triggers on requests like "review website design", "check the UI", "fix the layout", "find design problems". Detects issues with responsive design, accessibility, visual consistency, and layout breakage, then performs fixes at the source code level.

sql-code-review

23
from christophacham/agent-skills-library

Universal SQL code review assistant that performs comprehensive security, maintainability, and code quality analysis across all SQL databases (MySQL, PostgreSQL, SQL Server, Oracle). Focuses on SQL injection prevention, access control, code standards, and anti-pattern detection. Complements SQL optimization prompt for complete development coverage.

code-review:review-pr

23
from christophacham/agent-skills-library

Comprehensive pull request review using specialized agents

code-review:review-local-changes

23
from christophacham/agent-skills-library

Comprehensive review of local uncommitted changes using specialized agents with code improvement suggestions

review-and-refactor

23
from christophacham/agent-skills-library

Review and refactor code in your project according to defined instructions

requesting-code-review

23
from christophacham/agent-skills-library

Use when completing tasks, implementing major features, or before merging to verify work meets requirements

receiving-code-review

23
from christophacham/agent-skills-library

Use when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performat...

postgresql-code-review

23
from christophacham/agent-skills-library

PostgreSQL-specific code review assistant focusing on PostgreSQL best practices, anti-patterns, and unique quality standards. Covers JSONB operations, array usage, custom types, schema design, function optimization, and PostgreSQL-exclusive security features like Row Level Security (RLS).

comprehensive-review-full-review

23
from christophacham/agent-skills-library

Use when working with comprehensive review full review

codex-review

23
from christophacham/agent-skills-library

Professional code review with auto CHANGELOG generation, integrated with Codex AI

code-reviewer

23
from christophacham/agent-skills-library

Elite code review expert specializing in modern AI-powered code

code-review

23
from christophacham/agent-skills-library

Automated code review for pull requests using specialized review patterns. Analyzes code for quality, security, performance, and best practices. Use when reviewing code changes, PRs, or doing code audits.