Generated banner for Differential Review
Generated logo for Differential Review

Differential Review

Trail of BitsOfficialPublished by Trail of Bits

  • Skill
  • Review and audit
  • Security
  • CC-BY-SA-4.0
  • No issues found

From the author

Performs security-focused differential review of code changes. Adapts analysis depth to codebase size, uses git blame for context, calculates blast radius by counting callers, checks test coverage of modified code, and generates a markdown report. Use when reviewing a PR, commit, or diff for security vulnerabilities, checking whether a change re-introduces a previously fixed bug, asking what else a change could break, or finding which modified code has no test covering it.
— the description by Trail of Bits

AutoGineer summary

Written by AutoGineer from the skill’s own files, not by the author

Differential Review provides a structured, risk-based methodology for auditing code changes. It helps developers and security engineers identify potential vulnerabilities by analyzing git history, assessing test coverage, and calculating the blast radius of modifications. The skill is designed to scale its analysis depth based on codebase size and risk level, ensuring that critical changes receive rigorous scrutiny while maintaining efficiency. It produces comprehensive markdown reports that document findings, evidence, and potential attack scenarios.

What it does

  • Performs security-focused differential analysis on PRs, commits, and diffs
  • Adapts analysis depth based on codebase size and risk level
  • Uses git history to identify regressions and security-related code removals
  • Calculates blast radius by identifying transitive callers of modified code
  • Checks test coverage for modified code to identify untested security risks
  • Generates structured markdown reports with concrete findings and evidence

When to use it

  • When reviewing PRs or commits for potential security vulnerabilities
  • When assessing the impact of refactors on existing security invariants
  • When investigating whether a change re-introduces previously fixed bugs
  • When determining if modified code lacks sufficient test coverage
  • When performing deep audits on critical system changes like authentication rewrites

Advantages

  • Risk-first approach prioritizes critical areas like auth and crypto
  • Evidence-based findings linked to git history and line numbers
  • Scalable methodology suitable for small PRs or large-scale audits
  • Quantifiable blast radius analysis reduces blind spots
  • Standardized reporting ensures consistent and actionable audit documentation

Usage examples

“Review this PR for security vulnerabilities and generate a report.”
The agent analyzes the diff, checks git history for removed security code, calculates the blast radius, and outputs a markdown report detailing any identified risks.
“Does this refactor introduce any security regressions?”
The agent performs a differential review, focusing on the refactored logic and comparing it against historical git blame data to identify potential regressions.
“Perform a deep audit on this authentication system rewrite.”
The agent applies the surgical strategy, building baseline context, performing deep analysis on auth changes, and conducting adversarial modeling to identify potential exploits.

Install

  1. Download the skill as a ZIP:

    https://autogineer.com/agent-skills/trailofbits/differential-review/download
  2. Unzip it into the cross-client skills folder of your project:

    mkdir -p .agents/skills && unzip differential-review.zip -d .agents/skills

Documentation by Trail of Bits

Differential Security Review

Security-focused code review for PRs, commits, and diffs.

Core Principles

  1. Risk-First: Focus on auth, crypto, value transfer, external calls

  2. Evidence-Based: Every finding backed by git history, line numbers, attack scenarios

  3. Adaptive: Scale to codebase size (SMALL/MEDIUM/LARGE)

  4. Honest: Explicitly state coverage limits and confidence level

  5. Output-Driven: Always generate comprehensive markdown report file


Rationalizations (Do Not Skip)

RationalizationWhy It's WrongRequired Action
"Small PR, quick review"Heartbleed was 2 linesClassify by RISK, not size
"I know this codebase"Familiarity breeds blind spotsBuild explicit baseline context
"Git history takes too long"History reveals regressionsNever skip Phase 1
"Blast radius is obvious"You'll miss transitive callersCalculate quantitatively
"No tests = not my problem"Missing tests = elevated risk ratingFlag in report, elevate severity
"Just a refactor, no security impact"Refactors break invariantsAnalyze as HIGH until proven LOW
"I'll explain verbally"No artifact = findings lostAlways write report

Quick Reference

Codebase Size Strategy
Codebase SizeStrategyApproach
SMALL (<20 files)DEEPRead all deps, full git blame
MEDIUM (20-200)FOCUSED1-hop deps, priority files
LARGE (200+)SURGICALCritical paths only
Risk Level Triggers
Risk LevelTriggers
HIGHAuth, crypto, external calls, value transfer, validation removal
MEDIUMBusiness logic, state changes, new public APIs
LOWComments, tests, UI, logging

Workflow Overview

Pre-Analysis → Phase 0: Triage → Phase 1: Code Analysis → Phase 2: Test Coverage
    ↓              ↓                    ↓                        ↓
Phase 3: Blast Radius → Phase 4: Deep Context → Phase 5: Adversarial → Phase 6: Report

Decision Tree

Starting a review?

