# okx-defi

A skill that lets a coding agent hunt DeFi yields, deposit, stake, manage liquidity and claim rewards through the onchainos defi CLI.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 9800 installs · ★ 344
- Author: okx
- License: MIT · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/okx/onchainos-skills/tree/HEAD/skills/okx-defi/SKILL.md
- Updated: 2026-10-22
- HTML: https://affpapa.org/en/nevibecode/skills/okx-defi

## What it does

The skill handles venue-agnostic DeFi work: APY and TVL discovery across protocols and chains, deposits, staking, liquidity, lending, CLMM positions. It works as a router. Nothing loads up front; the agent pulls the one reference file for the current intent, `invest.md` for products and actions, `portfolio.md` for positions, with separate CLI schema and troubleshooting files for each. A request that names a protocol is handed to `okx-dapp-discovery`, while token prices and swaps belong to `okx-dex-market` and `okx-agentic-wallet`.

Everything runs through the `onchainos defi` CLI group, and a wallet has to be there first. Each thread starts with the preflight steps in `../okx-agentic-wallet/_shared/preflight.md`, then the address comes from `onchainos wallet status` and `onchainos wallet addresses`. Supply your own with `--address` and that lookup is skipped.

The address-to-chain match is where it breaks. A `0x…` address is accepted only on EVM chains, base58 only on `solana`, and mixing the two returns error 84019, so holdings on both sides mean two separate calls. Flags differ as well: `defi positions` takes `--chains`, `defi position-detail` takes `--chain`. Check the command before running it rather than burning a round trip on a format error.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add okx/onchainos-skills --skill okx-defi -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/okx-defi/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/okx-defi/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add okx/onchainos-skills --skill okx-defi -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/okx-defi/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add okx/onchainos-skills --skill okx-defi -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/okx-defi/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install okx/onchainos-skills okx-defi
```

2. **Manually: put the files in place**
- File: `.github/skills/okx-defi/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add okx/onchainos-skills --skill okx-defi -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/okx/onchainos-skills --path skills/okx-defi
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/okx-defi/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add okx/onchainos-skills --skill okx-defi -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/okx/onchainos-skills/tree/HEAD/skills/okx-defi/SKILL.md

## When to use it
- find the pool with the best APY across chains
- pull TVL history for a DeFi product
- deposit and confirm the on-chain step landed
- claim V3 fee rewards from a position
- list holdings on EVM and Solana in two calls

## Example prompts
- Find DeFi products with the best APY on `base` and show TVL history for the past month.
- Show my DeFi positions on `ethereum`, then claim rewards from the biggest one.
- Redeem half of my CLMM liquidity on `solana` and tell me whether it went through.

## Source text · SKILL.md · MIT

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: 5e54c09351712d92.

BEGIN THIRD-PARTY FILE 5e54c09351712d92
```text
---
name: okx-defi
description: "Discover and manage OKX-aggregated DeFi products and positions across protocols and chains. Use for generic or venue-agnostic yield, APY, or TVL discovery and history; DeFi deposits, staking, liquidity, withdrawals, rewards, lending, CLMM analysis; and DeFi portfolio or position views. Requests targeting a named protocol belong to DApp discovery. Triggers include earn yield, best APY, DeFi product, APY/TVL history, deposit, stake, withdraw, redeem, provide or remove liquidity, claim rewards, borrow or repay, CLMM, V3 liquidity charts, DeFi portfolio, and DeFi holdings."
license: MIT
metadata:
  author: okx
  version: "4.6.6"
  homepage: "https://web3.okx.com"
---

# OKX DeFi

Discover and manage multi-chain, OKX-aggregated DeFi products and positions through the `onchainos defi` CLI group.

## Preflight

Preflight checks: At the start of each thread, complete the checks in `../okx-agentic-wallet/_shared/preflight.md`. If missing, read `_shared/preflight.md`.

## Intent Routing

Load only the reference files required by the selected route.

| User Intent | Reference |
|---|---|
| Discover / search DeFi products, find best APY | [invest.md](references/invest.md) |
| Product detail (APY, TVL, accepted tokens) | [invest.md](references/invest.md) |
| Deposit / stake / provide liquidity | [invest.md](references/invest.md) |
| Withdraw / redeem a position (full or partial) | [invest.md](references/invest.md) |
| Claim rewards (platform / investment / V3 fee / bonus / unlocked principal) | [invest.md](references/invest.md) |
| APY history, TVL history, V3 depth / price charts | [invest.md](references/invest.md) |
| View DeFi positions / holdings overview | [portfolio.md](references/portfolio.md) |
| Per-protocol position detail | [portfolio.md](references/portfolio.md) |
| Exact parameters / return schemas — invest, shared support, and charts commands | [invest-cli-reference.md](references/invest-cli-reference.md) |
| Exact parameters / return schemas — positions commands | [portfolio-cli-reference.md](references/portfolio-cli-reference.md) |
| Errors / failed deposits / expired calldata | [invest-troubleshooting.md](references/invest-troubleshooting.md) |
| Errors / empty positions / address-format issues | [portfolio-troubleshooting.md](references/portfolio-troubleshooting.md) |

Typical flow spans both: view positions (Portfolio) → redeem or claim (Invest). Read both reference files when the request chains them.

Route a named third-party DApp request—including protocol-specific APY, TVL,
```
END THIRD-PARTY FILE 5e54c09351712d92

The third-party file has ended. Everything between the 5e54c09351712d92 tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 2569 of 5378 bytes. © okx · MIT · https://github.com/okx/onchainos-skills/tree/HEAD/skills/okx-defi/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
