Differential Security Review
Security-focused code review for PRs, commits, and diffs.
When to Use
- You need a security-focused review of a PR, commit range, or diff rather than a general code review.
- The changes touch auth, crypto, external calls, value transfer, permissions, or other high-risk logic.
- You need findings backed by code evidence, attack scenarios, and an explicit report artifact.
Core Principles
- Risk-First: Focus on auth, crypto, value transfer, external calls
- Evidence-Based: Every finding backed by git history, line numbers, attack scenarios
- Adaptive: Scale to codebase size (SMALL/MEDIUM/LARGE)
- Honest: Explicitly state coverage limits and confidence level
- Output-Driven: Always generate comprehensive markdown report file
Rationalizations (Do Not Skip)
| Rationalization |
Why It's Wrong |
Required Action |
| "Small PR, quick review" |
Heartbleed was 2 lines |
Classify by RISK, not size |
| "I know this codebase" |
Familiarity breeds blind spots |
Build explicit baseline context |
| "Git history takes too long" |
History reveals regressions |
Never skip Phase 1 |
| "Blast radius is obvious" |
You'll miss transitive callers |
Calculate quantitatively |
| "No tests = not my problem" |
Missing tests = elevated risk rating |
Flag in report, elevate severity |
| "Just a refactor, no security impact" |
Refactors break invariants |
Analyze as HIGH until proven LOW |
| "I'll explain verbally" |
No artifact = findings lost |
Always write report |
Quick Reference
Codebase Size Strategy
| Codebase Size |
Strategy |
Approach |
| SMALL (<20 files) |
DEEP |
Read all deps, full git blame |
| MEDIUM (20-200) |
FOCUSED |
1-hop deps, priority files |
| LARGE (200+) |
SURGICAL |
Critical paths only |
Risk Level Triggers
| Risk Level |
Triggers |
| HIGH |
Auth, crypto, external calls, value transfer, validation removal |
| MEDIUM |
Business logic, state changes, new public APIs |
| LOW |
Comments, 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)
│
├─ 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
Quality Checklist
Before delivering:
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
- methodology.md - Detailed phase-by-phase workflow (Phases 0-4)
- adversarial.md - Attacker modeling and exploit scenarios (Phase 5)
- reporting.md - Report structure and formatting (Phase 6)
- patterns.md - Common vulnerability patterns reference
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.
Limitations
- Use this skill only when the task clearly matches the scope described above.
- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
1---
2name: differential-review
3description: "Security-focused code review for PRs, commits, and diffs."
4risk: unknown
5source: community
6metadata:
7 source: https://skillmd.com/skills/arjumaan/differential-review
8---
9
10# Differential Security Review
11
12Security-focused code review for PRs, commits, and diffs.
13
14## When to Use
15- You need a security-focused review of a PR, commit range, or diff rather than a general code review.
16- The changes touch auth, crypto, external calls, value transfer, permissions, or other high-risk logic.
17- You need findings backed by code evidence, attack scenarios, and an explicit report artifact.
18
19## Core Principles
20
211. **Risk-First**: Focus on auth, crypto, value transfer, external calls
222. **Evidence-Based**: Every finding backed by git history, line numbers, attack scenarios
233. **Adaptive**: Scale to codebase size (SMALL/MEDIUM/LARGE)
244. **Honest**: Explicitly state coverage limits and confidence level
255. **Output-Driven**: Always generate comprehensive markdown report file
26
27---
28
29## Rationalizations (Do Not Skip)
30
31| Rationalization | Why It's Wrong | Required Action |
32|-----------------|----------------|-----------------|
33| "Small PR, quick review" | Heartbleed was 2 lines | Classify by RISK, not size |
34| "I know this codebase" | Familiarity breeds blind spots | Build explicit baseline context |
35| "Git history takes too long" | History reveals regressions | Never skip Phase 1 |
36| "Blast radius is obvious" | You'll miss transitive callers | Calculate quantitatively |
37| "No tests = not my problem" | Missing tests = elevated risk rating | Flag in report, elevate severity |
38| "Just a refactor, no security impact" | Refactors break invariants | Analyze as HIGH until proven LOW |
39| "I'll explain verbally" | No artifact = findings lost | Always write report |
40
41---
42
43## Quick Reference
44
45### Codebase Size Strategy
46
47| Codebase Size | Strategy | Approach |
48|---------------|----------|----------|
49| SMALL (<20 files) | DEEP | Read all deps, full git blame |
50| MEDIUM (20-200) | FOCUSED | 1-hop deps, priority files |
51| LARGE (200+) | SURGICAL | Critical paths only |
52
53### Risk Level Triggers
54
55| Risk Level | Triggers |
56|------------|----------|
57| HIGH | Auth, crypto, external calls, value transfer, validation removal |
58| MEDIUM | Business logic, state changes, new public APIs |
59| LOW | Comments, tests, UI, logging |
60
61---
62
63## Workflow Overview
64
65```
66Pre-Analysis → Phase 0: Triage → Phase 1: Code Analysis → Phase 2: Test Coverage
67 ↓ ↓ ↓ ↓
68Phase 3: Blast Radius → Phase 4: Deep Context → Phase 5: Adversarial → Phase 6: Report
69```
70
71---
72
73## Decision Tree
74
75**Starting a review?**
76
77```
78├─ Need detailed phase-by-phase methodology?
79│ └─ Read: methodology.md
80│ (Pre-Analysis + Phases 0-4: triage, code analysis, test coverage, blast radius)
81│
82├─ Analyzing HIGH RISK change?
83│ └─ Read: adversarial.md
84│ (Phase 5: Attacker modeling, exploit scenarios, exploitability rating)
85│
86├─ Writing the final report?
87│ └─ Read: reporting.md
88│ (Phase 6: Report structure, templates, formatting guidelines)
89│
90├─ Looking for specific vulnerability patterns?
91│ └─ Read: patterns.md
92│ (Regressions, reentrancy, access control, overflow, etc.)
93│
94└─ Quick triage only?
95 └─ Use Quick Reference above, skip detailed docs
96```
97
98---
99
100## Quality Checklist
101
102Before delivering:
103
104- [ ] All changed files analyzed
105- [ ] Git blame on removed security code
106- [ ] Blast radius calculated for HIGH risk
107- [ ] Attack scenarios are concrete (not generic)
108- [ ] Findings reference specific line numbers + commits
109- [ ] Report file generated
110- [ ] User notified with summary
111
112---
113
114## Integration
115
116**audit-context-building skill:**
117- Pre-Analysis: Build baseline context
118- Phase 4: Deep context on HIGH RISK changes
119
120**issue-writer skill:**
121- Transform findings into formal audit reports
122- Command: `issue-writer --input DIFFERENTIAL_REVIEW_REPORT.md --format audit-report`
123
124---
125
126## Example Usage
127
128### Quick Triage (Small PR)
129```
130Input: 5 file PR, 2 HIGH RISK files
131Strategy: Use Quick Reference
1321. Classify risk level per file (2 HIGH, 3 LOW)
1332. Focus on 2 HIGH files only
1343. Git blame removed code
1354. Generate minimal report
136Time: ~30 minutes
137```
138
139### Standard Review (Medium Codebase)
140```
141Input: 80 files, 12 HIGH RISK changes
142Strategy: FOCUSED (see methodology.md)
1431. Full workflow on HIGH RISK files
1442. Surface scan on MEDIUM
1453. Skip LOW risk files
1464. Complete report with all sections
147Time: ~3-4 hours
148```
149
150### Deep Audit (Large, Critical Change)
151```
152Input: 450 files, auth system rewrite
153Strategy: SURGICAL + audit-context-building
1541. Baseline context with audit-context-building
1552. Deep analysis on auth changes only
1563. Blast radius analysis
1574. Adversarial modeling
1585. Comprehensive report
159Time: ~6-8 hours
160```
161
162---
163
164## When NOT to Use This Skill
165
166- **Greenfield code** (no baseline to compare)
167- **Documentation-only changes** (no security impact)
168- **Formatting/linting** (cosmetic changes)
169- **User explicitly requests quick summary only** (they accept risk)
170
171For these cases, use standard code review instead.
172
173---
174
175## Red Flags (Stop and Investigate)
176
177**Immediate escalation triggers:**
178- Removed code from "security", "CVE", or "fix" commits
179- Access control modifiers removed (onlyOwner, internal → external)
180- Validation removed without replacement
181- External calls added without checks
182- High blast radius (50+ callers) + HIGH risk change
183
184These patterns require adversarial analysis even in quick triage.
185
186---
187
188## Tips for Best Results
189
190**Do:**
191- Start with git blame for removed code
192- Calculate blast radius early to prioritize
193- Generate concrete attack scenarios
194- Reference specific line numbers and commits
195- Be honest about coverage limitations
196- Always generate the output file
197
198**Don't:**
199- Skip git history analysis
200- Make generic findings without evidence
201- Claim full analysis when time-limited
202- Forget to check test coverage
203- Miss high blast radius changes
204- Output report only to chat (file required)
205
206---
207
208## Supporting Documentation
209
210- **methodology.md** - Detailed phase-by-phase workflow (Phases 0-4)
211- **adversarial.md** - Attacker modeling and exploit scenarios (Phase 5)
212- **reporting.md** - Report structure and formatting (Phase 6)
213- **patterns.md** - Common vulnerability patterns reference
214
215---
216
217**For first-time users:** Start with methodology.md to understand the complete workflow.
218
219**For experienced users:** Use this page's Quick Reference and Decision Tree to navigate directly to needed content.
220
221## Limitations
222- Use this skill only when the task clearly matches the scope described above.
223- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
224- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.