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.
npx agentmods add skills/zaryab2000/decipher-gas-optimizoor/type-optimizationnpx skills add zaryab2000/decipher-gas-optimizoor --skill type-optimizationgit clone --depth 1 https://github.com/zaryab2000/decipher-gas-optimizoorWrote 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.
[](https://agentmods.dev/skills/zaryab2000/decipher-gas-optimizoor/type-optimization)<a href="https://agentmods.dev/skills/zaryab2000/decipher-gas-optimizoor/type-optimization"><img src="https://agentmods.dev/badge/skills/zaryab2000/decipher-gas-optimizoor/type-optimization.svg" alt="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00091 | $0.01782 |
| Opus 5 | $0.00046 | $0.00891 |
| Sonnet 5 | $0.00018 | $0.00356 |
| Haiku 4.5 | $0.00009 | $0.00178 |
Grade A, and why
type-optimization 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 5d 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.
How it starts
The opening of the file, as written. The whole thing — 175 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Purpose
Identify variable declarations and arithmetic expressions where type choices add masking overhead or consume unnecessary storage slots. The EVM operates natively on 256-bit words; types smaller than 256 bits add AND masking opcodes in computation contexts and waste storage slots when used as standalone state variables.
When to Use
- Writing or reviewing state variable declarations
- Reviewing function signatures with small integer types
- Reviewing arithmetic-heavy functions or loop bodies
- Pre-audit cleanup of variable declarations
When NOT to Use
- Variables inside packed storage structs: smaller types ARE the optimization in that context (they reduce slot count). TY-001 and SL-001 apply in opposite contexts.
- When a smaller type is required for interface compatibility (e.g., ERC-20
decimals()returnsuint8, ERC-2981royaltyInforeturnsuint96) - When semantic range enforcement is the intent (a value that must wrap at 255)
Platform Detection
Trigger on any .sol file containing:
uint8,uint16,uint32, oruint64local variables, parameters, or return types used in computation outside of a packed struct (TY-001)stringstate variable assigned a short literal or fixed value (TY-002)- Three or more standalone
boolstate variable declarations (TY-003) - An explicit downcast immediately followed by widening in arithmetic (TY-004)
Quick Reference
| Context | Pattern | Fix |
|---|---|---|
| Local variable / return / param NOT in packed struct | uint8/uint16/uint32/uint64 in arithmetic |
uint256 (no masking) |
| Short fixed string (≤31 bytes) as state var | string public symbol |
bytes32 (one slot, no length) |
3+ standalone bool state vars |
bool a; bool b; bool c; |
uint256 bitmap |
| Downcast then widen in same expression | uint128(x) * uint256(y) |
uint256(x) * uint256(y) |
| Bool in packed struct alongside address | OK — keeps slot full | No change needed |
Workflow
- Scan state variables: standalone bools (TY-003) and string-as-bytes32
(TY-002).
List all state variable declarations at the contract level. Count
consecutive or standalone
booldeclarations not inside a struct. If three or more exist, flag for TY-003 bitmap conversion. For eachstringstate variable, check its assigned value: is it a short identifier (symbol, name, version string) of ≤31 bytes? If so, flag for TY-002 replacement withbytes32.
What ships with it
3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
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.
- 5d ago First seen · 175 lines · 91 tokens per session scan A a22b6dc996fb
type-optimization is a skill published in the GitHub repository zaryab2000/decipher-gas-optimizoor (7 stars, last pushed 6mo ago), licensed MIT. It adds 91 tokens to every session and 1,782 once invoked, about $0.0005 per session on Opus 5. 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.
Other skills, from other repositories
solidity-gas-optimizer
Analyze and optimize gas consumption in Solidity smart contracts using proven patterns and best practices.
blockchain-expert
Expert-level blockchain, Web3, smart contracts, DeFi, and cryptocurrency development. Use when the user mentions Web3, smart contracts, DeFi, Ethereum, or Solidity, or when the task involves Blockchain Fundamentals, Web3 & DeFi, Smart Contract Security, or Gas Optimization.
blockchain-application
Use this skill when asked about smart contract development, Solidity, Vyper, Rust smart contracts (Solana, NEAR, Polkadot), Haskell/Plutus (Cardano), Cairo/StarkNet, dApp backend development, Truffle, Hardhat, Foundry, Anchor, and blockchain application patterns. Languages: Solidity, Vyper, Rust, Haskell, Cairo, Move.…
web3-expert
Build production-ready Web3 applications including smart contracts, dApps, DeFi protocols, and decentralized storage solutions. Use when the user mentions Web3, smart contracts or Solidity, dApps, DeFi protocols, ethers.js or web3.js, IPFS, or on-chain integration with Ethereum-compatible networks.
ethereum-development
Production-grade Ethereum/EVM development workflow for smart contracts, dApps, transactions, clients, gas optimization, testing, security review, deployment, verification, monitoring, and incident response across Foundry, Hardhat, Solidity, TypeScript, viem, ethers, wagmi, and common EVM networks.
solidity-language-docs
Solidity 0.8.36 — smart contracts, types, functions, modifiers, events, inheritance, libraries, assembly, ABI.