analyze

analyze is a command for Claude Code from zaryab2000/decipher-gas-optimizoor. It costs 0 tokens per session (1,236 once invoked), scanned A, original, MIT.

A command that performs a full gas-optimization review of a Foundry Solidity project or selected path. It verifies Foundry, builds the code, records a gas snapshot, inspects storage layouts, and checks the contracts against the supported optimization areas.

In plain words
What is it for?
Use it to analyze `src/` or another contract path before deployment or an audit, optionally setting a minimum gas-saving threshold for reported findings.
Why use it?
It prevents unreliable analysis by stopping when Foundry is unavailable or the project does not compile. A gas snapshot provides a baseline, while a threshold can hide findings estimated to save only a small amount of gas.

Command for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the decipher-gas-optimizoor plugin — 11 skills, 5 commands, 1 agent shipped together

Good fit Use it to analyze src/ or another contract path before deployment or an audit, optionally setting a minimum gas-saving threshold for reported findings.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/zaryab2000/decipher-gas-optimizoor/analyze
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/zaryab2000/decipher-gas-optimizoor

Made for: Claude Code.

Or install decipher-gas-optimizoor, the plugin that ships this one along with the rest of its 11 skills, 5 commands, 1 agent.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for analyze

README.md
[![agentmods](https://agentmods.dev/badge/commands/zaryab2000/decipher-gas-optimizoor/analyze.svg)](https://agentmods.dev/commands/zaryab2000/decipher-gas-optimizoor/analyze)
Your own site
<a href="https://agentmods.dev/commands/zaryab2000/decipher-gas-optimizoor/analyze"><img src="https://agentmods.dev/badge/commands/zaryab2000/decipher-gas-optimizoor/analyze.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,236 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00000 $0.01236
Opus 5 $0.00000 $0.00618
Sonnet 5 $0.00000 $0.00247
Haiku 4.5 $0.00000 $0.00124

Measured 8d ago against content hash f43d3986eb7f, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

analyze scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

commands/analyze.md · 170 lines

How it starts

The opening of the file, as written. The whole thing — 170 lines — stays where its author put it; the contents beside it link to each section on GitHub.

/decipher-gas-optimizoor:analyze [path]

Conduct a full gas optimization analysis on a Foundry Solidity project.

Arguments

  • [path] — directory or file to analyze (default: src/)
  • --threshold <gas> — suppress findings below this estimated gas saving (default: 100)

Workflow

Step 1: Verify forge

Run:

forge --version

If the command fails or is not found, report:

forge is not installed or not on PATH. Install Foundry: https://getfoundry.sh Analysis cannot proceed without forge.

Stop here.

Step 2: Build

Run:

forge build

If the build fails, display the full compiler error output and stop. Do not proceed with a broken build — findings on uncompiled code are unreliable.

Step 3: Snapshot

Run:

forge snapshot

Save the full output. This establishes the gas baseline for every test function. If no tests exist, note "No test snapshot available — findings are static analysis only" and continue.

Step 4: Storage layouts

For each .sol file under [path]:

  1. Parse the file to extract all contract names declared with contract, abstract contract, or library.

  2. For each contract name, run:

    forge inspect <ContractName> storageLayout --json
    
  3. Parse the returned JSON. For each slot, note:

    • Which variables occupy it
    • How many bytes each variable consumes
    • Whether the slot has unused byte space (a packing gap)

Flag any slot where a smaller-type field is alone and another smaller-type field declared nearby could have been packed alongside it.

Step 5: Analyze

Apply all relevant gas optimization skills to identify issues. Each skill handles its own domain — do not duplicate their detection logic here. Suppress any finding whose estimated gas saving is below --threshold.

The active skills cover: storage-layout (SL-001–010), loop-optimization (LO-001–006), calldata (CD-001–004), deployment (DP-001–004), type-optimization (TY-001–004), custom-errors (CE-001–003), compiler-optimizer (CO-001–003), immutable-and-constant (IC-001–003), unchecked-arithmetic (UA-001–002), visibility (VI-001–002), event-logging (EV-001–002).

Read the full file on GitHub · 170 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 8d ago First seen · 170 lines · 0 tokens per session scan A f43d3986eb7f

Subscribe to this mod's changes

analyze is a command published in the GitHub repository zaryab2000/decipher-gas-optimizoor (7 stars, last pushed 6mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,236 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.