gas-optimization
Advanced gas optimization techniques for EVM smart contracts. Covers storage packing, memory vs calldata optimization, assembly/Yul, efficient data structures, batch operations, and benchmark-driven optimization strategies.
npx skills add a5c-ai/babysitter --skill gas-optimization --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# Gas Optimization Skill Advanced gas optimization techniques for EVM smart contracts with benchmark-driven analysis. ## Capabilities - **Storage Optimization**: Storage packing, slot management, SLOAD/SSTORE minimization - **Memory Management**: Memory vs calldata optimization, expansion costs - **Assembly/Yul**: Low-level optimization for critical paths - **Data Structures**: Gas-efficient mappings, arrays, and structs - **Batch Operations**: Multi-call patterns, bulk transfers - **Benchmarking**: Gas profiling, comparison analysis ## MCP/Tool Integration | Tool | Purpose | Reference | |------|---------|-----------| | **Foundry MCP** | Gas reports, testing | [foundry-mcp-server](https://github.com/PraneshASP/foundry-mcp-server) | | **EVM MCP Tools** | Opcode analysis | [evm-mcp-tools](https://github.com/0xGval/evm-mcp-tools) | ## Storage Optimization ### Storage Layout Packing ```solidity // BAD: 3 storage slots (96 bytes used, 96 bytes allocated) contract BadPacking { uint128 a; // slot 0 (16 bytes) uint256 b; // slot 1 (32 bytes) - can't pack with a uint128 c; // slot 2 (16 bytes) } // GOOD: 2 storage slots (80 bytes used, 64 bytes allocated) contract GoodPacking { uint128 a; /
- Capabilities
- MCP/Tool Integration
- Storage Optimization
- Storage Layout Packing
- Minimize Storage Writes
- Use Mappings Over Arrays for Lookups
- Memory vs Calldata
- Function Parameters
- String/Bytes Handling
- Unchecked Arithmetic
- Loop Optimizations
- Cache Array Length
- Pre-increment
- Custom Errors
Run tests with gas report forge test --gas-report Snapshot gas usage forge snapshot Compare against previous snapshot forge snapshot --check
What does the gas-optimization skill do?
Advanced gas optimization techniques for EVM smart contracts. Covers storage packing, memory vs calldata optimization, assembly/Yul, efficient data structures, batch operations, and benchmark-driven optimization strategies.
How do I install it?
Run `npx skills add a5c-ai/babysitter --skill gas-optimization --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From a5c-ai/babysitter, a repository with 1,642 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
