$npx -y skills add gate/gate-skills --skill gate-exchange-assetswapUse this skill whenever the user wants Gate Exchange asset allocation optimization for spot holdings (list eligible assets, load config, evaluate/preview, place orders, query history). Trigger phrases include \"asset allocation optimization\", \"allocation configuration\", \"port
| 1 | ### Resolving `gate-cli` (binary path) |
| 2 | |
| 3 | Resolve **`gate-cli`** in order: **(1)** **`command -v gate-cli`** and **`gate-cli --version`** succeeds; **(2)** **`${HOME}/.local/bin/gate-cli`** if executable; **(3)** **`${HOME}/.openclaw/skills/bin/gate-cli`** if executable. Canonical rules: [`exchange-runtime-rules.md`](https://github.com/gate/gate-skills/blob/master/skills/exchange-runtime-rules.md) §4 (or [`gate-runtime-rules.md`](https://github.com/gate/gate-skills/blob/master/skills/gate-runtime-rules.md) §4). |
| 4 | |
| 5 | |
| 6 | # Gate Exchange Asset Allocation Optimization |
| 7 | |
| 8 | ## General Rules |
| 9 | |
| 10 | ⚠️ STOP — You MUST read and strictly follow the shared runtime rules before proceeding. |
| 11 | Do NOT select or call any tool until all rules are read. These rules have the highest priority. |
| 12 | → Read [gate-runtime-rules.md](https://github.com/gate/gate-skills/blob/master/skills/gate-runtime-rules.md) |
| 13 | - **Only use the `gate-cli` commands explicitly listed in this skill.** Commands not documented here must NOT be run for these workflows, even if other interfaces expose them. |
| 14 | |
| 15 | ## Skill Dependencies |
| 16 | |
| 17 | |
| 18 | ### gate-cli commands used |
| 19 | |
| 20 | **Query operations (read-only, profile scope)** |
| 21 | |
| 22 | - `gate-cli cex assetswap assets` |
| 23 | - `gate-cli cex assetswap config` |
| 24 | - `gate-cli cex assetswap evaluate` |
| 25 | - `gate-cli cex assetswap order list` |
| 26 | - `gate-cli cex assetswap order get` |
| 27 | |
| 28 | **Execution operations (write, trade scope)** |
| 29 | |
| 30 | - `gate-cli cex assetswap order preview` |
| 31 | - `gate-cli cex assetswap order create` |
| 32 | |
| 33 | ### Authentication |
| 34 | |
| 35 | - **Interactive file setup:** when **`GATE_API_KEY`** and **`GATE_API_SECRET`** are **not** both set on the host, run **`gate-cli config init`** to complete the wizard for API key, secret, profiles, and defaults (see [gate-cli](https://github.com/gate/gate-cli)). |
| 36 | - **Env / flags:** **`gate-cli config init`** is **not** required when credentials are already supplied — e.g. **both** **`GATE_API_KEY`** and **`GATE_API_SECRET`** set on the host, or **`--api-key`** / **`--api-secret`** where supported — never ask the user to paste secrets into chat. |
| 37 | - API Key required: Yes |
| 38 | - **Permissions:** Profile (read) for listing, config, evaluation, and order queries; Trade for preview and order creation |
| 39 | - **Portal:** create or rotate keys outside the chat: https://www.gate.com/myaccount/profile/api-key/manage |
| 40 | |
| 41 | ### Installation Check |
| 42 | |
| 43 | - **Required:** Gate (main) MCP with asset allocation optimization tools enabled (MCP names `cex_assetswap_*`); prefer **`gate-cli cex assetswap …`** when running from the host CLI. |
| 44 | - **Install (MCP / IDE):** `gate-mcp-cursor-installer`, `gate-mcp-codex-installer`, `gate-mcp-claude-installer`, or `gate-mcp-openclaw-installer`. |
| 45 | - **Credentials:** When **`GATE_API_KEY`** and **`GATE_API_SECRET`** are both set (non-empty) for the host, **do not** require **`gate-cli config init`**. When **both** are unset or empty, **remind** the operator to run **`gate-cli config init`** **or** to configure **`GATE_API_KEY`** / **`GATE_API_SECRET`** in the **matching skill** from the skill library (never ask the user to paste secrets into chat). |
| 46 | - **Sanity check:** Before preview or order creation, confir |