gate-dex-trade

Gate DEX trading comprehensive skill. Supports MCP and OpenAPI dual modes: MCP mode calls through gate-wallet service (requires authentication), OpenAPI mode calls directly through AK/SK. Use when users mention swap, exchange, buy, sell, quote, trade. Automatically select the most suitable calling method based on environment.

23 stars

Best use case

gate-dex-trade is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Gate DEX trading comprehensive skill. Supports MCP and OpenAPI dual modes: MCP mode calls through gate-wallet service (requires authentication), OpenAPI mode calls directly through AK/SK. Use when users mention swap, exchange, buy, sell, quote, trade. Automatically select the most suitable calling method based on environment.

Teams using gate-dex-trade 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

$curl -o ~/.claude/skills/gate-dex-trade/SKILL.md --create-dirs "https://raw.githubusercontent.com/jiayaoqijia/cryptoskill/main/skills/exchanges/gate-dex-trade/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/gate-dex-trade/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How gate-dex-trade Compares

Feature / Agentgate-dex-tradeStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Gate DEX trading comprehensive skill. Supports MCP and OpenAPI dual modes: MCP mode calls through gate-wallet service (requires authentication), OpenAPI mode calls directly through AK/SK. Use when users mention swap, exchange, buy, sell, quote, trade. Automatically select the most suitable calling method based on environment.

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

# Gate DEX Trade

> **Trading Comprehensive Skill** — MCP + OpenAPI dual mode support, intelligent routing selects optimal trading method

**Trigger Scenarios**: Use when users mention "swap", "exchange", "buy", "sell", "trade", "quote" and other related operations.

---

## 🎯 Dual Mode Architecture

| Mode | Connection Method | Advantages | Use Cases |
|------|------------------|-----------|-----------|
| 🔗 **MCP Mode** | gate-wallet MCP Server | Unified authentication, wallet ecosystem integration | Complete trading process, cross-Skill collaboration |
| ⚡ **OpenAPI Mode** | AK/SK direct calls | Independent execution, complete lifecycle | Fast trading, full chain control |

---

## 📋 Smart Routing Rules

System automatically selects calling mode based on following priorities:

| Priority | Condition | Selected Mode | Routing Target |
|----------|-----------|---------------|----------------|
| **1** | Explicitly mentions "OpenAPI", "AK/SK" | ⚡ OpenAPI | `references/openapi.md` |
| **2** | Exists `~/.gate-dex-openapi/config.json` | ⚡ OpenAPI | `references/openapi.md` |
| **3** | From wallet Skills cross-Skill calls | 🔗 MCP | Current SKILL.md main process |
| **4** | Default scenario | 🔗 MCP | Current SKILL.md main process |

**User Preferences**:
- Pursue complete ecosystem integration → MCP mode
- Pursue independent fast execution → OpenAPI mode

---

## MCP Server Connection Detection

### First Session Detection

**Before first MCP tool call in session, perform one connection probe to confirm Gate Wallet MCP Server availability. No need to repeat detection for subsequent operations.**

```
CallMcpTool(server="gate-wallet", toolName="chain.config", arguments={chain: "eth"})
```

| Result | Handling |
|--------|----------|
| Success | MCP Server available, subsequent operations directly call business tools, no need to probe again |
| Failure | Display configuration guidance based on error type (see error handling below) |

### Runtime Error Fallback

If business tool calls fail during subsequent operations (returning connection errors, timeouts etc.), handle according to following rules:

| Error Type | Keywords | Handling |
|------------|----------|----------|
| MCP Server not configured | `server not found`, `unknown server` | Display MCP Server configuration guidance |
| Remote service unreachable | `connection refused`, `timeout`, `DNS error` | Prompt to check server status and network connection |
| Authentication failed | `401`, `unauthorized`, `x-api-key` | Prompt to contact administrator for API Key |

---

## Authentication Description

All operations in MCP mode **require `mcp_token`**. Must confirm user is logged in before calling any tool.

- If currently no `mcp_token` → Guide to `gate-dex-wallet/references/auth` to complete login then return
- If `mcp_token` expired (MCP Server returns token expired error) → First try `auth.refresh_token` silent refresh, guide re-login if failed

---

## MCP Tool Call Specification (Main Process)

### 1. `tx.quote` — Get Swap Quote

Get Swap quote from input token to output token.

