type-optimization

type-optimization is a skill for Claude Code from zaryab2000/decipher-gas-optimizoor. It costs 91 tokens per session (1,782 once invoked), scanned A, original, MIT.

A Solidity review skill that finds inefficient choices of data types, such as small integers used in calculations or several separate Boolean values stored independently.

In plain words
What is it for?
Use it when reviewing Solidity variable declarations, function parameters, return types, arithmetic code, and storage layouts.
Why use it?
It helps reduce extra computation and wasted storage space while keeping exceptions for interface requirements and deliberately packed data.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

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

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.

agentmods
npx agentmods add skills/zaryab2000/decipher-gas-optimizoor/type-optimization
Any agent
npx skills add zaryab2000/decipher-gas-optimizoor --skill type-optimization
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 type-optimization

README.md
[![agentmods](https://agentmods.dev/badge/skills/zaryab2000/decipher-gas-optimizoor/type-optimization.svg)](https://agentmods.dev/skills/zaryab2000/decipher-gas-optimizoor/type-optimization)
Your own site
<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>
Per session 91 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,782 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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.00091 $0.01782
Opus 5 $0.00046 $0.00891
Sonnet 5 $0.00018 $0.00356
Haiku 4.5 $0.00009 $0.00178

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

Security

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.

skills/type-optimization/SKILL.md · 175 lines

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() returns uint8, ERC-2981 royaltyInfo returns uint96)
  • 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, or uint64 local variables, parameters, or return types used in computation outside of a packed struct (TY-001)
  • string state variable assigned a short literal or fixed value (TY-002)
  • Three or more standalone bool state 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

  1. 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 bool declarations not inside a struct. If three or more exist, flag for TY-003 bitmap conversion. For each string state variable, check its assigned value: is it a short identifier (symbol, name, version string) of ≤31 bytes? If so, flag for TY-002 replacement with bytes32.

Read the full file on GitHub · 175 lines

Files

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.

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. 5d ago First seen · 175 lines · 91 tokens per session scan A a22b6dc996fb

Subscribe to this mod's changes

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.

Related

Other skills, from other repositories

solidity-gas-optimizer

Analyze and optimize gas consumption in Solidity smart contracts using proven patterns and best practices.

ZhouXiaoHong/binance-skills · 23 tokens

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.

personamanagmentlayer/pcl · 63 tokens

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.…

j4flmao/agent-skills · 175 tokens

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.

personamanagmentlayer/pcl · 66 tokens

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.

dirtybits/agent-skills · 64 tokens

solidity-language-docs

Solidity 0.8.36 — smart contracts, types, functions, modifiers, events, inheritance, libraries, assembly, ABI.

pledgeandgrow/pledge-skills · 34 tokens