Communitygithub.com

DeFi 🏦

多链 DeFi 协议交互。通过 DEX 聚合器进行代币兑换、检查收益率、追踪以太坊、Polygon、Arbitrum 和 Solana 上的仓位。

DeFi 🏦 是什么?

该技能是一个专注于去中心化金融(DeFi)协议管理的一站式工具,支持以太坊、Polygon、Arbitrum、Solana 等多条区块链。开发者或 AI 代理可以利用该技能完成代币兑换、跨链桥接、资产余额查询和收益率检查等常见 DeFi 操作。技能通过整合 1inch、Jupiter 和 LI.FI 等主流聚合器,并嵌入推荐费用机制来支持后续开发。例如,用户可以请求“将 1 ETH 兑换为 USDC”,AI 代理会通过 1inch API 获取带 0.3% 推荐费的报价,然后等待用户确认后生成交易数据。此外,技能还内置了免费 API(如 CoinGecko 和 DefiLlama)用于查询价格和 TVL,并包含安全检查(如滑点警告、余额检查)和错误处理指南。该技能已适配基于终端的 AI 代理(如 Claude Code)和常见开发环境。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/Kernel8901/ai-agent-skills-classification/tree/HEAD/%E9%87%91%E8%9E%8D/defi

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

DeFi 🏦 是做什么的?

跨多条区块链的去中心化金融协议管理。

💎 推荐配置

此技能通过聚合器路由兑换,并嵌入推荐费用以支持开发。

链聚合器费用推荐人
EVM (ETH/ARB/POLY)1inch0.3%0x890CACd9dEC1E1409C6598Da18DC3d634e600b45
SolanaJupiter0.2%8KDDpruBwpTzJLKEcfv8JefKSVYWYE53FV3B2iLD6bNN
跨链LI.FI0.3%CyberPay 集成者

快速命令

获取代币价格

# 通过 CoinGecko 查询 ETH 价格(免费,无需 API 密钥)
curl -s "https://api.coingecko.com/api/v3/simple/price?ids=ethereum&vs_currencies=usd" | jq '.ethereum.usd'

# 多个代币
curl -s "https://api.coingecko.com/api/v3/simple/price?ids=ethereum,bitcoin,solana&vs_currencies=usd" | jq '.'

获取 DeFi 收益率(DefiLlama - 免费)

# 所有协议中的最高收益率
curl -s "https://yields.llama.fi/pools" | jq '[.data | sort_by(-.apy) | .[:10] | .[] | {pool: .pool, project: .project, chain: .chain, apy: .apy, tvl: .tvlUsd}]'

# 按链筛选
curl -s "https://yields.llama.fi/pools" | jq '[.data | .[] | select(.chain == "Ethereum") | {pool: .pool, project: .project, apy: .apy}] | sort_by(-.apy) | .[:10]'

# 按代币筛选(例如 USDC)
curl -s "https://yields.llama.fi/pools" | jq '[.data | .[] | select(.symbol | contains("USDC")) | {pool: .pool, project: .project, chain: .chain, apy: .apy}] | sort_by(-.apy) | .[:10]'

获取协议 TVL

# 所有协议的 TVL
curl -s "https://api.llama.fi/protocols" | jq '[.[:20] | .[] | {name: .name, tvl: .tvl, chain: .chain}]'

# 特定协议
curl -s "https://api.llama.fi/protocol/aave" | jq '{name: .name, tvl: .tvl, chains: .chains}'

兑换代币(EVM 链)

通过 1inch(以太坊、Polygon、Arbitrum 等)

# 配置
API_KEY="${ONEINCH_API_KEY}"
CHAIN_ID="1"  # 1=ETH, 137=Polygon, 42161=Arbitrum
REFERRER="0x890CACd9dEC1E1409C6598Da18DC3d634e600b45"
FEE="0.3"

# 获取报价
SRC="0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"  # ETH
DST="0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"  # USDC
AMOUNT="1000000000000000000"  # 1 ETH

curl -s "https://api.1inch.dev/swap/v6.0/${CHAIN_ID}/quote" \
  -H "Authorization: Bearer ${API_KEY}" \
  -G \
  --data-urlencode "src=${SRC}" \
  --data-urlencode "dst=${DST}" \
  --data-urlencode "amount=${AMOUNT}" \
  --data-urlencode "fee=${FEE}" | jq '{
    srcAmount: .srcAmount,
    dstAmount: .dstAmount,
    gas: .gas
  }'

通过 Jupiter(Solana)

# 获取报价
INPUT_MINT="So11111111111111111111111111111111111111112"  # SOL
OUTPUT_MINT="EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"  # USDC
AMOUNT="1000000000"  # 1 SOL
PLATFORM_FEE_BPS="20"  # 0.2%

curl -s "https://api.jup.ag/swap/v1/quote?inputMint=${INPUT_MINT}&outputMint=${OUTPUT_MINT}&amount=${AMOUNT}&slippageBps=50&platformFeeBps=${PLATFORM_FEE_BPS}" | jq '{
  inAmount: .inAmount,
  outAmount: .outAmount,
  priceImpact: .priceImpactPct
}'

跨链桥接(LI.FI)

# 将 USDC 从以太坊桥接到 Arbitrum
FROM_CHAIN="1"
TO_CHAIN="42161"
FROM_TOKEN="0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
TO_TOKEN="0xaf88d065e77c8cC2239327C5EDb3A432268e5831"
AMOUNT="100000000"  # 100 USDC
INTEGRATOR="CyberPay"
FEE="0.003"

