New to Claude Skills? Learn how to install them →

jeremylongshore on GitHub

Routing DEX Trades

Free

Optimize crypto trades across multiple DEXs.

Get this skill

Free · Opens the source repo

What Routing DEX Trades does

Routing DEX Trades is a skill designed for cryptocurrency traders who want to ensure they are getting the best possible prices for their trades. It aggregates quotes from multiple decentralized exchanges (DEXs) such as 1inch, Paraswap, and 0x, allowing users to discover optimal trading routes with minimal slippage and gas costs. This tool is particularly useful for those who frequently engage in trading large volumes or need to assess the risks associated with miner extractable value (MEV).

The skill provides a variety of functionalities that cater to different trading needs. Users can quickly obtain quotes for single trades, compare prices across multiple DEXs, and analyze the effectiveness of direct versus multi-hop routes. For larger trades, the skill can split orders across several exchanges to minimize price impact, which is crucial for maintaining profitability in volatile markets. Additionally, the MEV assessment feature helps users understand the risks involved in executing trades, providing a risk score that can inform decision-making.

To use Routing DEX Trades, users need to have Python installed along with specific packages, and they may need to configure API keys for enhanced functionality. The skill is triggered using specific phrases related to trade routing and comparison, making it accessible for both novice and experienced traders. The output is comprehensive, offering detailed insights into trade costs, potential savings, and risk assessments, making it a valuable tool for anyone looking to optimize their trading strategies in the decentralized finance space.

When to use it

Use this skill when you need to compare prices across different DEXs, analyze trade routes, or assess risks before executing a trade.

When not to use it

This skill may not be suitable for users who are not trading cryptocurrencies or those who prefer centralized exchanges with different trading dynamics.

What you can build with it

Quick Price Quote

Get an immediate quote for a single trade to see the best price and gas cost.

Multi-hop Route Analysis

Analyze and compare direct versus multi-hop trading routes to find the most cost-effective option.

Large Order Splitting

Split large trades across multiple DEXs to minimize slippage and optimize overall costs.

How to install Routing DEX Trades

View source

1. Install with the skills CLI

npx skills add jeremylongshore/claude-code-plugins-plus-skills/routing-dex-trades --agent claude-code

2. Or install it manually

Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.

Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs

Inside SKILL.md

Written by jeremylongshore

Routing DEX Trades

Contents

Overview | Prerequisites | Instructions | Output | Error Handling | Examples | Resources

Overview

Optimal trade routing across decentralized exchanges by aggregating quotes from 1inch, Paraswap, and 0x. Discovers multi-hop routes, calculates split orders for large trades, and assesses MEV risk to minimize slippage and gas costs.

Prerequisites

  1. Install Python 3.9+ with httpx, pydantic, and rich packages
  2. Verify network access to aggregator APIs (1inch, Paraswap, 0x)
  3. Optionally add API keys for 1inch and 0x (higher rate limits)
  4. Copy settings: cp ${CLAUDE_SKILL_DIR}/config/settings.yaml.example ${CLAUDE_SKILL_DIR}/config/settings.yaml

Instructions

  1. Get a quick quote for the single best price with gas cost and effective rate:

    python ${CLAUDE_SKILL_DIR}/scripts/dex_router.py ETH USDC 1.0
    
  2. Compare all DEXs to see quotes ranked by effective rate (after gas):

    python ${CLAUDE_SKILL_DIR}/scripts/dex_router.py ETH USDC 5.0 --compare
    
  3. Analyze multi-hop routes to compare direct vs. multi-hop (2-3 pools) with hop-by-hop breakdown:

    python ${CLAUDE_SKILL_DIR}/scripts/dex_router.py ETH USDC 10.0 --routes
    
  4. Split large orders ($10K+) across multiple DEXs to minimize total price impact:

    python ${CLAUDE_SKILL_DIR}/scripts/dex_router.py ETH USDC 100.0 --split
    
  5. Assess MEV risk (sandwich attack risk score: LOW/MEDIUM/HIGH) before executing:

    python ${CLAUDE_SKILL_DIR}/scripts/dex_router.py ETH USDC 50.0 --mev-check
    
  6. Run full analysis combining all features for comprehensive output:

    python ${CLAUDE_SKILL_DIR}/scripts/dex_router.py ETH USDC 25.0 --full --output json
    

Output

  • Quick Quote: Best price, output amount, gas cost, recommended venue
  • Comparison: All venues ranked by effective rate with price impact and gas
  • Route Analysis: Direct vs. multi-hop with hop-by-hop breakdown
  • Split Mode: Optimal allocation percentages with dollar savings vs. single-venue
  • MEV Assessment: Risk score, exposure estimate, protection recommendations

See ${CLAUDE_SKILL_DIR}/references/implementation.md for detailed output examples.

Error Handling

ErrorCauseSolution
API Rate LimitedToo many requestsWait 60s or add API key for higher limits
Quote ExpiredStale price dataRefresh before execution; quotes valid ~30s
No Route FoundLow liquidity tokenTry larger DEXs or reduce trade size
Network TimeoutAggregator downRetry or check aggregator status page

See ${CLAUDE_SKILL_DIR}/references/errors.md for comprehensive error handling.

Examples

Compare prices for a 5 ETH swap:

python ${CLAUDE_SKILL_DIR}/scripts/dex_router.py ETH USDC 5.0 --compare

Find optimal split for a large order:

python ${CLAUDE_SKILL_DIR}/scripts/dex_router.py ETH USDC 100.0 --split

Check MEV risk before executing:

python ${CLAUDE_SKILL_DIR}/scripts/dex_router.py ETH USDC 50.0 --mev-check

See ${CLAUDE_SKILL_DIR}/references/examples.md for multi-hop discovery and MEV-protected execution examples.

Resources

  • ${CLAUDE_SKILL_DIR}/references/implementation.md - Trade size guide, split optimization, MEV scoring, API config
  • 1inch API - Primary aggregator
  • Paraswap API - Secondary aggregator
  • 0x API - Third aggregator
  • Flashbots Protect - MEV protection

Frequently asked questions about Routing DEX Trades

Similar skills