Route trades across multiple DEXs to find optimal prices with minimal slippage and gas costs. Use when comparing DEX prices, finding optimal swap routes, analyzing price impact, splitting large orders, or assessing MEV risk. Trigger with phrases like "find best swap", "compare DEX prices", "route trade", "optimal swap route", "split order", "DEX aggregator", "check slippage", or "MEV protection".
View on GitHubjeremylongshore/claude-code-plugins-plus-skills
dex-aggregator-router
plugins/crypto/dex-aggregator-router/skills/routing-dex-trades/SKILL.md
January 22, 2026
Select agents to install to:
npx add-skill https://github.com/jeremylongshore/claude-code-plugins-plus-skills/blob/main/plugins/crypto/dex-aggregator-router/skills/routing-dex-trades/SKILL.md -a claude-code --skill routing-dex-tradesInstallation paths:
.claude/skills/routing-dex-trades/# Routing DEX Trades
## Overview
This skill provides optimal trade routing across decentralized exchanges by aggregating quotes from multiple sources (1inch, Paraswap, 0x), discovering multi-hop routes, calculating split orders for large trades, and assessing MEV risk. It helps traders execute at the best prices while minimizing slippage and gas costs.
## Prerequisites
Before using this skill, ensure you have:
- Python 3.9+ with `httpx`, `pydantic`, and `rich` packages
- Network access to aggregator APIs (1inch, Paraswap, 0x)
- Optional: API keys for 1inch and 0x (higher rate limits)
- Environment variables configured in `{baseDir}/config/settings.yaml`
- Understanding of DeFi trading concepts (slippage, price impact, MEV)
## Instructions
### Step 1: Configure API Access
1. Copy settings template: `cp {baseDir}/config/settings.yaml.example {baseDir}/config/settings.yaml`
2. Add optional API keys:
```yaml
api_keys:
oneinch: "your-1inch-api-key" # Optional, increases rate limits
zerox: "your-0x-api-key" # Optional
```
3. Set preferred chain: `ethereum`, `arbitrum`, `polygon`, or `optimism`
### Step 2: Quick Quote (Single Best Price)
Use Bash(crypto:dex-router) to get the best price across aggregators:
```bash
python {baseDir}/scripts/dex_router.py ETH USDC 1.0
```
This returns the single best route with price, gas cost, and effective rate.
### Step 3: Compare All DEXs
For detailed comparison across all sources:
```bash
python {baseDir}/scripts/dex_router.py ETH USDC 5.0 --compare
```
Output includes quotes from each aggregator with:
- Output amount and rate
- Price impact percentage
- Gas cost in USD
- Effective rate (after gas)
### Step 4: Analyze Routes (Multi-Hop Discovery)
For trades where multi-hop might be cheaper:
```bash
python {baseDir}/scripts/dex_router.py ETH USDC 10.0 --routes
```
Discovers and compares:
- Direct routes (single pool)
- Multi-hop routes (2-3 pools)
- Shows hop-by-hop breakdown with cumulative impac