Optimizing gas fees

From jeremylongshore/claude-code-plugins-plus-skills · View interactive version

Optimizing gas fees is an AI agent skill from the GitHub repository jeremylongshore/claude-code-plugins-plus-skills. 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".

How to use this skill

Skill file

Optimizing Gas Fees

Overview

Gas fee optimization skill that:

Prerequisites

Instructions

  1. 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

```

  1. 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):

```bash

cd ${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

```

  1. Find the optimal transaction window with lowest expected gas:

```bash

cd ${CLAUDE_SKILL_DIR}/scripts && python3 gas_optimizer.py optimal

```

  1. 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

```

  1. Predict future gas prices for a given hour:

```bash

cd ${CLAUDE_SKILL_DIR}/scripts && python3 gas_optimizer.py predict --time 14

```

  1. Compare gas prices across multiple chains:

```bash

cd ${CLAUDE_SKILL_DIR}/scripts && python3 gas_optimizer.py compare

```

  1. View base fee history for recent blocks:

```bash

cd ${CLAUDE_SKILL_DIR}/scripts && python3 gas_optimizer.py history --blocks 50

```

Output

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 CODE0 for:

Examples

See CODE0 for:

Resources

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.