Agent skill

Storage Layout Safety

by PlamenTSV in PlamenTSV/plamen

Type Thought-template (instantiate before use) - Trigger Pattern STORAGELAYOUT flag detected

MITAuto-check passedBackend & APIs

Install Storage Layout Safety

skills CLI
$ npx skills add PlamenTSV/plamen --skill storage-layout-safety -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install PlamenTSV/plamen storage-layout-safety --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/PlamenTSV/plamen.git skills-src && mkdir -p .claude/skills && cp -r skills-src/agents/skills/evm/storage-layout-safety .claude/skills/storage-layout-safety && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
storage-layout-safety
GitHub stars
303
Token cost
~2.8k tokens
SKILL.md length
1,315 words
Files
1
Skills in repo
87
Repo updated
First seen
Licence
MIT

At a glance

Type Thought-template (instantiate before use) - Trigger Pattern STORAGELAYOUT flag detected

  • Works in 5 steps: Storage Surface Inventory → Memory vs Storage Confusion → Proxy Storage Layout Analysis → …
  • Pattern STORAGELAYOUT flag detected
  • SKILL.md covers Trigger Patterns, Step 1: Storage Surface…, Step 2: Memory vs Storage… and Step 3: Proxy Storage Layout…, plus 5 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Storage Layout Safety is an agent skill from PlamenTSV/plamen. Type Thought-template (instantiate before use) - Trigger Pattern STORAGELAYOUT flag detected

Its SKILL.md is about 2.8k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Backend & APIs, covering Smart contracts. The repository describes itself as: Autonomous Web3 security audit agent for Claude Code. The licence is MIT.

When your agent uses it

  • Pattern STORAGELAYOUT flag detected
  • Tasks that involve Smart contracts

Example prompts

  • “/storage-layout-safety”

Workflow steps

5 steps, taken from the step headings in SKILL.md.

  1. Storage Surface Inventory
  2. Memory vs Storage Confusion
  3. Proxy Storage Layout Analysis
  4. Assembly Storage Safety
  5. Storage Semantic Corruption

What it can do on your machine

Read from SKILL.md and the folder at commit 795962b. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Storage Layout Safety loads about 2.8k tokens when it runs. Until then it costs about 29 tokens; SKILL.md has 1,315 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~29
When it runs · the whole SKILL.md, loaded when a task matches
~2.8k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from PlamenTSV/plamen at commit 795962b, republished under its MIT licence (© PlamenTSV). 1,315 words, ~2,810 tokens.

