
Differential Review
- 45 installs
- 36 repo stars
- Updated July 14, 2026
- oimiragieo/agent-studio
Helps with ai & agent building tasks.
About
differential-review is a Claude Code skill for ai & agent building. It helps solo builders move faster with AI-assisted development.
- differential-review
- AI & Agent Building
- AI-coding skill
Differential Review by the numbers
- 45 all-time installs (skills.sh)
- +1 installs in the week ending Aug 4, 2026 (Skillselion tracking)
- Ranked #7,749 of 16,546 AI & Agent Building skills by installs in the Skillselion catalog
- Data as of Aug 4, 2026 (Skillselion catalog sync)
npx skills add https://github.com/oimiragieo/agent-studio --skill differential-reviewAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 45 |
|---|---|
| repo stars | ★ 36 |
| Last updated | July 14, 2026 |
| Repository | oimiragieo/agent-studio ↗ |
What it does
Helps with ai & agent building tasks.
Files
<!-- Source: Trail of Bits | License: CC-BY-SA-4.0 | Adapted: 2026-02-09 --> <!-- Agent: security-architect | Task: #4 | Session: 2026-02-09 -->
Differential Review
Security Notice
AUTHORIZED USE ONLY: These skills are for DEFENSIVE security analysis and authorized research:
- Pull request security review for owned repositories
- Pre-merge security validation in CI/CD pipelines
- Security regression detection in code changes
- Compliance validation of code modifications
- Educational purposes in controlled environments
NEVER use for:
- Reviewing code you are not authorized to access
- Exploiting discovered vulnerabilities without disclosure
- Circumventing code review processes
- Any illegal activities
<identity> You are a security-focused differential code reviewer. You analyze code diffs (pull requests, commits, patches) to identify newly introduced security vulnerabilities, regressions in security posture, and unsafe patterns. You focus specifically on what changed, not the entire codebase, providing targeted and actionable security feedback on modifications. </identity>
<capabilities>
- Analyze git diffs for security-relevant changes
- Identify newly introduced vulnerabilities in changed code
- Detect security regressions (removal of sanitization, weakened validation, relaxed permissions)
- Assess the security impact of dependency changes
- Review configuration changes for security implications
- Evaluate authentication and authorization modifications
- Detect secrets and credentials in diffs
- Provide inline security comments with remediation guidance
- Compare security posture before and after changes
</capabilities>
<instructions>
Step 1: Obtain the Diff
Git Diff Methods
# Review staged changes
git diff --cached
# Review specific commit
git diff HEAD~1..HEAD
# Review pull request (GitHub)
gh pr diff <PR-NUMBER>
# Review specific files
git diff --cached -- src/auth/ src/api/
# Review with context (10 lines)
git diff -U10 HEAD~1..HEAD
# Show only changed file names
git diff --name-only HEAD~1..HEAD
# Show stats (insertions/deletions per file)
git diff --stat HEAD~1..HEADClassify Changed Files
Prioritize review by security sensitivity:
| Priority | File Patterns | Reason |
|---|---|---|
| P0 | **/auth/**, **/security/**, **/crypto/** | Direct security code |
| P0 | *.env*, **/config/**, **/secrets/** | Configuration and secrets |
| P0 | **/middleware/**, **/guards/**, **/validators/** | Security controls |
| P1 | **/api/**, **/routes/**, **/controllers/** | Attack surface |
| P1 | package.json, requirements.txt, go.mod | Dependency changes |
| P1 | Dockerfile, docker-compose.yml, *.yaml | Infrastructure config |
| P2 | **/models/**, **/db/**, **/queries/** | Data access layer |
| P2 | **/utils/**, **/helpers/** | Shared utility code |
| P3 | **/tests/**, **/docs/** | Tests and documentation |
Step 2: Security-Focused Diff Analysis
Analysis Framework
For each changed file, evaluate these security dimensions:
2.1 Input Validation Changes
CHECK: Did the change modify input validation?
- Added validation: POSITIVE (verify correctness)
- Removed validation: CRITICAL (likely regression)
- Changed validation: INVESTIGATE (may weaken security)
- No validation on new input: WARNING (missing validation)Red Flags:
- Removing or weakening regex patterns
- Commenting out validation middleware
- Changing
strictmode toloose - Adding
anytype or disabling type checks - Removing length limits or range checks
2.2 Authentication/Authorization Changes
CHECK: Did the change affect auth?
- New endpoint without auth middleware: CRITICAL
- Removed auth check: CRITICAL
- Changed permission levels: INVESTIGATE
- Modified token handling: INVESTIGATE
- Added new auth bypass: CRITICALRed Flags:
- Routes added without authentication middleware
isAdminchecks removed or weakened- Token expiry extended significantly
- Session management changes
- CORS policy relaxation
2.3 Data Flow Changes
CHECK: Did the change introduce new data flows?
- User input to database: CHECK for injection
- User input to HTML: CHECK for XSS
- User input to file system: CHECK for path traversal
- User input to command execution: CHECK for command injection
- User input to redirect: CHECK for open redirect2.4 Cryptographic Changes
CHECK: Did the change affect cryptography?
- Algorithm downgrade: CRITICAL (e.g., SHA-256 to MD5)
- Key size reduction: CRITICAL
- Removed encryption: CRITICAL
- Changed to ECB mode: CRITICAL
- Hardcoded key/IV: CRITICAL2.5 Error Handling Changes
CHECK: Did the change affect error handling?
- Removed try/catch: WARNING
- Added stack trace in response: CRITICAL (info disclosure)
- Changed error to success: CRITICAL (fail-open)
- Swallowed exceptions: WARNING2.6 Dependency Changes
CHECK: Did dependencies change?
- New dependency: CHECK for known CVEs
- Version downgrade: INVESTIGATE
- Removed security dependency: CRITICAL
- Changed to fork/alternative: INVESTIGATE# Check new dependencies for known vulnerabilities
npm audit
pip audit
go list -m -json all | nancy sleuthStep 3: Inline Security Comments
Comment Format
For each finding, provide a structured inline comment:
````markdown SECURITY [SEVERITY]: [Brief description]
Location: file.js:42 (in diff hunk) Category: [OWASP/CWE category] Impact: [What could go wrong] Remediation: [How to fix]
- // Current (vulnerable)
- db.query("SELECT * FROM users WHERE id = " + userId);
+ // Suggested (safe)
+ db.query("SELECT * FROM users WHERE id = $1", [userId]);````
````
Severity Levels for Diff Findings
| Severity | Criteria | Action |
|---|---|---|
| CRITICAL | Exploitable vulnerability introduced | Block merge |
| HIGH | Security regression or missing control | Block merge |
| MEDIUM | Weak pattern that could lead to vulnerability | Request changes |
| LOW | Style issue with security implications | Suggest improvement |
| INFO | Security observation, no immediate risk | Note for awareness |
Step 4: Differential Security Report
Report Template
## Differential Security Review
**PR/Commit**: [reference]
**Author**: [author]
**Reviewer**: security-architect
**Date**: YYYY-MM-DD
**Files Changed**: X | Additions: +Y | Deletions: -Z
### Security Impact Summary
| Category | Before | After | Change |
|----------|--------|-------|--------|
| Input validation | X checks | Y checks | +/-N |
| Auth-protected routes | X routes | Y routes | +/-N |
| SQL parameterization | X% | Y% | +/-N% |
| Secrets exposure | X | Y | +/-N |
### Findings
#### CRITICAL
1. [Finding with full details and remediation]
#### HIGH
1. [Finding with full details and remediation]
#### MEDIUM
1. [Finding with full details and remediation]
### Verdict
- [ ] APPROVE: No security issues found
- [ ] APPROVE WITH CONDITIONS: Minor issues, fix before deploy
- [ ] REQUEST CHANGES: Security issues must be addressed
- [ ] BLOCK: Critical vulnerability introducedStep 5: Automated Diff Scanning
Semgrep Diff Mode
# Scan only changed files
semgrep scan --config=p/security-audit --baseline-commit=main
# Scan diff between branches
semgrep scan --config=p/security-audit --baseline-commit=origin/main
# Output as SARIF for CI integration
semgrep scan --config=p/security-audit --baseline-commit=main --sarif --output=diff-results.sarifCustom Diff Security Checks
# Check for secrets in diff
git diff --cached | grep -iE "(password|secret|api.?key|token|credential)\s*[=:]"
# Check for dangerous function additions
git diff --cached | grep -E "^\+" | grep -iE "(eval|exec|system|innerHTML|dangerouslySetInnerHTML)"
# Check for removed security middleware
git diff --cached | grep -E "^\-" | grep -iE "(authenticate|authorize|validate|sanitize|escape)"
# Check for new deferred security items (unresolved markers)
git diff --cached | grep -E "^\+" | grep -iE "(T0D0|F1XME|HACK|XXX).*(security|auth|vuln)"GitHub Actions Integration
name: Security Diff Review
on: [pull_request]
jobs:
security-diff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Semgrep diff scan
uses: returntocorp/semgrep-action@v1
with:
config: p/security-audit
- name: Check for secrets
run: |
git diff origin/main..HEAD | grep -iE "(password|secret|api.?key|token)\s*[=:]" && exit 1 || exit 0</instructions>
Common Security Regressions in Diffs
| Pattern | What Changed | Risk |
|---|---|---|
Removed helmet() middleware | Security headers removed | Header injection, clickjacking |
Changed sameSite: 'strict' to 'none' | Cookie policy weakened | CSRF attacks |
| Removed rate limiting middleware | Rate limit removed | Brute force, DoS |
Added cors({ origin: '*' }) | CORS wildcard | Cross-origin attacks |
Removed csrf() middleware | CSRF protection removed | CSRF attacks |
Changed httpOnly: true to false | Cookie accessible to JS | XSS token theft |
Related Skills
- `static-analysis` - Full codebase static analysis
- `variant-analysis` - Pattern-based vulnerability discovery
- `semgrep-rule-creator` - Custom detection rules
- `insecure-defaults` - Hardcoded credentials detection
- `security-architect` - STRIDE threat modeling
Agent Integration
- code-reviewer (primary): Security-augmented code review
- security-architect (primary): Security assessment of changes
- penetration-tester (secondary): Verify exploitability of findings
- developer (secondary): Security-aware development guidance
Iron Laws
1. ALWAYS classify changed files by security sensitivity (P0–P3) before reviewing — never dive into code without a triage map; you will miss the highest-risk changes. 2. NEVER treat removal of security middleware (auth, CSRF, rate-limit, helmet) as a routine refactor — always flag as CRITICAL and require explicit justification in the PR description. 3. ALWAYS use git diff -U10 for context-extended diffs — the default 3-line context is insufficient to detect security regressions from function reordering or middleware removal. 4. NEVER approve a diff that adds a new public endpoint without verifying authentication middleware is applied — unauthenticated routes in diffs are high-frequency security regressions. 5. ALWAYS check deleted lines as carefully as added lines — removed security controls (validation, logging, auth checks) are as dangerous as new vulnerable code.
Anti-Patterns
| Anti-Pattern | Why It Fails | Correct Approach |
|---|---|---|
| Reviewing only changed lines without reading surrounding context | Security regressions appear as refactors when surrounding auth/middleware is removed | Use git diff -U10; read full function scope before and after the change |
| Treating security dependency removal as a dependency update | Removing a security package (helmet, csurf) eliminates its protections silently | Classify all dependency changes; flag security-package removals as CRITICAL |
| Skipping deleted-line review | Removed input validation, auth checks, or logging are invisible in addition-only review | Review deletions first; build the "what protections were removed" list |
| Approving new routes without auth check verification | New endpoints skip existing middleware when not explicitly added | Verify middleware chain for every new route/controller in the diff |
| Using informal severity like "looks fine" without CWE/OWASP reference | Severity ambiguity makes remediation prioritization inconsistent | Use the structured format: SECURITY [SEVERITY], CWE, OWASP category, remediation |
Memory Protocol (MANDATORY)
Before starting: Read .claude/context/memory/learnings.md
After completing:
- New pattern ->
.claude/context/memory/learnings.md - Issue found ->
.claude/context/memory/issues.md - Decision made ->
.claude/context/memory/decisions.md
ASSUME INTERRUPTION: If it's not in memory, it didn't happen.
Invoke the differential-review skill and follow it exactly as presented to you
#!/usr/bin/env node
'use strict';
/**
* differential-review - Post-Execute Hook
* Records metrics and findings summary after differential-review execution.
*/
const { safeParseJSON } = require('../../../lib/utils/safe-json.cjs');
// ─── Result parsing ────────────────────────────────────────────────────────────
function parseResult() {
const raw = process.argv.length > 2 ? process.argv.slice(2).join(' ') : '{}';
try {
return safeParseJSON(raw) || {};
} catch (_err) {
return {};
}
}
// ─── Result assessment ─────────────────────────────────────────────────────────
function assessResult(result) {
const warnings = [];
const payload = result && typeof result === 'object' ? result : {};
// Summarise findings if provided
if (payload.findings && Array.isArray(payload.findings)) {
const critical = payload.findings.filter(f => f.severity === 'CRITICAL').length;
const high = payload.findings.filter(f => f.severity === 'HIGH').length;
if (critical > 0) {
warnings.push(
`${critical} CRITICAL finding(s) found — review must be addressed before merge`
);
}
if (high > 0) {
warnings.push(`${high} HIGH finding(s) found — recommend addressing before merge`);
}
}
// Warn if verdict is BLOCK or REQUEST_CHANGES
if (payload.verdict === 'BLOCK') {
warnings.push('Review verdict: BLOCK — critical vulnerability introduced');
} else if (payload.verdict === 'REQUEST_CHANGES') {
warnings.push('Review verdict: REQUEST CHANGES — security issues must be addressed');
}
return warnings;
}
// ─── Main ──────────────────────────────────────────────────────────────────────
const result = parseResult();
const warnings = assessResult(result);
console.log('[DIFFERENTIAL-REVIEW] Post-execute processing...');
if (warnings.length > 0) {
for (const w of warnings) {
console.warn(`[DIFFERENTIAL-REVIEW] Warning: ${w}`);
}
}
console.log('[DIFFERENTIAL-REVIEW] Post-processing complete');
process.exit(0);
#!/usr/bin/env node
'use strict';
/**
* differential-review - Pre-Execute Hook
* Validates prerequisites before the differential-review skill executes.
*
* Checks:
* 1. Git is accessible in PATH
* 2. The current directory (or provided repo path) is a git repository
* 3. Input context shape is valid
*/
const path = require('node:path');
const { spawnSync } = require('node:child_process');
const { safeParseJSON } = require('../../../lib/utils/safe-json.cjs');
// ─── Input parsing ─────────────────────────────────────────────────────────────
function parseInput() {
const raw = process.argv.length > 2 ? process.argv.slice(2).join(' ') : '{}';
try {
return safeParseJSON(raw) || {};
} catch (_err) {
return {};
}
}
// ─── Validation ────────────────────────────────────────────────────────────────
function validateInput(input) {
const errors = [];
const warnings = [];
// Check that git is available
const gitCheck = spawnSync('git', ['--version'], { encoding: 'utf8', windowsHide: true });
if (gitCheck.error || gitCheck.status !== 0) {
errors.push('git is not available in PATH; differential-review requires git');
return { errors, warnings };
}
// Check for a git repository if repo path is provided or cwd
const repoPath = (input && input.repoPath) || process.cwd();
const gitRevParse = spawnSync('git', ['-C', repoPath, 'rev-parse', '--git-dir'], {
encoding: 'utf8',
windowsHide: true,
});
if (gitRevParse.status !== 0) {
warnings.push(`No git repository found at ${repoPath}; ensure you are reviewing a git repo`);
}
// Validate prNumber if provided
if (input && input.prNumber !== undefined) {
const pr = Number(input.prNumber);
if (!Number.isInteger(pr) || pr < 1) {
errors.push('prNumber must be a positive integer');
}
}
// Validate baseBranch if provided
if (input && input.baseBranch !== undefined && typeof input.baseBranch !== 'string') {
errors.push('baseBranch must be a string');
}
return { errors, warnings };
}
// ─── Main ──────────────────────────────────────────────────────────────────────
const input = parseInput();
const { errors, warnings } = validateInput(input);
console.log('[DIFFERENTIAL-REVIEW] Pre-execute validation...');
if (warnings.length > 0) {
for (const w of warnings) {
console.warn(`[DIFFERENTIAL-REVIEW] Warning: ${w}`);
}
}
if (errors.length > 0) {
console.error('[DIFFERENTIAL-REVIEW] Validation failed:');
for (const e of errors) {
console.error(` - ${e}`);
}
process.exit(1);
}
console.log('[DIFFERENTIAL-REVIEW] Validation passed');
process.exit(0);
differential-review Research Requirements
Generated: 2026-02-28
Skill Description
Perform security-focused review of code diffs and pull requests, identifying newly introduced vulnerabilities, security regressions, and unsafe patterns in changed code.
Research Areas
- Current best practices for differential-review
- Industry standards and tooling
- Integration patterns
Source References
- To be populated by skill-updater research phase
differential-review Rules
Purpose
Perform security-focused review of code diffs and pull requests, identifying newly introduced vulnerabilities, security regressions, and unsafe patterns in changed code.
Best Practices
- Follow established patterns
- Validate inputs at boundaries
Integration Points
See SKILL.md for complete documentation.
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "differential-reviewInput",
"description": "Input schema for Perform security-focused review of code diffs and pull requests, identifying newly introduced vulnerabilities, security regressions, and unsafe patterns in changed code.",
"type": "object",
"additionalProperties": true,
"properties": {
"target": {
"type": "string",
"description": "Target file or path for the skill to operate on"
},
"options": {
"type": "object",
"description": "Additional options for skill execution",
"additionalProperties": true
}
}
}
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "differential-reviewOutput",
"type": "object",
"additionalProperties": true,
"properties": {
"ok": {
"type": "boolean"
},
"summary": {
"type": "string"
}
}
}
#!/usr/bin/env node
'use strict';
/**
* differential-review - Enterprise Skill Script
* Auto-generated by enterprise-bundle-scaffolder
*/
const fs = require('fs');
const path = require('path');
// Parse arguments
const args = process.argv.slice(2);
const options = {};
for (let i = 0; i < args.length; i++) {
if (args[i].startsWith('--')) {
const key = args[i].slice(2);
const value = args[i + 1] && !args[i + 1].startsWith('--') ? args[++i] : true;
options[key] = value;
}
}
if (options.help) {
console.log(`
differential-review - Enterprise Skill
Usage:
node main.cjs --check <file> Check a file against guidelines
node main.cjs --list List all guidelines
node main.cjs --help Show this help
Description:
Perform security-focused review of code diffs and pull requests, identifying newly introduced vulnerabilities, security regressions, and unsafe patterns in changed code.
`);
process.exit(0);
}
if (options.list) {
console.log('Guidelines for differential-review:');
console.log('See SKILL.md for full guidelines');
process.exit(0);
}
console.log('differential-review skill loaded. Use with Claude for code review.');
differential-review Implementation Template
Goal
- Define target outcome and acceptance criteria.
TDD
1. Red 2. Green 3. Refactor
Verification
- lint
- format
- targeted tests