agentleFS
iktok90-designiktok90-design/ai-smart-contract-auditor/skills/known-good-comparison/SKILL.md

known-good-comparison

Skill36 starsChanged 5 months agoMITView on GitHub

When auditing a contract that resembles a canonical implementation (OpenZeppelin, Solady, Uniswap, Compound, etc.), compare against the reference. Treat deviations as suspect by default.

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When finding-writing, include a reference comparison if applicable:

    line 88

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Known-good comparison (meta-skill)

Most production Solidity is forks of well-known references. The fastest path to high-precision audit is to know what "normal" looks like and treat deviations as suspect.

Reference catalog

The skill maintains awareness of canonical shapes:

Tokens

  • OpenZeppelin ERC20, ERC721, ERC1155 (versions 4.x and 5.x)
  • Solady ERC20, ERC721, ERC1155, ERC4626
  • ERC-2612 permit canonical
  • Permit2 Uniswap canonical

Access / governance

  • OZ Ownable, Ownable2Step
  • OZ AccessControl, AccessControlEnumerable, AccessControlDefaultAdminRules
  • OZ Governor, GovernorVotes, GovernorTimelockControl
  • Compound Governor Bravo
  • OZ TimelockController

Proxies / upgrades

  • OZ ERC1967, UUPS, TransparentUpgradeable
  • OZ BeaconProxy
  • Diamond standard EIP-2535 reference
  • Solady LibClone

Math / utilities

  • OZ Math.mulDiv
  • Solady FixedPointMathLib
  • PRBMath UD60x18, SD59x18

AMMs / DEX

  • Uniswap V2 Pair, Router, Factory
  • Uniswap V3 Pool, NonfungiblePositionManager
  • Uniswap V4 PoolManager + hook templates
  • Curve StableSwap, CryptoSwap
  • Balancer V2, V3 vaults

Lending

  • Aave V3 Pool, AToken, VariableDebtToken
  • Compound V3 Comet
  • Morpho Blue

Vaults

  • OZ ERC4626 (v4.9+ for inflation defense)
  • Yearn V3 strategies
  • MetaMorpho

How to use

Step 1 — Detect reference

If the contract:

  • Imports from @openzeppelin/contracts or solady/
  • Inherits from a recognizable parent
  • Implements a recognizable interface (IERC20, IPoolManager, etc.)
  • Has function signatures matching a reference

→ Identify the reference and version.

Step 2 — Diff the deviations

For each function inherited or overridden from the reference:

  • Has its body been modified?
  • Has its access control been changed?
  • Has its return value been altered?
  • Has its modifier set been changed (e.g. nonReentrant removed)?

For each storage variable added beyond the reference:

  • Is the storage layout still compatible with upgrade safety?

Step 3 — Treat deviations as suspect

Each deviation gets a justification check:

  • Was this change intentional and beneficial?
  • Or was it a typo / mistake / regression?

Most exploits in forks live in the deviation, not the reference.

Output integration

When finding-writing, include a reference comparison if applicable:

[REENT-001 | High] Reentrancy in Vault.withdraw

  Reference: OpenZeppelin v5.0.2 ERC4626.withdraw
  Deviation: caller-side nonReentrant guard removed (commit 0xabc)
  Impact:    classic reentrancy pattern reintroduced
  
  → Confidence: HIGH (deviation from known-good adds the bug)

When NOT to use

  • Pure novel implementations with no canonical parent.
  • Contracts so heavily modified that the reference comparison is misleading.

Related

  • /diff-audit command — exposes this skill as a user-facing operation
  • [[confidence-scoring]] — known-good match → confidence MEDIUM-to-HIGH
  • [[multi-pass-self-critique]] — known-good is a third independent pass

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.