Skip to content
Back to skills

Execute Swap

ASecurity

Execute a Uniswap token swap. Use when user wants to swap, trade,

  • 21 stars
  • 0 votes
  • 0 copies
  • 7 views
  • Added September 7, 2026
ai-agentsgit

Works with

  • mcp

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned September 7, 2026

npx -y skills add modbender/skill-library-mcp --skill execute-swap --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Execute Swap?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Execute Swap
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/modbender-execute-swap/badge)](https://www.skillsdirectory.com/skills/modbender-execute-swap)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: execute-swap
description: Execute a Uniswap token swap. Use when user wants to swap, trade,
  buy, or sell tokens. Handles quotes, safety checks, simulation, and execution
  autonomously. Supports V2, V3, V4, UniswapX, and cross-chain routing on all
  supported chains.
---


# Execute Swap

Execute a token swap on Uniswap with full safety validation.

## Activation

Use this skill when the user says any of:
- "Swap X for Y"
- "Buy X with Y"
- "Sell X for Y"
- "Trade X for Y"
- "Exchange X to Y"
- "Convert X to Y"

## Input Extraction

Extract these parameters from the user's message:

| Parameter | Required | Default | Source |
|-----------|----------|---------|--------|
| `tokenIn` | Yes | — | Token name/symbol/address |
| `tokenOut` | Yes | — | Token name/symbol/address |
| `amount` | Yes | — | Numeric value |
| `chain` | No | ethereum | Chain name or context |
| `slippage` | No | 0.5% | Explicit percentage |
| `routing` | No | auto | "via V3", "use UniswapX", etc. |

## Workflow

1. **Validate inputs**: Resolve token symbols using `search_tokens`. Confirm chain is supported.

2. **Pre-flight safety check**: Call `check_safety_status` to verify:
   - Spending limits have room for this trade
   - Rate limits are not exhausted
   - Circuit breaker is not tripped

3. **Delegate to trade-executor**: Launch `Task(subagent_type:trade-executor)` with:
   - tokenIn, tokenOut, amount, chain
   - slippageTolerance (in bps)
   - routingPreference (auto/v2/v3/v4/uniswapx)

4. **Report result** to the user in a clear format:

```
Swap Executed Successfully

  Input:  500.00 USDC
  Output: 0.1538 WETH ($499.55)
  Price:  1 WETH = $3,248.04
  Impact: 0.01%
  Gas:    $0.42

  Tx: https://basescan.org/tx/0xABC...

  Safety: All 7 checks passed
```

## Error Handling

| Error | User Message | Suggested Action |
|-------|-------------|-----------------|
| `SAFETY_SPENDING_LIMIT_EXCEEDED` | "This swap would exceed your $X daily limit." | Reduce amount or wait |
| `SAFETY_TOKEN_NOT_ALLOWED` | "TOKEN is not on your allowlist." | Add to config |
| `SAFETY_SIMULATION_FAILED` | "Swap simulation failed: [reason]." | Check addresses, try smaller |
| `INSUFFICIENT_LIQUIDITY` | "Not enough liquidity at acceptable slippage." | Try smaller amount |

## MCP server dependency

This skill relies on Uniswap MCP tools for chain support lookup, token search, safety checks, and swap execution.
When used in isolation (for example, from a skills catalog), ensure the Agentic Uniswap MCP server is running:

- Repo: [`Agentic-Uniswap` MCP server](https://github.com/wpank/Agentic-Uniswap/tree/main/packages/mcp-server)
- Package: `@agentic-uniswap/mcp-server`

Files in this skill

  • README.md1 KB
  • SKILL.md2.7 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.