weasel-gas
БесплатноБез исполняемых скриптовНе проверенGas optimization analysis and implementation for Solidity contracts. Triggers on weasel gas, weasel optimize, or weasel efficiency.
Об этом скилле
Weasel Gas Optimizer
Expert in identifying and implementing gas optimizations for Solidity smart contracts.
When to Activate
- User wants to optimize gas usage
- User asks about efficiency
- User mentions gas costs
Workflow
- Detect Chain - CRITICAL: Identify target chain BEFORE analysis
- Scan - Run
weasel_analyzewith severity: "Gas" - Filter - Remove findings irrelevant to target chain
- Summarize - Quick count by impact level (chain-adjusted)
- Ask - "Fix high impact? Medium? All? Pick specific?"
- Fix - Implement directly in code
- Verify - Run tests
Step 1: Chain Detection (CRITICAL - DO NOT SKIP)
Before any gas analysis, determine the target chain.
Detection Methods
Config files (most reliable):
hardhat.config.js/ts → networks: { mainnet, arbitrum, optimism, polygon, bsc } foundry.toml → [rpc_endpoints] or comments truffle-config.js → networks sectionREADME.md - Look for deployment targets, chain mentions
Dependencies/Files:
foundry.toml,hardhat.config.*,truffle-config.js→ EVM (Supported)@arbitrum/*→ Arbitrum L2@eth-optimism/*→ Optimism L2Anchor.toml,*.rs→ Solana (NOT SUPPORTED)Move.toml,*.move→ Move (NOT SUPPORTED)tronbox,tronweb→ Tron (NOT SUPPORTED)- No
.solfiles → NOT SUPPORTED
Ask user if unclear: "Which EVM chain is this for? (Ethereum/Arbitrum/Optimism/Polygon/BSC/Other)"
- If user says non-EVM (Tron, Solana, etc.) → Not supported, stop.
Chain Categories
| Category | Chains | Supported |
|---|---|---|
| EVM L1 | Ethereum mainnet | ✓ Full |
| EVM L2 | Arbitrum, Optimism, Base, zkSync, Scroll | ✓ Filtered |
| EVM L1 (cheap) | Polygon, BSC, Avalanche, Fantom | ✓ Filtered |
| Non-EVM | Tron, Solana, Aptos, Sui, CosmWasm, TON, etc. | ❌ NO |
Weasel supports Solidity on EVM chains only.
Chain-Specific Rules
EVM L1 (Ethereum Mainnet)
All standard gas optimizations apply:
- Storage caching (SLOAD = 2100 gas) ✓
- Struct packing ✓
- Unchecked math ✓
- Calldata vs memory ✓
EVM L2 (Arbitrum, Optimism, Base, zkSync)
Execution is cheap. Calldata dominates costs.
| Optimization | Priority | Why |
|---|---|---|
| Calldata size reduction | HIGH | Calldata posted to L1 |
| Short strings/bytes32 | HIGH | Reduces calldata |
| Event data size | HIGH | Logged to L1 |
| Batch operations | HIGH | Reduces L1 overhead |
| Storage caching | Low | Execution is cheap on L2 |
| Unchecked math | Low | Saves ~20 gas, negligible |
| Struct packing | Maybe | Only if reduces calldata |
EVM L1 Cheap (Polygon, BSC, Avalanche)
Gas is cheap - micro-optimizations often pointless.
| Optimization | Report? | Why |
|---|---|---|
| Storage caching | Maybe | Only for hot paths |
| Unchecked math | Skip | Saves cents, not worth readability |
| Prefix increment | Skip | Negligible savings |
| Array length caching | Skip | Marginal benefit |
Rule: Only report if saves >1000 gas or is on hot path.
Non-EVM Chains (NOT SUPPORTED)
Weasel analyzes Solidity on EVM only. Non-EVM chains are not supported.
If detected (Tron, Solana, Move, CosmWasm, TON, etc.):
❌ Cannot run gas analysis.
This project targets a non-EVM chain.
Weasel supports Solidity on EVM chains only.
Gas optimization skill does not apply.
Multi-chain / Unknown
If deploying to multiple EVM chains or unclear:
- Ask: "Which EVM chain should I optimize for?"
- If multi-chain, optimize for the most expensive (usually Ethereum mainnet)
- Note that L2-specific optimizations may differ from L1
Impact Ranking (Chain-Adjusted)
Ethereum Mainnet
High Impact - Fix first:
- Storage caching (repeated SLOAD) - saves 2100+ gas
- Struct packing - saves 20000+ gas on writes
- Unchecked math in loops - saves ~60 gas per iteration
- Calldata vs memory for read-only
Medium Impact:
- Array length caching
- Short-circuit reordering
Low Impact - Usually skip:
- Prefix increment (saves 5 gas)
- Minor syntax tweaks
L2s (Arbitrum, Optimism, Base)
High Impact:
- Calldata size reduction (bytes32 vs string, packed structs in calldata)
- Event data minimization
- Batch operations
Low Impact (often skip):
- Storage caching - execution is cheap
- Unchecked math - negligible savings
- Most "save 100 gas" tweaks
Cheap L1s (Polygon, BSC)
Only report if:
- Saves >1000 gas
- Hot path (called frequently)
- Otherwise, skip - not worth readability trade-off
Output
Always include chain context:
Gas analysis for: Arbitrum (L2)
Raw findings: 12
After chain filter: 4 relevant
High (2): calldata size (2)
Medium (2): event optimization (2)
Filtered out (8): storage caching, unchecked math - low impact on L2
Fix high impact issues? [yes/specific/skip]
For non-EVM chains:
❌ Cannot
Установить weasel-gas в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл weasel-gas?
Gas optimization analysis and implementation for Solidity contracts. Triggers on weasel gas, weasel optimize, or weasel efficiency.
Как установить скилл weasel-gas?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл weasel-gas запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic