
Swap Planner
Plan Uniswap token swaps with live pool liquidity and USD prices from DexScreener and DefiLlama without wiring DEX APIs by hand.
Overview
Swap-planner is an agent skill for the Build phase that fetches DexScreener and DefiLlama market data to plan Uniswap swaps with real liquidity and USD prices.
Install
npx skills add https://github.com/uniswap/uniswap-ai --skill swap-plannerWhat is this skill?
- Primary DexScreener token and pair lookups with DefiLlama fallback for prices and TVL
- Network coverage includes ethereum, base, arbitrum, optimism, polygon, bsc, avalanche, and unichain
- 300 requests/minute on DexScreener with no API key for quick agent-driven quotes
- Documented limitations for Celo, Blast, Zora, and World Chain pool depth
- Search and filter patterns for discovering pairs by keyword on a chosen chain
- DexScreener public tier: 300 requests per minute
- Primary plus fallback: DexScreener and DefiLlama
Adoption & trust: 662 installs on skills.sh; 212 GitHub stars; 2/3 security scanners passed (skills.sh audits).
What problem does it solve?
You need to quote or route a swap but lack a repeatable way to pull live pool prices and liquidity across EVM networks.
Who is it for?
Indie builders coding DeFi agents, dashboards, or swap UIs that must read public DEX screeners before touching Uniswap routers.
Skip if: Teams that only need static token metadata, non-EVM chains outside the documented network list, or fully custodial trade execution without their own safety layer.
When should I use this skill?
Planning or quoting Uniswap-related swaps and you need live pool prices, liquidity USD, or keyword pair search on supported EVM networks.
What do I get? / Deliverables
Your agent returns structured price, symbol, and liquidity fields from documented APIs so you can compare pools before writing swap execution code.
- Documented API call patterns for token price and liquidity
- Filtered pair lists or price snapshots for swap comparison
Recommended Skills
Journey fit
Swap planning sits in Build because solo builders wire external DeFi data providers into agents or scripts before shipping trading or treasury tooling. Integrations is the right shelf for curl/JQ workflows against DexScreener and DefiLlama rather than on-chain contract authoring alone.
How it compares
Use instead of hard-coding RPC-only reserves when you want fast off-chain pool discovery across many chains.
Common Questions / FAQ
Who is swap-planner for?
Solo and indie developers building Uniswap-aware agents, APIs, or internal tools who want copy-paste data provider patterns rather than reverse-engineering DEX APIs alone.
When should I use swap-planner?
Use it during Build integrations when comparing WETH or memecoin pairs on Base, sanity-checking liquidity on Arbitrum, or prototyping a swap copilot before you ship on-chain execution.
Is swap-planner safe to install?
Review the Security Audits panel on this Prism page and treat outbound market-data calls as untrusted input; the skill describes read-only HTTP fetches, not private keys or trade signing.
SKILL.md
READMESKILL.md - Swap Planner
# Data Providers Reference APIs for fetching real-time token prices and pool liquidity for swap planning. **Primary:** DexScreener (pool discovery, prices, liquidity) **Fallback:** DefiLlama (prices, pool TVL) ## DexScreener API (Primary) No authentication required. 300 requests/minute. **Network IDs:** `ethereum`, `base`, `arbitrum`, `optimism`, `polygon`, `bsc`, `avalanche`, `unichain` (full list with DefiLlama equivalents in `../../references/chains.md`) **Coverage note:** Ethereum, Base, and Arbitrum have deep Uniswap pool data. Celo, Blast, Zora, and World Chain have limited coverage — expect fewer results and potentially missing pairs. ### Get Token Price ```bash # Get token info including price curl -s "https://api.dexscreener.com/tokens/v1/{network}/{address}" | \ jq '.[0] | {symbol: .baseToken.symbol, priceUsd: .priceUsd, liquidity: .liquidity.usd}' ``` **Example - Get WETH price on Base:** ```bash curl -s "https://api.dexscreener.com/tokens/v1/base/0x4200000000000000000000000000000000000006" | \ jq '.[0] | {symbol: .baseToken.symbol, priceUsd: .priceUsd}' ``` ### Token Discovery **Note:** DexScreener's public API doesn't have a dedicated "trending" or "top gainers" endpoint. Use these approaches: **Search by keyword** (best for specific categories): ```bash # Search for tokens by name/theme (e.g., degen, pepe, ai, meme) curl -s "https://api.dexscreener.com/latest/dex/search?q=degen" | \ jq '[.pairs[] | select(.chainId == "base")] | sort_by(-.volume.h24) | .[0:5] | map({ token: .baseToken.symbol, address: .baseToken.address, price: .priceUsd, volume24h: .volume.h24, liquidity: .liquidity.usd })' ``` **Promoted tokens** (limited selection): ```bash curl -s "https://api.dexscreener.com/token-boosts/top/v1" | \ jq '[.[] | select(.chainId == "base")] | map({tokenAddress, url})' ``` ### Find Pools for Token Pair ```bash # Find all pools containing a token curl -s "https://api.dexscreener.com/token-pairs/v1/{network}/{address}" | \ jq '[.[] | select(.dexId == "uniswap")] | map({ pairAddress, baseToken: .baseToken.symbol, quoteToken: .quoteToken.symbol, priceUsd, liquidity: .liquidity.usd, volume24h: .volume.h24 })' ``` ### Response Fields | Field | Path | Description | | ----------- | ------------------- | -------------------- | | Price USD | `priceUsd` | Current token price | | Liquidity | `liquidity.usd` | Pool TVL in USD | | 24h Volume | `volume.h24` | Trading volume | | Base token | `baseToken.symbol` | First token in pair | | Quote token | `quoteToken.symbol` | Second token in pair | ### Important Notes - **Filter by DEX**: Results include all DEXes. Filter with `select(.dexId == "uniswap")` for Uniswap-only. - **Multiple pools**: Same pair may have multiple pools (different fee tiers). Highest liquidity is usually best for swaps. ## DefiLlama API (Fallback) No authentication required. Use when DexScreener is unavailable or for cross-chain price checks. ### Get Price by Contract ```bash curl -s "https://coins.llama.fi/prices/current/{chain}:{address}" ``` **Chain IDs:** `ethereum`, `base`, `arbitrum`, `optimism`, `polygon`, `bsc`, `avax`, `unichain` (full list in `../../references/chains.md`) **Important:** DefiLlama uses `avax` (not `avalanche`), and Zora/World Chain are not indexed by DefiLlama. **Example - Get prices for multiple tokens:** ```bash curl -s "https://coins.llama.fi/prices/current/base:0x4200000000000000000000000000000000000006,base:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913" | \ jq '.coins | to_entries | map({address: .key, price: .value.price, symbol: .value.symbol})' ``` ## Usage Patterns ### Pattern 1: Known Token Swap For "swap 1 ETH to USDC" requests: ```bash # 1. Get both token prices from DexScreener curl -s "https://api.dexscreener.com/token-pairs/v1/base/0x4200000000000000000000000000000000000006" | \ jq '[.[] | select(.dexId == "