Download SKILL.mdSave it as .claude/skills/storage-layout-safety/SKILL.md (or your agent's skills folder).
name
storage-layout-safety
description
Type Thought-template (instantiate before use) - Trigger Pattern STORAGE_LAYOUT flag detected

Skill: Storage Layout Safety

Type: Thought-template (instantiate before use) Trigger Pattern: STORAGE_LAYOUT flag detected Inject Into: depth-state-trace, depth-edge-case Finding prefix: [SLS-N] Rules referenced: R1, R4, R8, R10, R14

Covers: memory vs storage confusion, lost writes, proxy/upgrade storage collisions, inline assembly slot safety, and storage semantic corruption.

This vulnerability class exists ONLY on EVM - type-safe VMs (Move, Solana's Borsh model) enforce layout correctness at the runtime level. EVM's untyped 256-bit slot model permits silent corruption when layouts diverge.


Trigger Patterns

proxy|upgradeable|diamond|delegatecall|EIP1967|StorageSlot|
sstore|sload|assembly\s*\{|tstore|tload|reinitializer|
UUPSUpgradeable|TransparentUpgradeableProxy|BeaconProxy

Step 1: Storage Surface Inventory

Map the contract's persistent state surface before analyzing bugs:

#VariableTypeSlot AssignmentWritten ByRead ByProxy-Relevant?

For each state variable, determine:

  • Sequential layout (compiler-assigned) vs manual slot (EIP-1967, custom bytes32 constant)?
  • Accessed via Solidity or via assembly sstore/sload?
  • For structs: trace slot computation (base + offset). For mappings: keccak256(key . slot). For arrays: keccak256(slot) + index.

Tag: [TRACE:variable={name} → slot={computation} → writers={functions}]


Step 2: Memory vs Storage Confusion

For each function operating on structs or complex types:

2a. Reference Type Assignment

Trace every local variable of struct, array, or mapping type:

  • Declared as storage or memory?
  • If memory: is the function INTENDING to modify persistent state? If yes → lost write (copy modified in memory, never persisted).
  • If storage: does every code path that modifies the reference complete without early return before the write?
2b. Parameter Data Location

For each function accepting struct/array parameters:

  • Is the parameter memory or calldata?
  • Does the function modify the parameter expecting persistence? function update(MyStruct memory s) modifies s.field but s is a memory copy - original unchanged.
2c. Library Forwarding

For libraries called via using ... for:

  • Does the library function take storage or memory references?
  • Mismatch between caller expectation and library signature → silent behavioral change.

Tag: [TRACE:function={name} → var={var} → location={memory/storage} → write_persisted={YES/NO}]


Step 3: Proxy Storage Layout Analysis

3a. Implementation vs Proxy Slot Overlap
  • Map slots used by PROXY (admin, implementation, beacon).
  • Map slots used by IMPLEMENTATION (state variables from slot 0).
  • Any overlap? For EIP-1967: verify randomized slots match spec (bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1)).
3b. Upgrade Layout Continuity

For each upgrade path (V1 → V2):

  • V1 variables in SAME slots in V2? (no reordering, no type changes, no removed mid-sequence variables)
  • New variables APPENDED after existing? (not inserted)
  • Inheritance order identical? (different order = different slot assignment)
  • __gap storage slots reserved? New variables consuming gap correctly?
3c. Diamond / Namespaced Storage

For EIP-2535 or namespaced storage:

  • Each facet uses unique namespace (keccak256 of distinct string)?
  • Can two facets share the same namespace accidentally?
  • Storage structs within namespace consistent across facet upgrades?

Tag: [TRACE:proxy_slot={N} → impl_var={name} → collision={YES/NO}]


Step 4: Assembly Storage Safety

For each inline assembly block using sstore or sload:

4a. Slot Computation
  • Target slot hardcoded, constant-derived, or influenced by external input?
  • If input-influenced → can attacker target ARBITRARY slots? Is slot value bounded/validated before sstore?
4b. Value Encoding
  • Correctly handles types < 32 bytes? (sstore writes full 32 bytes - masking/shifting correct for packed slots?)
  • For packed storage (multiple variables in one slot): does assembly preserve neighboring values?
4c. Transient Storage (EIP-1153)

If tstore/tload used:

  • Correctly distinguished from sstore/sload? (transient cleared after tx, permanent is not)
  • Critical state accidentally stored with tstore instead of sstore?

Tag: [BOUNDARY:user_input={MAX} → computed_slot={value} → target={what_gets_overwritten}]

4d. Hardcoded Offset into ABI-Encoded Data

Processing: ENUMERATE all calldataload/mload(add( sites with literal offsets + all byte-slicing with hardcoded N on dynamic-type data → PROCESS each against the criteria below → COVERAGE GATE before moving to Step 5.

Scope: Any code that reads from ABI-encoded data using hardcoded byte offsets rather than following offset pointers. This includes:

  • calldataload(N) in assembly (raw calldata)
  • mload(add(data, N)) in assembly (bytes memory/calldata variable)
  • data[N:] or data[N:N+32] byte-slicing in Solidity with hardcoded N
  • Hardcoded offset arithmetic into nested bytes fields after abi.decode

Grep: calldataload\( with a numeric literal, mload(add( with a literal offset on a bytes variable, fixed-offset byte-slicing on decoded bytes data.

Read SiteMechanismOffsetHardcoded?Into Dynamic-Type Content?Value Used ForSame Value Read via abi.decode?

Root cause: ABI encoding is a convention, not enforced by the EVM. Dynamic types (bytes, string, T[]) use offset pointers — the content can be placed anywhere the pointer says. Hardcoded offsets assume canonical pointer values. A caller can supply non-canonical (but ABI-valid) encoding, making the hardcoded position contain attacker-controlled data instead of the expected field. This applies at every nesting level — top-level calldata, inner bytes fields, and nested structs.

Three impact categories:

HIGH/CRITICAL — Dual-read divergence: Hardcoded-offset read + the same value also read via abi.decode or pointer-following elsewhere. The two reads see different values. Enables: authorization bypass (auth sees attacker, execution sees victim), accounting divergence (check validates amount X, transfer uses amount Y).

MEDIUM — Single-read assumption violation: Hardcoded-offset read into dynamic-type content, value is security-critical, no dual-read exists but offset pointer is not validated as canonical. The contract reads attacker-controlled data as a trusted field. Latent Critical — any future addition of abi.decode on the same data creates dual-read divergence.

Show full SKILL.md (521 more words)Show less

MEDIUM — Revert injection / DoS: Hardcoded-offset read lands on attacker-controlled data that triggers a revert (zero address, overflow, out-of-bounds). Legitimate calldata (via canonical encoding) would succeed, but attacker-crafted non-canonical encoding causes revert. Enables: griefing specific operations, front-run DoS if attacker can submit a malformed version of a victim's pending transaction.

MEDIUM — Hash divergence: Contract hashes raw calldata or portions of it (via assembly keccak256 over calldatacopy or manual packing) for signature verification, deduplication, or identity. Non-canonical encoding produces different hashes for logically identical inputs — or identical hashes for different inputs if overlapping tail pointers are used. Breaks: signature verification, replay protection, UserOp-style identity schemes.

Do not report if: The read targets a static-type parameter in the ABI head area (position is fixed regardless of offset pointers), or the value is not security-critical, or the contract validates that the offset pointer equals the expected canonical value before reading.

Additional note — memory vs calldata decoding inconsistency: Non-canonical calldata that decodes successfully via abi.decode from calldata may fail when the same bytes are copied to memory and re-decoded — the Solidity memory decoder is stricter. Code that copies calldata to memory then decodes should be checked for this asymmetry.

Tag: [TRACE:hardcoded_read({mechanism}, offset={N}) → dynamic_type_content={YES/NO} → dual_read={YES/NO} → impact={DIVERGENCE/ASSUMPTION/REVERT_DOS/HASH_DIVERGENCE}]


Step 5: Storage Semantic Corruption

5a. Deletion Consistency

When mapping entries or array elements are deleted:

  • ALL auxiliary structures updated? (index arrays, counters, totals, role flags)
  • delete mapping[key] clears value but leaves stale entries in enumeration arrays?
5b. Bit Packing / Bitmap Operations

For manual bit packing:

  • Every write correctly MASKs target bits without corrupting neighbors?
  • Stale bits cleared on deletion? (|= (1 << n) to set but = 0 instead of &= ~(1 << n) to clear → clears ALL bits)
5c. Uninitialized Storage Reads

Variables read before explicit write:

  • Default value (0, address(0), false) a VALID state the code handles correctly?
  • require(configuredValue > 0) but never set → permanent DoS. if (admin == address(0)) { unrestricted } → open access until set.

Tag: [TRACE:delete={op} → auxiliary={state} → updated={YES/NO} → consumer={func} → reads_stale={YES/NO}]


Key Questions (must answer all)

  1. Does the contract use sequential layout, manual slots, or both?
  2. For proxy patterns: do implementation variables overlap with proxy admin slots?
  3. For assembly: can any sstore target be influenced by external input?
  4. For struct operations: are all memory-reference modifications intentional (not lost writes)?
  5. For deletion: are all auxiliary data structures updated when primary state is removed?

Common False Positives

  • EIP-1967 compliant: Standard randomized slots with verified computation → no collision
  • Intentional memory copy: Read-only computation on a copy, no intent to persist → not a lost write
  • Reserved gaps with matching inheritance: __gap consumed correctly → no layout shift
  • Audited library assembly: Well-tested library (e.g., OpenZeppelin StorageSlot) → lower risk

Step Execution Checklist (MANDATORY)

SectionRequiredCompleted?Notes
1. Storage Surface InventoryYESAll state variables with slots
2. Memory vs Storage ConfusionIF structs/complex typesData location of all references
3. Proxy Storage LayoutIF proxy/upgradeableSlot overlap, upgrade continuity
4. Assembly Storage SafetyIF assembly with sstore/sloadSlot computation, value encoding
4d. Hardcoded Offset into ABI DataIF calldataload/mload at hardcoded offset OR byte-slicing with literal offset on dynamic-type dataDual-read divergence, assumption violation, revert injection
5. Storage Semantic CorruptionIF delete/restructure opsAuxiliary state consistency

© PlamenTSV, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in agents/skills/evm/storage-layout-safety of PlamenTSV/plamen.

Open the folder on GitHubat commit 795962b

Compare with similar skills

Storage Layout Safety next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Storage Layout Safety compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Storage Layout Safety this skillPlamenTSV/plamen303—~2.8kAutomated safety check: PassMIT
Fizz Convertpashov/skills1.2k2 repos~3.7kAutomated safety check: PassMIT
Solana Devsolana-foundation/solana-dev-skill574—~3.8kAutomated safety check: PassMIT
Feynman Auditor0xiehnnkta/nemesis-auditor2431 repos~11kAutomated safety check: PassMIT
Smart Contract Auditgreatpie/smart-contract-audit-skill101—~1.1kAutomated safety check: PassNone
RadarAuditware/radar154—~2.1kAutomated safety check: PassGPL-3.0

Similar skills

  • Fizz Convert

    pashov/skills

    Convert English-language properties in PROPERTIES.md (produced by the Fizz skill) into Solidity assertions inside the existing fuzz harness, then flip their checkboxes.

    1.2k GitHub starsUsed in 2 repos~3.7k tokens
    Backend & APIsAuto-check passed
  • Solana Dev

    solana-foundation/solana-dev-skill

    A skill your agent uses when user asks to "build a Solana dapp", "write an Anchor program", "create a token", "debug Solana errors", "set up wallet connection", "test my Solana program", "fuzz my…

    574 GitHub stars~3.8k tokensUpdated today
    Backend & APIsAuto-check passed
  • Feynman Auditor

    0xiehnnkta/nemesis-auditor

    Deep business logic bug finder using the Feynman technique. An agent skill from 0xiehnnkta/nemesis-auditor.

    243 GitHub starsUsed in 1 repo~11k tokens
    Backend & APIsAuto-check passed
  • Smart Contract Audit

    greatpie/smart-contract-audit-skill

    Script-backed, out-of-box auditing workflow for Solidity/EVM repositories based on EVMbench detect/patch/exploit methodology.

    101 GitHub stars~1.1k tokensUpdated 7 mo ago
    Backend & APIsAuto-check passed
  • Radar

    Auditware/radar

    Use radar for smart contract security analysis, AST generation, and detection template development.

    154 GitHub stars~2.1k tokensUpdated 1 mo ago
    Backend & APIsAuto-check passed
  • Solidity Auditor

    Gabson0x/bountyforge

    Security audit of Solidity code while you develop. An agent skill from Gabson0x/bountyforge.

    442 GitHub stars~3.7k tokensUpdated 22 days ago
    Backend & APIsAuto-check passed

More from PlamenTSV/plamen

All 87 skills in this repo
  • Audit Prep

    PlamenTSV/plamen

    Prepare Solidity projects for a security audit — test coverage, test quality, NatSpec docs, code hygiene, dependency health, best-practice enforcement, deployment readiness, and project…

    303 GitHub stars~3.7k tokensUpdated 13 days ago
    Auto-check passed
  • Verification Protocol

    PlamenTSV/plamen

    Trigger Pattern Always (used by all verifier agents) - Inject Into security-verifier agents (Phase 5)

    303 GitHub stars~3.5k tokensUpdated 13 days ago
    Auto-check passed
  • Ability Analysis

    PlamenTSV/plamen

    Trigger Pattern Always (Aptos Move) - foundational security check - Inject Into Breadth agents, depth agents

    303 GitHub stars~3.3k tokensUpdated 13 days ago
    Auto-check passed
  • Ability Analysis

    PlamenTSV/plamen

    Trigger Pattern Always (Sui Move) -- foundational security check - Inject Into Breadth agents, depth agents

    303 GitHub stars~3.2k tokensUpdated 13 days ago
    Auto-check passed
  • Account Lifecycle

    PlamenTSV/plamen

    Trigger Pattern ACCOUNTCLOSING flag detected (close/CloseAccount usage) - Inject Into Breadth agents, depth agents

    303 GitHub stars~1.2k tokensUpdated 13 days ago
    Auto-check passed
  • Account Validation

    PlamenTSV/plamen

    Trigger Pattern Always required for Solana audits - Inject Into Breadth agents, depth agents

    303 GitHub stars~1.7k tokensUpdated 13 days ago
    Auto-check passed

Categories

Questions about Storage Layout Safety

What does Storage Layout Safety do?

Type Thought-template (instantiate before use) - Trigger Pattern STORAGELAYOUT flag detected. Storage Layout Safety is an agent skill from PlamenTSV/plamen.

When should I use Storage Layout Safety?

Storage Layout Safety fits situations like: pattern STORAGELAYOUT flag detected; tasks that involve Smart contracts.

How do I install Storage Layout Safety in Claude Code?

Run `npx skills add PlamenTSV/plamen --skill storage-layout-safety -a claude-code`. Or copy the skill folder (agents/skills/evm/storage-layout-safety in PlamenTSV/plamen) into .claude/skills/storage-layout-safety in your project. Claude Code loads it when a task matches its description.

How do I install Storage Layout Safety in Codex?

Run `npx skills add PlamenTSV/plamen --skill storage-layout-safety -a codex`. Or copy the skill folder (agents/skills/evm/storage-layout-safety in PlamenTSV/plamen) into .agents/skills/storage-layout-safety in your project. Codex loads it when a task matches its description.

Can I use Storage Layout Safety in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add PlamenTSV/plamen --skill storage-layout-safety -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/storage-layout-safety, .gemini/skills/storage-layout-safety, .github/skills/storage-layout-safety and .opencode/skills/storage-layout-safety in your project.

What does Storage Layout Safety need to run?

SKILL.md names no scripts, command-line tools or credentials: Storage Layout Safety is instructions for the agent only.

Does Storage Layout Safety access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Storage Layout Safety safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Storage Layout Safety use?

Storage Layout Safety is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Storage Layout Safety use?

About 2.8k tokens (SKILL.md is roughly 11k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Storage Layout Safety?

Skills that share tags, products or a category with Storage Layout Safety: Fizz Convert (pashov/skills, 1.2k stars), Solana Dev (solana-foundation/solana-dev-skill, 574 stars), Feynman Auditor (0xiehnnkta/nemesis-auditor, 243 stars) and Smart Contract Audit (greatpie/smart-contract-audit-skill, 101 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Storage Layout Safety?

PlamenTSV (a GitHub user) maintains it in PlamenTSV/plamen, which has 303 GitHub stars. The repository holds 87 skills in this directory. The repository was last updated on September 26, 2026.

Source: PlamenTSV/plamen on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.