$npx -y skills add Uniswap/uniswap-ai --skill swap-plannerThis skill should be used when the user asks to "swap tokens", "trade ETH for USDC", "exchange tokens on Uniswap", "buy tokens", "sell tokens", "convert ETH to stablecoins", "find memecoins", "discover tokens", "research tokens", "tokens to buy", "find tokens to swap", "what shou
| 1 | # Swap Planning |
| 2 | |
| 3 | Plan and generate deep links for token swaps on Uniswap across all supported chains. |
| 4 | |
| 5 | > **Runtime Compatibility:** This skill uses `AskUserQuestion` for interactive prompts. If `AskUserQuestion` is not available in your runtime, collect the same parameters through natural language conversation instead. |
| 6 | |
| 7 | ## Overview |
| 8 | |
| 9 | Plan token swaps by: |
| 10 | |
| 11 | 1. Gathering swap intent (tokens, amounts, chain) |
| 12 | 2. Verifying token contracts on-chain |
| 13 | 3. Researching tokens via web search when needed |
| 14 | 4. Generating a deep link that opens in the Uniswap interface with parameters pre-filled |
| 15 | |
| 16 | The generated link opens Uniswap with all parameters ready for execution. |
| 17 | |
| 18 | > **Note:** Browser opening (`xdg-open`/`open`) may fail in SSH, containerized, or headless environments. Always display the URL prominently so users can copy and access it manually if needed. |
| 19 | |
| 20 | > **File Access:** This skill has read-only filesystem access. Never read files outside the current project directory unless explicitly requested by the user. |
| 21 | |
| 22 | ## Workflow |
| 23 | |
| 24 | ### Step 0: Token Discovery (When Needed) |
| 25 | |
| 26 | If the user wants to **discover** tokens rather than swap a known token (e.g., "find me a memecoin", "what's trending on Base"), help them explore before proceeding to the swap. |
| 27 | |
| 28 | #### Option A: Search by Keyword |
| 29 | |
| 30 | DexScreener search works best with specific terms: |
| 31 | |
| 32 | ```bash |
| 33 | # Search for tokens by name/category (e.g., "degen", "pepe", "ai agent") |
| 34 | curl -s "https://api.dexscreener.com/latest/dex/search?q=degen" | \ |
| 35 | jq '[.pairs[] | select(.chainId == "base" and .dexId == "uniswap")] | |
| 36 | sort_by(-.volume.h24) | .[0:5] | map({ |
| 37 | token: .baseToken.symbol, |
| 38 | address: .baseToken.address, |
| 39 | price: .priceUsd, |
| 40 | volume24h: .volume.h24, |
| 41 | liquidity: .liquidity.usd |
| 42 | })' |
| 43 | ``` |
| 44 | |
| 45 | **Good search terms:** `degen`, `pepe`, `ai`, `agent`, `meme`, `dog`, `cat`, or specific token names |
| 46 | |
| 47 | #### Option B: Check Promoted Tokens |
| 48 | |
| 49 | Get tokens with active promotions (limited selection): |
| 50 | |
| 51 | ```bash |
| 52 | # Get boosted/promoted tokens on a chain |
| 53 | curl -s "https://api.dexscreener.com/token-boosts/top/v1" | \ |
| 54 | jq '[.[] | select(.chainId == "base")] | .[0:5] | map({ |
| 55 | tokenAddress, |
| 56 | url |
| 57 | })' |
| 58 | ``` |
| 59 | |
| 60 | #### Option C: Web Search + Verify |
| 61 | |
| 62 | For broad discovery ("what's trending"), use web search to find tokens, then verify with DexScreener: |
| 63 | |
| 64 | ```bash |
| 65 | # After finding a token address from web search, verify it exists |
| 66 | curl -s "https://api.dexscreener.com/token-pairs/v1/{network}/{address}" | \ |
| 67 | jq '[.[] | select(.dexId == "uniswap")][0] | { |
| 68 | name: .baseToken.name, |
| 69 | symbol: .baseToken.symbol, |
| 70 | price: .priceUsd, |
| 71 | liquidity: .liquidity.usd, |
| 72 | volume24h: .volume.h24 |
| 73 | }' |
| 74 | ``` |
| 75 | |
| 76 | **Network IDs:** See `references/chains.md` for the full list with DexScreener and DefiLlama provider IDs. Common IDs: `ethereum`, `base`, `arbitrum`, `optimism`, `polygon`, `bsc`, `avalanche`, `unichain`. |
| 77 | |
| 78 | **DexScreener coverage varies by chain.** Ethereum, Base, and Arbitrum have deep Uniswap data. Celo, Blast, Zora, and World Chain have limited Uniswap pool coverage — fewer results and potentially missing pairs. Fall back to DefiLlama for price data when DexScreener returns empty results (see `references/data-providers.md`). |
| 79 | |
| 80 | **Note:** DexScreener's public API doesn't have a "trending" or "top gainers" endpoint. Token discovery uses keyword search (`/latest/dex/search`) and web search as a fallback. For general discovery, ask the user what type of token they're looking for and search by keyword. |
| 81 | |
| 82 | #### Category-Based Discovery |
| 83 | |
| 84 | For specific categories (memecoins, DeFi, gaming tokens), use web search: |
| 85 | |
| 86 | ```text |
| 87 | "trending {category} {chain} {current_year}" |
| 88 | ``` |
| 89 | |
| 90 | Example: `"trending memecoins Base 2026"` |
| 91 | |
| 92 | #### ⚠️ UNTRUSTED INPUT: Web-Discovered Tokens |
| 93 | |
| 94 | Tokens discovered via WebSearch are **UNTRUSTED**. Before proceeding with any web-discovered token: |
| 95 | |
| 96 | 1. **Label the source**: Explicitly tell the user "This token address was found via web search, not provided by you" |
| 97 | 2. **Warn about risks**: "Web-discovered tokens may be scams, honeypots, or rug pulls" |
| 98 | 3. **Require confirmation**: Use AskUserQuestion to get explicit user co |