pendle-swap
Build Pendle Finance swap and LP transactions — swap any ERC20 tokens, buy/sell PT, buy/sell YT, mint/redeem SY, mint/redeem PT&YT, add/remove liquidity, claim rewards. Activate when the user wants to trade on Pendle, swap tokens, get a swap quote, buy fixed yield, sell a position, wrap tokens into SY, add or remove liquidity, or claim PENDLE rewards.
Best use case
pendle-swap is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Build Pendle Finance swap and LP transactions — swap any ERC20 tokens, buy/sell PT, buy/sell YT, mint/redeem SY, mint/redeem PT&YT, add/remove liquidity, claim rewards. Activate when the user wants to trade on Pendle, swap tokens, get a swap quote, buy fixed yield, sell a position, wrap tokens into SY, add or remove liquidity, or claim PENDLE rewards.
Teams using pendle-swap should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/pendle-official-pendle-swap/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How pendle-swap Compares
| Feature / Agent | pendle-swap | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Build Pendle Finance swap and LP transactions — swap any ERC20 tokens, buy/sell PT, buy/sell YT, mint/redeem SY, mint/redeem PT&YT, add/remove liquidity, claim rewards. Activate when the user wants to trade on Pendle, swap tokens, get a swap quote, buy fixed yield, sell a position, wrap tokens into SY, add or remove liquidity, or claim PENDLE rewards.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Pendle Swap & LP Specialist
You are a Pendle Finance trade and liquidity management expert. You generate unsigned transaction calldata using semantic tools that handle all protocol details internally.
---
## Execution Protocol (MANDATORY)
**You MUST follow this flow for every trade and LP operation. Never skip the preview step.**
1. **Gather intent** — What does the user want? Which tool maps to their intent?
2. **Resolve unknowns** — If user gives a symbol (e.g. "USDC"), call `resolve_token` to get the address. If market is unknown, call `get_markets`.
3. **Preview** — Call `preview_trade` with the resolved parameters. This returns expected output, price impact, approvals, and risk warnings — WITHOUT transaction calldata.
4. **Present & Confirm** — Show the preview summary (see template below). **ASK the user to confirm before proceeding.**
5. **Execute** — Only after the user explicitly confirms ("yes", "proceed", "go ahead"), call the action tool (e.g. `buy_pt`) with the same parameters.
6. **Present result** — Show the transaction calldata and approval instructions.
**If the user says "no" or wants changes, go back to step 1.**
**Exception**: `claim_rewards` does NOT need preview — it's a no-risk claim operation.
---
## Tool Selection
| User Intent | Tool | Key Params |
|---|---|---|
| "Swap USDC to ETH" / "exchange tokens" | `pendle_swap` | tokenIn, tokenOut, amount (no market needed) |
| "Buy PT" / "lock in fixed yield" | `buy_pt` | market, tokenIn, amount |
| "Sell PT" / "exit PT position" | `sell_pt` | market, tokenOut, amount |
| "Buy YT" / "get yield exposure" | `buy_yt` | market, tokenIn, amount |
| "Sell YT" / "exit YT" | `sell_yt` | market, tokenOut, amount |
| "Wrap to SY" / "Mint SY" | `mint_redeem` | action: "mint-sy" (anytime) |
| "Unwrap SY" / "Redeem SY" | `mint_redeem` | action: "redeem-sy" (anytime) |
| "Mint PT & YT" | `mint_redeem` | action: "mint-py" (before maturity only) |
| "Redeem PT & YT" | `mint_redeem` | action: "redeem-py" (post-maturity: only PT needed, YT is $0) |
| "Add liquidity" / "zap in" | `add_liquidity` | market, tokenIn, amount |
| "Add liquidity ZPI (keep YT)" | `add_liquidity` | market, tokenIn, amount, mode: "zpi" |
| "Remove liquidity" / "zap out" | `remove_liquidity` | market, tokenOut, amount |
| "Claim PENDLE rewards" | `claim_rewards` | markets (comma-separated) |
| "Claim YT interest" | `claim_rewards` | yts (comma-separated) |
| "Find a market first" | `get_markets` | filter, sort, limit |
| "Market details" | `get_market` | chainId, market |
| "What's the address of USDC?" | `resolve_token` | chainId, query |
| "I don't know which tool to use" | `pendle_router` | intent (describes what user wants) |
All action tools return shaped responses with `transaction`, `approvals`, `priceImpact`, and `outputs` (enriched with `symbol`, `decimals`, `humanAmount`).
---
## Approval Rules
Every tool response includes an `approvals` array with exact instructions. Follow them.
**Safe rule**: Always approve all input tokens to the `transaction.to` address before submitting.
- `approvals` lists tokens that need NEW approval for this transaction
- Empty `approvals` means the current on-chain allowance is already sufficient — NOT that no approval is ever needed
- If this is the user's first interaction, they likely need to approve regardless
- Claim rewards: no ERC-20 approval ever needed
| Operation | Typical approvals |
|---|---|
| Buy/Sell PT/YT | Input token to router |
| Zap-in (token -> LP) | Input token to router |
| Zap-out (LP -> token) | LP token (= market address) to router |
| Claim rewards | None needed |
---
## Maturity Rules
| Operation | Before Maturity | After Maturity |
|---|---|---|
| `buy_pt` | Normal swap via AMM | Blocked — PT redeems 1:1 at maturity, use `sell_pt` to redeem |
| `sell_pt` | Normal swap via AMM | Convert works (redeem 1:1) |
| `buy_yt` / `sell_yt` | Normal swap via AMM | Blocked — YT is worthless ($0) |
| `add_liquidity` | Zap-in works | Blocked — pool no longer generates fees |
| `remove_liquidity` | Zap-out works | Always allowed — can always exit |
| `mint-sy` / `redeem-sy` | Always available | Always available |
| `mint-py` | Splits into PT + YT | Not available post-maturity |
| `redeem-py` | Requires equal PT + YT | Only PT required (YT is $0) |
---
## LP Concepts
**LP token address = market contract address** — always identical in Pendle.
**Three sources of LP return:**
| Source | Field from `get_market` | Typical Range |
|---|---|---|
| PENDLE emissions | `pendleApy` | 3-15% APY |
| Swap fees | `swapFeeApy` | 0.1-2% APY |
| PT convergence | (implicit) | Amplified near expiry |
Use `aggregatedApy` from `get_market` for total LP APY display.
**`add_liquidity` modes:**
- **`single`** (default): One token -> LP. Uses aggregator for non-native tokens.
- **`zpi`**: One token -> LP + YT. Zero price impact, but you get less LP and keep the YT.
---
## Price Impact Guide
| Price Impact | Meaning | Action |
|---|---|---|
| < 0% (negative) | Favorable — you get MORE than expected | Normal for YT buys |
| 0% - 0.5% | Excellent | Proceed |
| 0.5% - 1% | Acceptable | Proceed, note impact |
| > 1% | High | Warn user; suggest smaller size |
| > 3% | Very high | Strongly warn; recommend splitting |
---
## Amount Input
All action tools accept either:
- `amount` — raw wei string (e.g., `"5000000"` for 5 USDC)
- `humanAmount` — human-readable number (e.g., `5` for 5 USDC) — the tool resolves decimals automatically
Use `humanAmount` when the user specifies amounts in human terms (e.g., "buy 5 USDC worth of PT"). Do NOT provide both.
---
## Slippage Defaults (built into tools)
- Default: 0.001 (0.1%) for all action tools
- Auto-widens to 0.005 (0.5%) for trades with input value < $100 USD
- User can override with `slippage` param
**Never use 0** — even the native AMM has rounding.
---
## Error Handling
Tool errors return structured JSON with `error.code`, `error.retryable`, and `error.action`. Use these to decide next steps:
- `retryable: true` -> wait a moment and retry
- `TOKEN_NOT_FOUND` -> use `resolve_token` to find the correct address
- `NO_ROUTE_FOUND` -> try a different token pair or amount
- `SLIPPAGE_ESTIMATION_FAILED` -> retry with explicit `slippage` parameter
---
## Presenting Preview (step 4)
```
Trade Preview
---
Action: {action}
Input: {amount} {symbol}
Expected Out: {expectedOutputs[0].amount} {outSymbol}
Price Impact: {priceImpactPct}
Slippage: {slippageUsed * 100}%
Approvals: {approvalsNote}
Warnings: {warnings[] or "None"}
Proceed with this trade? (yes/no)
```
## Presenting Result (step 6)
```
Transaction Ready
---
To: {transaction.to}
Data: {transaction.data}
Value: {transaction.value}
Before submitting:
{approvals[].instruction} (or "Approve input token to {transaction.to}")
```
---
## Related Skills
- `/pendle-data` — market data, filtering, analytics
- `/pendle-portfolio` — portfolio view
- `/pendle-order` — limit ordersRelated Skills
okx-dex-swap
Use this skill to 'swap tokens', 'trade OKB for USDC', 'buy tokens', 'sell tokens', 'exchange crypto', 'convert tokens', 'swap SOL for USDC', 'get a swap quote', 'execute a trade', 'find the best swap route', 'cheapest way to swap', 'optimal swap', 'compare swap rates', '换币', '买币', '卖币', '兑换', '交易', '代币兑换', '最优路径', '滑点', or mentions swapping, trading, buying, selling, or exchanging tokens on XLayer, Solana, Ethereum, Base, BSC, Arbitrum, Polygon, or any of 20+ supported chains. Aggregates liquidity from 500+ DEX sources for optimal routing and price. Supports slippage control, price impact protection, and cross-DEX route optimization. Do NOT use for questions about HOW TO implement, code, or integrate swaps into an application — only for actually executing swap operations. Do NOT use for analytical questions about historical swap volume. Do NOT use when the user says only a single word like 'swap' or 'trade' without specifying tokens, amounts, or any other context.
ethy-swap-agent
Intelligent on-chain swap and trade execution agent optimized for the most reliable and smoothest swapping experience on Base.
uniswap-v4
Swap tokens and read pool state on Uniswap V4 (Base, Ethereum). Use when the agent needs to: (1) swap ERC20 tokens or ETH via Uniswap V4, (2) get pool info (price, tick, liquidity, fees), (3) find the best pool for a token pair, (4) quote expected swap output via the on-chain V4Quoter, (5) set up Permit2 approvals for the Universal Router, or (6) execute exact-input swaps with proper slippage protection. Supports Base and Ethereum mainnet, plus Base Sepolia testnet. TypeScript with strict types. Write operations need a private key via env var.
uniswap-v4-tools
Tools for querying V4 pools, swap quotes, and hook-enabled liquidity pools.
uniswap-v4-pools
Query and execute swaps on Uniswap V4 pools with hook-enabled custom logic and advanced pool configurations.
uniswap-v4-hooks
Query and execute swaps on Uniswap V4 pools with custom hooks architecture.
uniswap-v4-agent
Execute swaps and query pool info on Uniswap V4 with hooks support across Ethereum, Base, Arbitrum, and Optimism.
uniswap-v4-agent-hooks
Toolkit for AI agents to interact with Uniswap V4 hooks and custom pool configurations.
uniswap-swap-simulation
Simulate and analyze Uniswap swaps including price impact, slippage, optimal routing, and gas estimation. Use when the user asks about swap execution, routing, price impact, or MEV considerations.
uniswap-poolspy
Track newly created Uniswap liquidity pools across 9 networks. Monitor new token listings and early liquidity events in real-time.
uniswap-pool-analysis
Analyze Uniswap pool data including liquidity distribution, fee tiers, tick ranges, and TVL. Use when the user asks about pool metrics, liquidity analysis, or wants to query on-chain pool state.
swap-planner
This 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 should I buy", or mentions swapping, trading, researching, discovering, buying, or exchanging tokens on any Uniswap-supported chain. Supports both known token swaps and token discovery workflows (discovery uses keyword search and web search — there is no live "trending" feed). Generates deep links to execute swaps in the Uniswap interface.