什麼是 solidity-gas-optimization?
Solidity 智能合約的 Gas 最佳化模式。在優化合約部署成本、運行時 Gas 使用或儲存效率時使用。涵蓋儲存打包、自訂錯誤、不可變變數、呼叫資料最佳化、循環模式、程式集使用和 Solady 氣體最佳化替代方案。觸發涉及 Gas 最佳化、儲存佈局、降低部署成本或 EVM 效率的任務。 來源:whackur/solidity-agent-toolkit。
Solidity 智能合約的 Gas 最佳化模式。在優化合約部署成本、運行時 Gas 使用或儲存效率時使用。涵蓋儲存打包、自訂錯誤、不可變變數、呼叫資料最佳化、循環模式、程式集使用和 Solady 氣體最佳化替代方案。觸發涉及 Gas 最佳化、儲存佈局、降低部署成本或 EVM 效率的任務。
透過命令列快速安裝 solidity-gas-optimization AI 技能到你的開發環境
來源:whackur/solidity-agent-toolkit。
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-optimizationSolidity 智能合約的 Gas 最佳化模式。在優化合約部署成本、運行時 Gas 使用或儲存效率時使用。涵蓋儲存打包、自訂錯誤、不可變變數、呼叫資料最佳化、循環模式、程式集使用和 Solady 氣體最佳化替代方案。觸發涉及 Gas 最佳化、儲存佈局、降低部署成本或 EVM 效率的任務。 來源:whackur/solidity-agent-toolkit。
開啟你的終端機或命令列工具(如 Terminal、iTerm、Windows Terminal 等) 複製並執行以下指令:npx skills add https://github.com/whackur/solidity-agent-toolkit --skill solidity-gas-optimization 安裝完成後,技能將自動設定到你的 AI 程式設計環境中,可以在 Claude Code、Cursor 或 OpenClaw 中使用
https://github.com/whackur/solidity-agent-toolkit