·solidity-gas-optimization
!

solidity-gas-optimization

Solidity 智能合约的 Gas 优化模式。在优化合约部署成本、运行时 Gas 使用或存储效率时使用。涵盖存储打包、自定义错误、不可变变量、调用数据优化、循环模式、程序集使用和 Solady 气体优化替代方案。触发涉及 Gas 优化、存储布局、降低部署成本或 EVM 效率的任务。

7安装·0热度·@whackur

安装

$npx skills add https://github.com/whackur/solidity-agent-toolkit --skill solidity-gas-optimization

如何安装 solidity-gas-optimization

通过命令行快速安装 solidity-gas-optimization AI 技能到你的开发环境

  1. 打开终端: 打开你的终端或命令行工具(如 Terminal、iTerm、Windows Terminal 等)
  2. 运行安装命令: 复制并运行以下命令:npx skills add https://github.com/whackur/solidity-agent-toolkit --skill solidity-gas-optimization
  3. 验证安装: 安装完成后,技能将自动配置到你的 AI 编程环境中,可以在 Claude Code、Cursor 或 OpenClaw 中使用

来源:whackur/solidity-agent-toolkit。

SKILL.md

查看原文

EVM reads and writes in 32-byte (256-bit) slots. Variables smaller than 32 bytes that are declared consecutively share a slot, reducing SSTORE operations. A new SSTORE costs 20,000 gas; packing avoids additional slot allocations.

What to verify: Consecutive variables of the same or smaller combined size (≤32 bytes) are grouped together. Place uint128 next to uint128, not separated by a uint256.

Custom errors are encoded as 4-byte selectors, whereas revert strings store the full string in contract bytecode and in memory at runtime. Custom errors save gas on both deployment (smaller bytecode) and execution (cheaper encoding).

Solidity 智能合约的 Gas 优化模式。在优化合约部署成本、运行时 Gas 使用或存储效率时使用。涵盖存储打包、自定义错误、不可变变量、调用数据优化、循环模式、程序集使用和 Solady 气体优化替代方案。触发涉及 Gas 优化、存储布局、降低部署成本或 EVM 效率的任务。 来源:whackur/solidity-agent-toolkit。

可引用信息

为搜索与 AI 引用准备的稳定字段与命令。

安装命令
npx skills add https://github.com/whackur/solidity-agent-toolkit --skill solidity-gas-optimization
分类
!安全工具
认证
收录时间
2026-02-22
更新时间
2026-03-10

Browse more skills from whackur/solidity-agent-toolkit

快速解答

什么是 solidity-gas-optimization?

Solidity 智能合约的 Gas 优化模式。在优化合约部署成本、运行时 Gas 使用或存储效率时使用。涵盖存储打包、自定义错误、不可变变量、调用数据优化、循环模式、程序集使用和 Solady 气体优化替代方案。触发涉及 Gas 优化、存储布局、降低部署成本或 EVM 效率的任务。 来源:whackur/solidity-agent-toolkit。

如何安装 solidity-gas-optimization?

打开你的终端或命令行工具(如 Terminal、iTerm、Windows Terminal 等) 复制并运行以下命令:npx skills add https://github.com/whackur/solidity-agent-toolkit --skill solidity-gas-optimization 安装完成后,技能将自动配置到你的 AI 编程环境中,可以在 Claude Code、Cursor 或 OpenClaw 中使用

这个 Skill 的源码在哪?

https://github.com/whackur/solidity-agent-toolkit