| Field | Description |
|-------|-------------|
| **Tool Name** | `tx.quote` |
| **Parameters** | `{ chain_id_in: string, chain_id_out: string, token_in: string, token_out: string, amount: string, slippage?: number, user_wallet: string, native_in?: boolean, native_out?: boolean, mcp_token: string }` |
| **Return** | Quote details including exchange rate, slippage, routing path, estimated Gas etc |

### 2. `tx.swap` — Execute Swap

One-shot Swap execution (Quote→Build→Sign→Submit single call).

| Field | Description |
|-------|-------------|
| **Tool Name** | `tx.swap` |
| **Parameters** | Same as `tx.quote` + `account_id` |
| **Return** | Transaction result |

### 3. `tx.swap_detail` — Query Swap Status

(Other MCP tool specifications...)

---

## Sub-module Routing

Route to specific implementation based on mode detection result and user intent:

| Routing Condition | Target | Description |
|-------------------|---------|-------------|
| OpenAPI environment + related intent | references/openapi.md | Complete OpenAPI call specification |
| MCP environment + trading intent | Current SKILL.md main process | MCP tool calls and three-step confirmation process |

---

## Operation Process

### Process A: Smart Mode Selection

```text
First session detection (if needed)
  ↓
Environment detection:
  1. Check ~/.gate-dex-openapi/config.json
  2. Check gate-wallet MCP Server
  ↓
Select calling mode based on detection result:
  → OpenAPI mode: references/openapi.md
  → MCP mode: Current main process
```

### Process B: MCP Swap Execution (Main Process)

```text
Authentication check → Balance verification → Trading pair confirmation 
  → tx.quote → Quote display → Signature authorization confirmation 
    → tx.swap → tx.swap_detail
```

---

## Cross-Skill Collaboration

| Caller | Scenario | Tool Used |
|--------|----------|-----------|
| `gate-dex-wallet` | User views balance then wants to exchange tokens | MCP mode call |
| `gate-dex-market` | User views market then wants to buy certain token | MCP mode call |

---

## Supported Chains

| Chain ID | Network Name | MCP Support | OpenAPI Support |
|----------|--------------|-------------|-----------------|
| `eth` / `1` | Ethereum | ✅ | ✅ |
| `bsc` / `56` | BNB Smart Chain | ✅ | ✅ |
| `polygon` / `137` | Polygon | ✅ | ✅ |
| `arbitrum` / `42161` | Arbitrum One | ✅ | ✅ |
| `optimism` / `10` | Optimism | ✅ | ✅ |
| `avax` / `43114` | Avalanche | ✅ | ✅ |
| `base` / `8453` | Base | ✅ | ✅ |
| `sol` / `501` | Solana | ✅ | ✅ |

---

## Security Rules

1. **Mode selection transparency**: Clearly inform users of current calling mode and reason
2. **Authentication isolation**: MCP mode uses `mcp_token`, OpenAPI mode uses AK/SK
3. **Three-step confirmation gating**: MCP mode includes trading pair confirmation → quote display → signature authorization confirmation
4. **Balance verification**: Mandatory check asset sufficiency before trading
5. **Risk alerts**: Mandatory warning when price difference > 5%, high slippage MEV risk alerts

Related Skills

okx-onchain-gateway

23
from jiayaoqijia/cryptoskill

This skill should be used when the user asks to 'broadcast transaction', 'send tx', 'estimate gas', 'simulate transaction', 'check tx status', 'track my transaction', 'get gas price', 'gas limit', 'broadcast signed tx', or mentions broadcasting transactions, sending transactions on-chain, gas estimation, transaction simulation, tracking broadcast orders, or checking transaction status. Covers gas price, gas limit estimation, transaction simulation, transaction broadcasting, and order tracking across XLayer, Solana, Ethereum, Base, BSC, Arbitrum, Polygon, and 20+ other chains. Do NOT use for swap quote or execution - use okx-dex-swap instead. Do NOT use for general programming questions about transaction handling.

okx-cex-trade

23
from jiayaoqijia/cryptoskill

