skills/differential-review/SKILL.md
Compare two versions of a codebase to identify security implications of changes. Use when reviewing protocol upgrades, verifying bug fixes, auditing dependency updates, or when only a subset of code has changed since the last audit.
npx skillsauth add 0x-shashi/web3-audit-skills skills/differential-reviewInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
4 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Compare two versions of a codebase to identify security implications of changes. Essential for protocol upgrades, bug fix verification, and dependency updates.
A full audit of an already-audited codebase is wasteful if only 5% of the code changed. Differential review focuses effort on:
| Change Type | Risk Level | Examples | |-------------|------------|----------| | Logic changes | HIGH | Modified calculation, new branching, changed access control | | State variable changes | HIGH | New storage, modified types, reordered variables | | Dependency updates | MEDIUM-HIGH | OpenZeppelin upgrade, Solidity version change | | Configuration changes | MEDIUM | Changed thresholds, updated addresses, new roles | | Formatting only | NONE | Whitespace, comments, variable renames | | New code | HIGH | Entirely new functions/contracts | | Removed code | MEDIUM | Deleted security checks, removed functionality |
| Change | Security Relevant? | Needs Review? | |--------|-------------------|---------------| | Function body modified | YES | ALWAYS | | New function added | YES | FULL AUDIT | | Function removed | MAYBE | Check if security-critical | | Access control modified | YES | ALWAYS | | Storage variable added | YES (upgrade compat) | ALWAYS | | Storage variable removed | YES (dangerous) | ALWAYS | | Storage variable reordered | YES (proxy breakage) | ALWAYS | | Import changed | MAYBE | Check changelog | | Compiler version changed | MAYBE | Check breaking changes | | Comment changed | NO | Skip | | Whitespace changed | NO | Skip | | Event added/modified | LOW | Quick review | | Error message changed | NO | Skip | | Constant changed | MAYBE | Verify new value |
# Between two git tags/commits
git diff v1.0..v2.0 -- '*.sol'
git diff v1.0..v2.0 --stat # Summary of changed files
# Between two branches
git diff main..feature-branch -- 'contracts/'
# Exclude non-code changes
git diff v1..v2 -- '*.sol' ':!test/' ':!script/'
Sort the diff output into categories:
For each modified function:
| Pitfall | Example | Impact |
|---------|---------|--------|
| Storage slot collision | Adding variable before existing ones in upgradeable proxy | Critical — corrupted state |
| Initializer re-callable | initialize() without initializer guard after upgrade | Critical — protocol takeover |
| selfdestruct in new impl | Attacker calls selfdestruct on implementation | Critical — proxy bricked |
| Removed security check | Deleted onlyOwner modifier in upgrade | Critical — access control loss |
| Changed function selector | Renamed function breaks integrations | High — broken integrations |
| Immutable value changed | Constructor value differs in new deployment | Medium — unexpected behavior |
development
Systematically hunt for every variant of a discovered vulnerability across the entire codebase. Use when a bug is found and all instances of the same root cause pattern must be identified, or when performing variant analysis during competitive audits on Code4rena or Sherlock.
testing
Use when the user wants to audit TON smart contracts for security vulnerabilities, scan FunC or Tact contracts for message chain replay, bounce handling, or gas issues, review TON DeFi protocols for actor-model concurrency flaws, or analyze asynchronous message passing security.
tools
Analyze ERC20/ERC721/ERC1155 token implementations for non-standard behavior, fee-on-transfer mechanics, rebasing logic, blacklists, pausability, and integration risks. Use when reviewing protocols that interact with external tokens or implementing token-related features.
testing
Use when the user wants to audit Sui Move smart contracts, scan Sui-specific patterns including object ownership, shared objects, or dynamic fields, review Sui DeFi protocols for object model security issues, or analyze Sui-specific transaction and consensus patterns.