Agent skill
optimizing-gas-fees
Optimize blockchain gas costs by analyzing prices, patterns, and timing. Use when checking gas prices, estimating costs, or finding optimal windows. Trigger with phrases like "gas prices", "optimize gas", "transaction cost", "when to transact".
Install this agent skill to your Project
npx add-skill https://github.com/jeremylongshore/claude-code-plugins-plus-skills/tree/main/plugins/crypto/gas-fee-optimizer/skills/optimizing-gas-fees
SKILL.md
Optimizing Gas Fees
Overview
Gas fee optimization skill that:
- Fetches real-time gas prices from multiple sources
- Estimates transaction costs in ETH and USD
- Analyzes historical patterns to find optimal timing
- Predicts future gas prices
- Compares gas across multiple chains
Prerequisites
- Python 3.8+ with requests library
- Network access to RPC endpoints
- Optional:
ETHERSCAN_API_KEYfor higher rate limits - Optional: Custom RPC URLs via environment variables
Instructions
- Check current gas prices (optionally for a specific chain):
bash
cd ${CLAUDE_SKILL_DIR}/scripts && python3 gas_optimizer.py current cd ${CLAUDE_SKILL_DIR}/scripts && python3 gas_optimizer.py current --chain polygon - Estimate transaction cost for known operations or custom gas limits (available operations:
eth_transfer,erc20_transfer,erc20_approve,uniswap_v2_swap,uniswap_v3_swap,sushiswap_swap,curve_swap,nft_mint,nft_transfer,opensea_listing,aave_deposit,aave_withdraw,compound_supply,compound_borrow,bridge_deposit):bashcd ${CLAUDE_SKILL_DIR}/scripts && python3 gas_optimizer.py estimate --operation uniswap_v2_swap --all-tiers cd ${CLAUDE_SKILL_DIR}/scripts && python3 gas_optimizer.py estimate --gas-limit 150000 --tier fast # 150000 = configured value - Find the optimal transaction window with lowest expected gas:
bash
cd ${CLAUDE_SKILL_DIR}/scripts && python3 gas_optimizer.py optimal - View gas patterns (hourly or daily):
bash
cd ${CLAUDE_SKILL_DIR}/scripts && python3 gas_optimizer.py patterns cd ${CLAUDE_SKILL_DIR}/scripts && python3 gas_optimizer.py patterns --daily - Predict future gas prices for a given hour:
bash
cd ${CLAUDE_SKILL_DIR}/scripts && python3 gas_optimizer.py predict --time 14 - Compare gas prices across multiple chains:
bash
cd ${CLAUDE_SKILL_DIR}/scripts && python3 gas_optimizer.py compare - View base fee history for recent blocks:
bash
cd ${CLAUDE_SKILL_DIR}/scripts && python3 gas_optimizer.py history --blocks 50
Output
- Current: Base fee, priority fee, and tier prices (slow/standard/fast/instant)
- Estimate: Gas cost in native token and USD for each tier
- Patterns: Historical hourly/daily patterns with low-gas markers
- Optimal: Recommended transaction window with expected savings
- Predict: Gas forecast for specific time with confidence
- Compare: Side-by-side gas prices across chains
Supported Chains
| Chain | Native Token | Block Time |
|---|---|---|
| Ethereum | ETH | ~12 sec |
| Polygon | MATIC | ~2 sec |
| Arbitrum | ETH | ~0.25 sec |
| Optimism | ETH | ~2 sec |
| Base | ETH | ~2 sec |
Price Tiers
| Tier | Percentile | Confirmation Time |
|---|---|---|
| Slow | 10th | 10+ blocks (~2+ min) |
| Standard | 50th | 3-5 blocks (~1 min) |
| Fast | 75th | 1-2 blocks (~30 sec) |
| Instant | 90th | Next block (~12 sec) |
Error Handling
See ${CLAUDE_SKILL_DIR}/references/errors.md for:
- RPC connection issues
- API rate limiting
- Price feed errors
- Pattern analysis errors
Examples
See ${CLAUDE_SKILL_DIR}/references/examples.md for:
- Quick start commands
- Cost estimation scenarios
- Multi-chain comparison
- Practical workflows
Resources
- EIP-1559 - Fee market specification
- Etherscan Gas Tracker - Reference oracle
- L2Fees - L2 cost comparison
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
dockerfile-generator
Dockerfile Generator - Auto-activating skill for DevOps Basics. Triggers on: dockerfile generator, dockerfile generator Part of the DevOps Basics skill category.
branch-naming-helper
Branch Naming Helper - Auto-activating skill for DevOps Basics. Triggers on: branch naming helper, branch naming helper Part of the DevOps Basics skill category.
readme-generator
Readme Generator - Auto-activating skill for DevOps Basics. Triggers on: readme generator, readme generator Part of the DevOps Basics skill category.
makefile-generator
Makefile Generator - Auto-activating skill for DevOps Basics. Triggers on: makefile generator, makefile generator Part of the DevOps Basics skill category.
gitignore-generator
Gitignore Generator - Auto-activating skill for DevOps Basics. Triggers on: gitignore generator, gitignore generator Part of the DevOps Basics skill category.
pre-commit-hook-setup
Pre Commit Hook Setup - Auto-activating skill for DevOps Basics. Triggers on: pre commit hook setup, pre commit hook setup Part of the DevOps Basics skill category.
Didn't find tool you were looking for?