├─ Need detailed phase-by-phase methodology?
│  └─ Read: methodology.md
│     (Pre-Analysis + Phases 0-4: triage, code analysis, test coverage, blast radius)
│
├─ Analyzing HIGH RISK change?
│  ├─ Read: adversarial.md
│  │  (Phase 5: Attacker modeling, exploit scenarios, exploitability rating)
│  └─ Or delegate to: differential-review:adversarial-modeler agent
│     (Autonomous attacker modeling with concrete exploit scenarios)
│
├─ Writing the final report?
│  └─ Read: reporting.md
│     (Phase 6: Report structure, templates, formatting guidelines)
│
├─ Looking for specific vulnerability patterns?
│  └─ Read: patterns.md
│     (Regressions, reentrancy, access control, overflow, etc.)
│
└─ Quick triage only?
   └─ Use Quick Reference above, skip detailed docs

Agents

differential-review:adversarial-modeler — Models attacker perspectives and builds exploit scenarios for HIGH RISK code changes. Follows the 5-step adversarial methodology (attacker model, attack vectors, exploitability rating, exploit scenario, baseline cross-reference) and produces structured vulnerability reports. Delegate to this agent when Phase 5 analysis is needed on high-risk changes, passing that full namespaced name as subagent_type — a bare adversarial-modeler is unregistered and the dispatch fails at runtime.


Quality Checklist

Before delivering:

  • [ ] All changed files analyzed

  • [ ] Git blame on removed security code

  • [ ] Blast radius calculated for HIGH risk

  • [ ] Attack scenarios are concrete (not generic)

  • [ ] Findings reference specific line numbers + commits

  • [ ] Report file generated

  • [ ] User notified with summary


Integration

audit-context-building skill:

  • Pre-Analysis: Build baseline context

  • Phase 4: Deep context on HIGH RISK changes

issue-writer skill:

  • Transform findings into formal audit reports

  • Command: issue-writer --input DIFFERENTIAL_REVIEW_REPORT.md --format audit-report


Example Usage

Quick Triage (Small PR)
Input: 5 file PR, 2 HIGH RISK files
Strategy: Use Quick Reference
1. Classify risk level per file (2 HIGH, 3 LOW)
2. Focus on 2 HIGH files only
3. Git blame removed code
4. Generate minimal report
Time: ~30 minutes
Standard Review (Medium Codebase)
Input: 80 files, 12 HIGH RISK changes
Strategy: FOCUSED (see methodology.md)
1. Full workflow on HIGH RISK files
2. Surface scan on MEDIUM
3. Skip LOW risk files
4. Complete report with all sections
Time: ~3-4 hours
Deep Audit (Large, Critical Change)
Input: 450 files, auth system rewrite
Strategy: SURGICAL + audit-context-building
1. Baseline context with audit-context-building
2. Deep analysis on auth changes only
3. Blast radius analysis
4. Adversarial modeling
5. Comprehensive report
Time: ~6-8 hours

When NOT to Use This Skill

  • Greenfield code (no baseline to compare)

  • Documentation-only changes (no security impact)

  • Formatting/linting (cosmetic changes)

  • User explicitly requests quick summary only (they accept risk)

For these cases, use standard code review instead.


Red Flags (Stop and Investigate)

Immediate escalation triggers:

  • Removed code from "security", "CVE", or "fix" commits

  • Access control modifiers removed (onlyOwner, internal → external)

  • Validation removed without replacement

  • External calls added without checks

  • High blast radius (50+ callers) + HIGH risk change

These patterns require adversarial analysis even in quick triage.


Tips for Best Results

Do:

  • Start with git blame for removed code

  • Calculate blast radius early to prioritize

  • Generate concrete attack scenarios

  • Reference specific line numbers and commits

  • Be honest about coverage limitations

  • Always generate the output file

Don't:

  • Skip git history analysis

  • Make generic findings without evidence

  • Claim full analysis when time-limited

  • Forget to check test coverage

  • Miss high blast radius changes

  • Output report only to chat (file required)


Supporting Documentation


For first-time users: Start with methodology.md to understand the complete workflow.

For experienced users: Use this page's Quick Reference and Decision Tree to navigate directly to needed content.

Files

Requirements and compatibility

Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta

“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.

Needs: Declares allowed tools

Security

No issues found by our static scan· No issues found

A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.

Attribution and licence

Published by
Trail of Bits
Publisher
Trail of Bits (Official)
Source
trailofbits/skills · plugins/differential-review/skills/differential-review · commit e4dd0bb
Licence
Creative Commons Attribution-ShareAlike 4.0 International (redistribution allowed)
  • LICENSE (added by AutoGineer from LICENSE)
  • ATTRIBUTION.md (written by AutoGineer)
Synced

AutoGineer is not affiliated with or endorsed by Trail of Bits or Trail of Bits.

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download differential-review.zip