This skill should be used when the user asks to 'buy BTC', 'sell ETH', 'place a limit order', 'place a market order', 'cancel my order', 'amend my order', 'long BTC perp', 'short ETH swap', 'open a position', 'close a position', 'set take profit', 'set stop loss', 'add a trailing stop', 'set leverage', 'check my orders', 'order status', 'fill history', 'trade history', 'buy a call', 'sell a put', 'buy call option', 'sell put option', 'option chain', 'implied volatility', 'IV', 'option Greeks', 'delta', 'gamma', 'theta', 'vega', 'delta hedge', 'option order', 'option position', 'option fills', or any request to place/cancel/amend spot, perpetual swap, delivery futures, or options orders on OKX CEX. Covers spot trading, swap/perpetual contracts, delivery futures, options (calls/puts, Greeks, IV), and conditional (TP/SL/trailing) algo orders. Requires API credentials. Do NOT use for market data (use okx-cex-market), account balance/positions (use okx-cex-portfolio), or grid/DCA bots (use okx-cex-bot).

kucoin-trader

23
from jiayaoqijia/cryptoskill

Professional KuCoin (KC) trading system - multi-account support, spot/margin/futures trading, asset transfers. Use to check balances, transfer assets, open/close positions, and manage your KuCoin portfolio.

gate-info-trendanalysis

23
from jiayaoqijia/cryptoskill

Trend and technical analysis. Use this skill whenever the user asks for technical or trend analysis of one coin. Trigger phrases include: technical analysis, K-line, RSI, MACD, trend, support, resistance. MCP tools: info_markettrend_get_kline, info_markettrend_get_indicator_history, info_markettrend_get_technical_analysis, info_marketsnapshot_get_market_snapshot.

gate-exchange-trading-copilot

23
from jiayaoqijia/cryptoskill

End-to-end cryptocurrency trading copilot for Gate Exchange. Use this skill whenever the user wants one skill to complete market judgment, risk control, and execution for a cryptocurrency trade on Gate Exchange. Trigger phrases include "analyze before placing an order", "analyze before buying", "check risk before trading", or any request involving cryptocurrency trade judgment, order drafting, spot or futures execution, or post-trade management on Gate Exchange.

gate-exchange-staking

23
from jiayaoqijia/cryptoskill

The on-chain staking query function of Gate Exchange. Use this skill to query staking positions, rewards, products, or order history. Trigger phrases include: staking, stake, earn, staking rewards, staking positions, earning records, staking history, available coins.

gate-info-riskcheck

23
from jiayaoqijia/cryptoskill

Token and address risk assessment. Use this skill whenever the user asks about token, contract, or address safety. Trigger phrases include: is this token safe, check contract risk, is this address safe, honeypot, rug. MCP tools: info_compliance_check_token_security, info_coin_get_coin_info; Address mode: info_onchain_get_address_info.

gate-news-briefing

23
from jiayaoqijia/cryptoskill

News briefing. Use this skill whenever the user asks for recent news or headlines. Trigger phrases include: what happened recently, today's highlights, crypto news, any new updates. MCP tools: news_events_get_latest_events, news_feed_search_news, news_feed_get_social_sentiment.

gate-mcp-skill

23
from jiayaoqijia/cryptoskill

Use Gate MCP through UXC for public spot and futures market data workflows with a fixed streamable-http endpoint and read-first guardrails.

gate-mcp-openclaw-installer

23
from jiayaoqijia/cryptoskill

One-click installer for all Gate.com MCP servers including spot/futures trading, DEX, market info, and news. Use when users need to install, configure, or manage Gate MCP servers with mcporter.

gate-info-marketoverview

23
from jiayaoqijia/cryptoskill

Market overview. Use this skill whenever the user asks about overall market. Trigger phrases include: how is the market, market overview, what is happening in crypto. MCP tools: info_marketsnapshot_get_market_overview, info_coin_get_coin_rankings, info_platformmetrics_get_defi_overview, news_events_get_latest_events, info_macro_get_macro_summary.

gate-exchange-marketanalysis

23
from jiayaoqijia/cryptoskill

The market analysis function of Gate Exchange, such as liquidity, momentum, liquidation, funding arbitrage, basis, manipulation risk, order book explainer, slippage simulation. Use when the user asks about liquidity, depth, slippage, buy/sell pressure, liquidation, funding rate arbitrage, basis/premium, manipulation risk, order book explanation, or slippage simulation (e.g. market buy $X slippage). Trigger phrases: liquidity, depth, slippage, momentum, buy/sell pressure, liquidation, squeeze, funding rate, arbitrage, basis, premium, manipulation, order book, spread, slippage simulation.