quote
This skill should be used when the user asks to "get a swap quote", "check swap price", "compare token rates", "see exchange rates", "how much would I get for", "price check", or wants to know the expected output for a token trade. Fetches the best route from KyberSwap Aggregator across 18 EVM chains.
- License 许可
- AGPL-3.0
- 最近更新
- 2026-11-15
- Stars
- ★ 81
- Forks
- 17
01 前言 Front Matter
- name
- quote
- metadata
- { "tags": [ "defi", "kyberswap", "swap", "quote", "evm", "aggregator" ], "homepage": "https://kyberswap.com", "provider": "KyberSwap" }
- description
- This skill should be used when the user asks to "get a swap quote", "check swap price", "compare token rates", "see exchange rates", "how much would I get for", "price check", or wants to know the expected output for a token trade. Fetches the best route from KyberSwap Aggregator across 18 EVM chains.
02 资源文件 4
- 参考文档references/basic-quote.md1.0 KB
- 参考文档references/multi-chain-quote.md611 B
- 参考文档SOURCE.md171 B
- 参考文档TRUST.auto.yaml2.1 KB
03 SKILL.md 正文
KyberSwap Quote Skill
Fetch swap quotes from the KyberSwap Aggregator. Given a token pair and amount, retrieve the best route and present a clear summary including expected output, exchange rate, and gas cost.
Input Parsing
The user will provide input like:
1 ETH to USDC on ethereum100 USDC to WBTC on arbitrum0.5 WBTC to DAI on polygon1000 USDT to ETH(default chain: ethereum)
Extract these fields:
- amount — the human-readable amount to swap
- tokenIn — the input token symbol
- tokenOut — the output token symbol
- chain — the chain slug (default:
ethereum)
Workflow
Step 1: Resolve Token Addresses
Read the token registry at ${CLAUDE_PLUGIN_ROOT}/references/token-registry.md.
Look up tokenIn and tokenOut for the specified chain. Match case-insensitively. Note the decimals for each token.
Aliases to handle:
- "ETH" on Ethereum/Arbitrum/Optimism/Base/Linea/Unichain → native token address
- "MATIC" or "POL" on Polygon → native token address
- "BNB" on BSC → native token address
- "AVAX" on Avalanche → native token address
- "MNT" on Mantle → native token address
- "S" on Sonic → native token address
- "BERA" on Berachain → native token address
- "RON" on Ronin → native token address
- "XTZ" on Etherlink → native token address
- "MON" on Monad → native token address
If a token is not found in the registry:
Use the fallback sequence described at the bottom of ${CLAUDE_PLUGIN_ROOT}/references/token-registry.md:
- KyberSwap Token API (preferred) — search whitelisted tokens first:
https://token-api.kyberswap.com/api/v1/public/tokens?chainIds={chainId}&name={symbol}&isWhitelisted=truevia WebFetch. Pick the result whosesymbolmatches exactly with the highestmarketCap. If no whitelisted match, retry withoutisWhitelisted(only trust verified or market-cap tokens). If still nothing, browsepage=1&pageSize=100(try up to 3 pages). - CoinGecko API (secondary fallback) — search CoinGecko for verified contract addresses if the Token API doesn't have it.
- Ask user manually (final fallback) — if CoinGecko also fails, ask the user to provide the contract address. Never guess or fabricate addresses.
Step 2: Check Token Safety
For any token not in the built-in registry and not a native token, check the honeypot/FOT API. (Note: registry tokens are assumed safe, but a compromised proxy token could theoretically be updated. For high-value swaps involving proxy tokens, consider checking the safety API even for registry tokens.)
GET https://token-api.kyberswap.com/api/v1/public/tokens/honeypot-fot-info?chainId={chainId}&address={tokenAddress}
Via WebFetch, check both tokenIn and tokenOut:
- If
isHoneypot: true— warn the user that this token is flagged as a honeypot (cannot be sold after buying). Display the warning prominently. - If
isFOT: true— warn the user that this token has a fee-on-transfer (tax:{tax}%). The actual received amount will be less than the quoted output. Display the adjusted estimate:adjustedAmount = quotedAmount * (1 - tax/100). Example: if the quote shows 100 USDC and tax is 5%, display "~95 USDC after tax".
Step 3: Convert Amount to Wei
amountInWei = amount * 10^(tokenIn decimals)
The result must be a plain integer string with no decimals, no scientific notation, and no separators.
For wei conversion, use a deterministic method instead of relying on AI mental math:
python3 -c "print(int(AMOUNT * 10**DECIMALS))"
# or
echo "AMOUNT * 10^DECIMALS" | bc
Verify known reference values: 1 ETH = 1000000000000000000 (18 decimals), 1 USDC = 1000000 (6 decimals)
Examples:
- 1 ETH (18 decimals) =
1000000000000000000 - 100 USDC (6 decimals) =
100000000 - 0.5 WBTC (8 decimals) =
50000000
Step 4: Call the Routes API (GET request)
Read the API reference at ${CLAUDE_PLUGIN_ROOT}/references/api-reference.md for the full specification.
Make the request using WebFetch:
URL: https://aggregator-api.kyberswap.com/{chain}/api/v1/routes?tokenIn={tokenInAddress}&tokenOut={tokenOutAddress}&amountIn={amountInWei}&source=ai-agent-skills
Prompt: Return the full JSON response body
Step 5: Handle Errors
Check the code field in the JSON response and handle common errors inline:
| Code | Message | Quick Fix |
|---|---|---|
| 4008 | Route not found | No liquidity for this pair/amount. Remove source filters (includedSources/excludedSources), try a smaller amount, or retry after a few seconds. |
| 4011 | Token not found | Verify the token address is correct for this chain. Use 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE for native tokens. Check spelling and 0x prefix. |
| 4000 | Bad request | Read the fieldViolations array in the response. Common issues: amountIn must be a plain integer string in wei (no decimals, no scientific notation), addresses must be 42-char hex with lowercase 0x. |
| 4010 / 40011 | No eligible pools / Filtered sources (observed behavior, not in public API docs) | Remove includedSources/excludedSources filters. The pair may have liquidity only on specific DEXs. |
| 404 | Chain not found | Check chain slug spelling. Supported: ethereum, bsc, polygon, arbitrum, optimism, avalanche, base, linea, mantle, sonic, berachain, ronin, unichain, hyperevm, plasma, etherlink, monad, megaeth. |
| 4990 | Request canceled | Retry the request. Likely a timeout or network issue. |
| 500 | Internal server error | Verify all addresses are valid hex. Retry — may be transient. |
For any error code not listed above, or for deeper troubleshooting, refer to ${CLAUDE_PLUGIN_ROOT}/skills/error-handling/SKILL.md for the comprehensive error reference.
Step 5b: Dust Amount Warning
After getting a successful route, check the USD values from the response:
- If
amountInUsd< $0.10 — warn the user: "This swap amount is extremely small (~$X). Gas fees (~$Y) will far exceed the swap value. Consider using a larger amount." - If
gasUsd>amountInUsd— warn the user: "Gas cost (~$Y) exceeds the swap value (~$X). This trade is uneconomical."
Still show the quote, but include the warning prominently before the results table.
Step 6: Format the Output
Present the results in this format:
## KyberSwap Quote
**{amount} {tokenIn} → {amountOut} {tokenOut}** on {Chain}
| Detail | Value |
|---|---|
| Input | {amount} {tokenIn} (~${amountInUsd}) |
| Output | {amountOut} {tokenOut} (~${amountOutUsd}) |
| Rate | 1 {tokenIn} = {rate} {tokenOut} |
| Gas estimate | {gas} units (~${gasUsd}) |
| L1 fee (L2 only) | ~${l1FeeUsd} *(omit this row on L1 chains or if `l1FeeUsd` is `"0"`)* |
| Router | `{routerAddress}` |
### Route
{For each split in the route, show: tokenIn → tokenOut via [exchange name]}
Calculating the output amount:
Convert amountOut from wei back to human-readable using tokenOut's decimals:
humanAmount = amountOut / 10^(tokenOut decimals)
Calculating the rate:
rate = humanAmountOut / humanAmountIn
Display rates with appropriate precision (up to 6 significant digits).
Structured JSON Output
After the markdown table, always include a JSON code block so other plugins or agents can consume the result programmatically:
```json
{
"type": "kyberswap-quote",
"chain": "{chain}",
"tokenIn": {
"symbol": "{tokenIn}",
"address": "{tokenInAddress}",
"decimals": {tokenInDecimals},
"amount": "{amount}",
"amountWei": "{amountInWei}",
"amountUsd": "{amountInUsd}"
},
"tokenOut": {
"symbol": "{tokenOut}",
"address": "{tokenOutAddress}",
"decimals": {tokenOutDecimals},
"amount": "{amountOut}",
"amountWei": "{amountOutWei}",
"amountUsd": "{amountOutUsd}"
},
"rate": "{rate}",
"gas": "{gas}",
"gasUsd": "{gasUsd}",
"routerAddress": "{routerAddress}"
}
```
This JSON block enables downstream agents or plugins to parse the quote result without scraping the markdown table.
Important Notes
- Always read both
${CLAUDE_PLUGIN_ROOT}/references/token-registry.mdand${CLAUDE_PLUGIN_ROOT}/references/api-reference.mdbefore making API calls. - Never guess token addresses. Always verify from the registry or via the Token API / search.
- If the user doesn't specify a chain, default to
ethereum. - If the user specifies a chain not listed in
references/api-reference.md, queryhttps://common-service.kyberswap.com/api/v1/aggregator/supported-chainsvia WebFetch to check if the chain is supported. Look for a matchingchainNamewithstate: "active"orstate: "new". Use thechainNamevalue as the path slug. - The quote is informational only — no transaction is built or submitted.
Additional Resources
Reference Files
${CLAUDE_PLUGIN_ROOT}/references/api-reference.md— Full API specification, error codes, rate limiting${CLAUDE_PLUGIN_ROOT}/references/token-registry.md— Token addresses and decimals by chain
Example Files
Working examples in ${CLAUDE_PLUGIN_ROOT}/skills/quote/references/:
basic-quote.md— Simple ETH to USDC quote on Ethereummulti-chain-quote.md— Quote on L2 chain with L1 fee
Troubleshooting
For error codes not covered in Step 5, or for advanced debugging (PMM/RFQ errors, edge cases), refer to ${CLAUDE_PLUGIN_ROOT}/skills/error-handling/SKILL.md.
04 同仓库更多 Skills
troves
Deposit and withdraw from Troves DeFi yield vault strategies on Starknet. View available strategies, check positions, and manage vault deposits. Use this skill when the user mentions Troves, vault, yield vault, DeFi vault, strategy, yield farming, vault deposit, vault withdraw, earning yield through vaults, passive yield strategies, or wants to deposit into or withdraw from a yield strategy — even if they don't say "Troves" explicitly.
trade
Swap tokens on Starknet via Fibrous DEX aggregator. Supports per-provider selection (avnu, ekubo, or auto to race all). Use this skill when the user wants to swap, exchange, trade, convert, buy, or sell one token for another on Starknet. Also use when the user asks about token prices, exchange rates, DEX routing, best swap route, or wants to check how much they would receive for a given amount — even if they don't explicitly say "swap".
staking
Stake, unstake, claim, and compound rewards for STRK, WBTC, tBTC, SolvBTC, and LBTC on Starknet. View validators, pools, and staking positions. Use this skill when the user mentions staking, delegating, validators, staking pools, rewards, compounding, unstaking, earning yield, passive income on crypto, or wants to earn on their STRK or BTC tokens — even if they don't say "stake" explicitly.
send
Send STRK, ETH, or any ERC-20 token to a Starknet address. Supports simulation (dry-run) before execution. Use this skill when the user wants to send, transfer, pay, tip, or move tokens to another wallet address on Starknet. Also trigger when the user mentions sending funds to someone, making a payment, transferring assets, or moving crypto to a specific address — even if they just say "pay 10 STRK to 0x...".
portfolio
View a comprehensive DeFi portfolio dashboard and optimize portfolio allocation via automated rebalancing. Use this skill when the user wants an overview, summary, dashboard, total value, net worth, portfolio rebalancing, target allocation, or wants to see all their DeFi positions across Starknet at once. Also trigger when the user asks "what do I have", "show me everything", "how much am I worth", "my positions", "my investments", "rebalance my portfolio", "I want 50% ETH", "optimize my holdings", or any request for a holistic view of their Starknet holdings — even if they don't explicitly say "portfolio".
multi-swap
Execute multiple token swaps in a single Starknet transaction via Fibrous (default). Supports per-provider selection (avnu, ekubo, or auto to race all). Supports 2-3 swap pairs bundled into one multicall. Use this skill when the user wants to swap multiple token pairs at once, do batch swaps, execute several trades simultaneously, perform parallel swaps, or do bulk trading in one transaction. Also trigger when the user mentions "two swaps", "three swaps", "swap X and Y at the same time", or wants to convert multiple tokens in a single call.