/auditsentry:storage-layoutfrom auditsentry
Detects storage-layout issues in upgradeable Solidity contracts: slot collisions, reuse, packing changes, missing __gap. Useful when reviewing UUPS/Transparent proxies, OZ Upgradeable, diamonds, or assembly storage reads.
Ships in auditsentry. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
*Upgradeable contractscontract BaseUpgradeable {
uint256 public foo;
// no uint256[50] __gap; ← can't append fields to derived contracts safely
}
OZ convention: each base contract reserves __gap for future fields.
Implementation defines address public owner in slot 0; proxy uses slot 0 for its admin. Hello, hijacked proxy.
Use EIP-1967 slots (bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1)).
// V1: contract X is A, B, C
// V2: contract X is A, C, B ← B's vars now at C's old slots
Even one append to a parent breaks all descendants.
Solidity packs adjacent same-bit-width fields. Inserting a bool between two uint256 adds a slot. Verify with forge inspect <Contract> storage.
uint8 → uint256 changes packing.
assembly { sstore(0x0, value) } // ← collides with the consumer's slot 0
Use namespaced storage (keccak256("myapp.storage.foo")).
Two facets using the same bytes32 STORAGE_POSITION. Always derive from a unique namespace string.
Modern best-practice: use @custom:storage-location erc7201:my.namespace.
| Pattern | Severity |
|---|---|
| Proxy/impl slot 0 collision | Critical |
| Slot reuse after upgrade (data corruption) | Critical |
| Struct reorder in upgrade | High |
| Inheritance reorder | High |
Missing __gap in upgradeable base | High |
| Diamond storage collision | High |
| Library writing to fixed low slots | High |
| ERC-7201 missing on new namespaced module | Medium |
| Variable rename only (same slot) | Info |
forge inspect <Contract> storageLayout for V1 and V2; diff JSON. Any non-append change = abort.validateUpgrade() catches most layout breaks at build time.uint256[N] private __gap at the end (size by convention).immutable variable doesn't change storage layout (lives in bytecode, not storage).What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub iktok90-design/ai-smart-contract-auditor --plugin auditsentry45 skills in this plugin
/access-controlDetect missing or incorrect access control — missing modifiers, wrong role checks, privileged function exposure, public initializers, and role-escalation paths. Activate on any function that mutates state, transfers funds, mints tokens, sets admin parameters, upgrades implementations, or pauses/unpauses./approval-issuesDetect ERC-20 approval pitfalls — approve race (front-run), missing safeApprove, infinite approvals, approval-without-revoke, Permit2 misuse, max-approval to untrusted contracts. Activate on `approve`, `safeApprove`, `permit`, `forceApprove`, `Permit2`, `IERC20.allowance`./caching-and-incrementalAlways-on meta-skill — cache audit results per file by content hash so unchanged files aren't re-analyzed on subsequent runs. Activate on every /audit, /quick-scan, /audit-changes invocation./centralization-riskDetect centralization and trust-assumption risks — admin powers, single-key risk, missing timelocks, upgrade authority, treasury keys, pause permanence, blacklisting authority, oracle authority. Activate on `onlyOwner`, `onlyRole`, `AccessControl`, upgrade authorizations, pause/unpause functions, mint/burn caps, treasury/fee setters./confidence-scoringAlways-on meta-skill — for every finding produced, attach a confidence level (HIGH/MEDIUM/LOW) and a reasoning trace. Activate on every /audit, /audit-deep, /audit-changes, /audit-live, /quick-scan invocation./cosmwasmDetect bug classes specific to CosmWasm (Rust) contracts — missing info.sender authorization in execute handlers, unbounded map iteration → gas/DoS, reply/submessage reply_id confusion, migrate admin backdoors, addr_validate vs raw string addresses, unchecked info.funds, Uint128 overflow, query reentrancy, and migration/version state. Activate on any `.rs` file with `use cosmwasm_std`, `#[entry_point]`, `ExecuteMsg`, `InstantiateMsg`, `QueryMsg`, `cw_storage_plus`, or `DepsMut`.Other plugins' skills for the same job