简介
专业Solana DEX交易技能,通过Jupiter聚合器实现安全代币兑换,含模拟交易、风控 guardrails 与完整JSON输出。
原始描述
Trade tokens on Solana using the ClawDex CLI. Use when the user asks to swap tokens, check balances, get quotes, or manage a Solana trading wallet.
通过你的 Agent 添加
安装目录:clawdex/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。
点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。
或者手动安装
包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可;
目录名不用换,也不要把包直接解压到 skills 根目录。
技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。
中文使用说明 来自收录源
核心用法
ClawDex 是一个面向 Solana 生态的链上交易 Skill,通过封装 ClawDex CLI 工具,为用户提供完整的代币兑换工作流。该 Skill 本身为纯 Markdown 文档型设计,无可执行代码,所有实际操作均通过调用外部 CLI 完成。
用户需先完成环境配置:安装 ClawDex CLI、设置 Jupiter API 密钥、配置 Solana RPC 端点及钱包路径。配置完成后,可执行五大核心操作:健康状态检查(status)、余额查询(balances)、实时报价获取(quote)、交易模拟(swap --simulate-only)以及真实交易执行(swap --yes)。
Skill 强制推行四步安全交易流程:健康检查 → 余额确认 → 模拟预览 → 正式执行,并支持自定义滑点上限、单笔交易限额、价格影响阈值等安全护栏,当触发限制时自动拦截并返回违规详情。
显著优点
安全机制完善:强制 --simulate-only 预演机制,真实交易需显式 --yes 确认,配合多级安全护栏(最大滑点 300bps、单笔限额 1 SOL、价格影响 100bps),有效防范误操作与异常行情风险。
输出标准化:所有命令均支持 --json 标志,返回结构化数据便于 Agent 解析,余额字段以字符串形式保留完整精度,避免浮点误差。
流程规范化:内置推荐交易工作流,从健康检查到执行后验证形成闭环,适合自动化交易场景。
基础设施可信:依赖 Solana 官方主网 RPC 与 Jupiter Exchange 聚合器,均为行业头部基础设施,API 通信采用 TLS 加密。
潜在缺点与局限性
外部工具依赖:Skill 本身无可执行代码,完全依赖用户手动安装的 ClawDex CLI,存在供应链攻击风险(当前使用 @latest 标签未固定版本)。
来源可信度有限:维护者为个人开发者(T3 级别),无公开 GitHub 仓库信息,CLI 工具闭源,社区难以进行代码审计。
资金风险敞口:直接操作真实资金,尽管有模拟机制,但滑点、MEV、网络拥堵等因素仍可能导致损失,且公共 RPC 存在隐私泄露风险。
版本与兼容性:依赖 npm 全局安装,不同 Node.js 版本可能存在兼容性问题,且 Skill 未提供版本锁定机制。
适合的目标群体
- Solana 生态交易者:需要程序化执行代币兑换、套利策略或定投操作的用户。
- DeFi 自动化开发者:构建交易机器人、资管工具或数据分析平台的开发者。
- 风险可控的量化用户:能接受小额资金测试、理解滑点与 Gas 机制的交易者。
不适合:加密货币新手、无法承受本金损失的用户、或不愿自行审查外部 CLI 来源的保守型用户。
使用风险
供应链风险:ClawDex CLI 通过 npm 分发,作者身份未经验证,存在恶意代码注入或后门可能。建议固定版本号、审查包哈希、在隔离环境测试。
资金安全风险:真实交易不可逆,配置错误(如错误 mint 地址、滑点设置过高)可能导致全额损失。务必使用专用钱包、启用硬件签名、避免主钱包直连。
网络与性能风险:公共 RPC 存在速率限制与延迟,可能影响交易时机;Solana 网络拥堵时交易可能失败或卡住,需实现重试与状态轮询机制。
合规与隐私风险:链上交易公开可查,大额操作可能暴露策略;部分地区对 DeFi 交易有监管限制,用户需自行评估合规性。
技能正文
name: clawdex description: Trade tokens on Solana using the ClawDex CLI. Use when the user asks to swap tokens, check balances, get quotes, or manage a Solana trading wallet. tools: Bash, Read metadata: tags: solana, trading, defi, jupiter, swap, crypto
ClawDex — Solana DEX Trading Skill
Trade any Solana token through Jupiter aggregator with simulation, safety guardrails, and full JSON output.
Prerequisites
Before using this skill, ensure ClawDex is installed and configured:
which clawdex || npm install -g clawdex@latest
If not configured yet, run onboarding:
clawdex status --json
If status fails, set up with:
clawdex onboarding \
--jupiter-api-key "$JUPITER_API_KEY" \
--rpc "${SOLANA_RPC_URL:-https://api.mainnet-beta.solana.com}" \
--wallet ~/.config/solana/id.json \
--json
Commands
Check wallet balances
clawdex balances --json
Returns an array of { token, symbol, mint, balance, decimals } objects. Zero-balance accounts are included in JSON output.
Get a quote (no execution)
clawdex quote --in SOL --out USDC --amount 0.01 --json
Lightweight price check — no simulation, no wallet needed.
Simulate a swap (dry run)
clawdex swap --in SOL --out USDC --amount 0.01 --simulate-only --json
Runs full simulation on-chain without broadcasting. Does not require --yes. Use this to preview the output amount and route before committing.
Execute a swap
clawdex swap --in SOL --out USDC --amount 0.01 --yes --json
--yes is required for non-interactive execution. Without it, ClawDex exits with code 1.
Health check
clawdex status --json
Verify RPC connectivity, wallet validity, and config state.
Trading Workflow
Always follow this sequence:
- Health check —
clawdex status --json— abort ifrpc.healthyis false - Check balances —
clawdex balances --json— verify sufficient funds - Simulate —
clawdex swap --simulate-only --json— preview the trade - Execute —
clawdex swap --yes --json— only if simulation looks good - Verify —
clawdex balances --json— confirm balances updated (may need 5s delay on public RPC)
Token Specification
Tokens can be passed by symbol or mint address:
- By symbol:
SOL,USDC,USDT - By mint:
EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
Exit Codes
| Code | Meaning | Agent action |
|---|---|---|
| 0 | Success | Continue |
| 1 | General error | Check message |
| 2 | Config error | Run onboarding |
| 3 | Safety violation | Reduce amount or adjust limits |
| 4 | Simulation failed | Try different pair/amount |
| 5 | Send failed | Retry with backoff |
Safety
Set guardrails to prevent runaway trades:
clawdex safety set max_slippage_bps=300 max_trade_sol=1 max_price_impact_bps=100
When a guardrail triggers, the JSON response includes a violations array describing what failed.
Important Rules
- Always use
--jsonfor machine-parseable output - Always use
--yesfor real swaps (not needed for--simulate-only) - Never skip simulation unless you have a good reason — use
--simulate-onlyfirst - Parse
balanceas a string, not a number — it preserves full decimal precision - Check exit codes — non-zero means the trade did not succeed
- Wait before verifying — RPC balance reads can lag a few seconds after a swap
正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。