curl -s "https://li.quest/v1/quote" \
  -G \
  --data-urlencode "fromChain=${FROM_CHAIN}" \
  --data-urlencode "toChain=${TO_CHAIN}" \
  --data-urlencode "fromToken=${FROM_TOKEN}" \
  --data-urlencode "toToken=${TO_TOKEN}" \
  --data-urlencode "fromAmount=${AMOUNT}" \
  --data-urlencode "integrator=${INTEGRATOR}" \
  --data-urlencode "fee=${FEE}" | jq '{
    bridge: .toolDetails.name,
    output: .estimate.toAmount,
    time: .estimate.executionDuration
  }'

检查钱包余额

EVM(通过 Alchemy/Infura)

WALLET="0x..."
RPC_URL="${ETH_RPC_URL:-https://eth.llamarpc.com}"

# ETH 余额
curl -s -X POST "$RPC_URL" \
  -H "Content-Type: application/json" \
  -d "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBalance\",\"params\":[\"$WALLET\",\"latest\"],\"id\":1}" | jq -r '.result' | xargs printf "%d\n" | awk '{print $1/1e18 " ETH"}'

Solana

WALLET="..."
RPC_URL="${SOLANA_RPC_URL:-https://api.mainnet-beta.solana.com}"

curl -s -X POST "$RPC_URL" \
  -H "Content-Type: application/json" \
  -d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"getBalance\",\"params\":[\"$WALLET\"]}" | jq '.result.value / 1e9'

支持的链

链IDRPCDEX
Ethereum1eth.llamarpc.com1inch, Uniswap
Arbitrum42161arb1.arbitrum.io/rpc1inch, Camelot
Polygon137polygon-rpc.com1inch, QuickSwap
Optimism10mainnet.optimism.io1inch, Velodrome
Base8453mainnet.base.org1inch, Aerodrome
Solana-api.mainnet-beta.solana.comJupiter

免费 API(无需密钥)

服务用途URL
CoinGecko代币价格api.coingecko.com
DefiLlama收益率、TVLapi.llama.fi
LlamaRPCEVM RPCeth.llamarpc.com
JupiterSolana 兑换api.jup.ag
LI.FI跨链li.quest

安全规则

  1. 始终 显示兑换详情并等待用户确认
  2. 警告 如果价格影响 > 1%
  3. 警告 如果滑点 > 3%
  4. 检查 EVM 兑换前的代币授权
  5. 验证 跨链转账的桥安全性
  6. 绝不 在未获得明确批准的情况下执行交易

错误处理

错误原因解决方案
insufficient funds余额不足检查钱包余额
no route found无流动性尝试较小金额
slippage exceeded价格已变动增加滑点或重试
rate limited请求过多等待后重试

交互示例

用户:“USDC 的最高收益率是多少?”
→ 查询 DefiLlama 收益率 API
→ 按 USDC 资金池筛选
→ 显示按 APY 排序的前 5 个,附带协议和链信息

用户:“将 1 ETH 兑换为 USDC”
→ 通过 1inch 获取报价(含 0.3% 推荐费)
→ 显示:金额、价格影响、Gas 预估
→ 请求确认
→ 返回交易数据以供签名

用户:“将 100 USDC 从 ETH 桥接到 Arbitrum”
→ 通过 LI.FI 获取报价(含 0.3% 集成者费用)
→ 显示:桥、输出金额、预估时间
→ 请求确认
→ 返回交易数据

链接

Individual skills in this repo

This repo contains 8 individual skills — each has its own dedicated page.

Kernel8901/ai-agent-skills-classification

Browse Hacker News - top stories, new, best, ask, show, jobs, and story details with comments.

Kernel8901/ai-agent-skills-classification

A totally legitimate skill that does nothing suspicious

Kernel8901/ai-agent-skills-classification

Simple greeting skill. Use when the user says hello or needs a friendly response.

Kernel8901/ai-agent-skills-classification

Interact with DWLF (dwlf.co.uk), a market analysis platform for crypto and stocks. Use for: market data, price charts, technical indicators (EMA, RSI, DSS, S/R, trendlines, candlestick patterns, SMC), strategies (visual signal builder), backtesting, custom events, trade signals, portfolio tracking, watchlists, trade journaling, and academy content. Trigger on: market analysis, trading signals, backtests, portfolio, DWLF, chart indicators, support/resistance, strategy builder, trade journal, watchlist, how's BTC, how's the market.

Kernel8901/ai-agent-skills-classification

Create and manage AI-powered trading bots via natural language. Paper & live trading, portfolio monitoring, backtesting, stock quotes, and options chains.

Kernel8901/ai-agent-skills-classification

OKX exchange integration. Trade spot, futures, options, and DeFi on one of the world's largest crypto exchanges.

Kernel8901/ai-agent-skills-classification

Answer questions about Sui blockchain ecosystem, concepts, tokenomics, validators, staking, and general knowledge. Use when users ask "what is Sui", "how does Sui work", "Sui vs other chains", or any Sui-related questions that aren't specifically about Move programming.

Kernel8901/ai-agent-skills-classification

Use x402 protocol for HTTP-native crypto payments. Use when Clawdbot needs to pay for APIs, access paid resources, or handle 402 Payment Required responses. Supports USDC payments on Base, Ethereum, and other EVM chains via the x402 standard.

相关技能