agentleFS
SperaxSperax/sperax-skills/skills/token-swap-best-practices/SKILL.md

token-swap-best-practices

Skill8 starsChanged 9 months agoMITView on GitHub

Best practices for token swaps — DEX aggregator comparison, slippage management, gas optimization, cross-chain swaps, and common pitfalls. Use when helping users execute swaps, choose DEXs, or troubleshoot failed transactions.

The file

We split this skill into the rules it gives an agent

8 rules. About 0 are common, 8 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈8

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    If a swap fails with "insufficient output":

    line 41
  2. Distinctive:

    Check if the token has transfer taxes (some meme tokens have 5–10% tax)

    line 43
  3. Distinctive:

    Wait — price may be moving rapidly

    line 45
  4. Distinctive:

    When you need to move tokens between chains:

    line 71
  5. Distinctive:

    Check bridge liquidity: before large transfers

    line 85
  6. Distinctive:

    Not shown in quoted price

    line 96
  7. Distinctive:

    Before swapping, you must approve the router to spend your tokens:

    line 117
  8. Distinctive:

    Consider using exact-amount approvals for security

    line 119

≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Token Swap Best Practices

A practical guide for AI agents helping users execute safe, efficient token swaps.

DEX Aggregators

Aggregators split your trade across multiple liquidity sources for the best price.

AggregatorStrengthsChains
1inchMost liquidity sources, limit ordersEthereum, Arbitrum, Polygon, BSC, +
0x (Matcha)Professional-grade, RFQ systemEthereum, Arbitrum, Polygon, +
ParaswapMEV protection, gasless swapsEthereum, Arbitrum, Polygon, +
JupiterBest for SolanaSolana
CowSwapBatch auctions (MEV-free)Ethereum, Arbitrum

Always prefer aggregators over single DEXs — they find better prices by checking multiple sources.

Slippage Settings

Slippage tolerance = how much price movement you'll accept.

SettingWhen to UseRisk
0.1–0.3%Stablecoin pairsMay fail on volatile tokens
0.5%Standard swapsGood default
1.0%Low-liquidity tokensHigher MEV exposure
3–5%Very low liquiditySignificant MEV risk
>5%Almost neverExtreme MEV vulnerability

Default recommendation: 0.5% for most swaps.

When Swaps Fail

If a swap fails with "insufficient output":

  1. Try slightly higher slippage (0.5% → 1.0%)
  2. Check if the token has transfer taxes (some meme tokens have 5–10% tax)
  3. Try a smaller amount
  4. Wait — price may be moving rapidly

Gas Optimization

Timing

Gas prices fluctuate. For non-urgent swaps:

  • Cheapest: Weekends, early UTC morning
  • Most expensive: Weekdays during US/EU business hours
  • Check: etherscan.io/gastracker or L2-specific dashboards

Chain Selection

ChainTypical Swap CostSpeed
Ethereum L1$5–50+12 sec
Arbitrum$0.01–0.302 sec
Base$0.01–0.202 sec
Polygon$0.01–0.052 sec
BSC$0.05–0.503 sec
Solana$0.001–0.010.4 sec

Recommendation: For routine swaps, use L2s like Arbitrum (where Sperax ecosystem lives) for cents-level gas costs.

Cross-Chain Swaps

When you need to move tokens between chains:

Bridge Options

BridgeSupported ChainsSpeedNotes
Stargate15+ chains1–5 minMost reliable for stablecoins
AcrossEthereum, L2s2–10 minFast for ETH/USDC
HopEthereum, L2s5–20 minEstablished, reliable
LayerZero/Wormhole30+ chainsVariesWidest chain support

Best Practices

  1. Bridge stablecoins when possible — less slippage risk
  2. Check bridge liquidity before large transfers
  3. Double-check destination chain — mistakes are irreversible
  4. Allow extra time — bridges can be slow during congestion

Common Swap Pitfalls

1. Tax Tokens

Some tokens (especially meme tokens) have built-in transfer taxes:

  • 1–10% on every transfer
  • Requires higher slippage to account for tax
  • Not shown in quoted price

2. Low Liquidity

Signs of low liquidity:

  • Large spread between buy/sell price
  • 2% price impact on your trade size

  • Few liquidity sources on aggregator

3. Front-Running / MEV

Your transaction may get sandwiched (see MEV Protection skill).

Mitigations:

  • Low slippage tolerance
  • Private transaction submission (Flashbots)
  • Limit orders instead of market swaps
  • Batch auctions (CowSwap)

4. Approval Issues

Before swapping, you must approve the router to spend your tokens:

  • First swap with a token requires an approval transaction
  • Consider using exact-amount approvals for security
  • See Token Approval Safety skill for details

Swap Checklist

Before every swap:

  • Verify token contract address (not a scam token)
  • Check price impact (<2% for most trades)
  • Set appropriate slippage (0.5% default)
  • Compare price across 2+ aggregators for large trades
  • Consider gas costs vs trade size (don't pay $10 gas for a $50 swap)
  • Check if you need an approval transaction first

Agent Tips

  1. Always quote before executing — show the expected output and price impact
  2. Warn about high price impact — >2% impact suggests splitting the trade
  3. Recommend L2s for small swaps — don't pay Ethereum L1 gas for small trades
  4. For large swaps ($10K+) — suggest splitting, using aggregators, and low slippage
  5. Cross-chain: bridge stablecoins first, then swap on destination chain
  6. Sperax ecosystem users should swap on Arbitrum for lowest costs

Links

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.