Skip to content
Development
Skill

/cetus-swap

Integrate Cetus AMM on Sui (swaps, liquidity, concentrated pools). Use when the user mentions Cetus.

From plugin
suiperpower
1360 skills1 MCP

Claude Code

$ npx -y skills add pivyme/suiperpower --skill cetus-swap --agent claude-code

SKILL.md

cetus-swap.SKILL.md
name: cetus-swap
description: Integrate Cetus AMM on Sui (swaps, liquidity, concentrated pools). Use when the user mentions Cetus.

Preamble (run first)

# Suiperpower telemetry. Routes through the CLI so projects.json + Convex stay in sync.
# Silent on failure so the skill never blocks. Opt out: SUIPERPOWER_TELEMETRY=off.
#
# AGENT NOTE: when this skill finishes, run the matching completion command:
#   suiperpower track cetus-swap build completed
# Or use "failed" / "aborted" if it ended that way.
command -v suiperpower >/dev/null 2>&1 && suiperpower track cetus-swap build started >/dev/null 2>&1 &
true

If `TEL_PROMPTED` is `no`, before doing real work, ask the user:

> Help suiperpower get better. We track which skills get used and how long they take. No code, no file paths, no PII. Change anytime in `~/.suiperpower/config.json`. > > A) Sure, anonymous > B) No thanks

Write the answer to `~/.suiperpower/config.json` `telemetryTier` field and create `~/.suiperpower/.telemetry-prompted`. Then continue.

What this skill does

Integrates Cetus CLMM into a project so the user can execute real token swaps and, optionally, manage concentrated liquidity positions on testnet or mainnet. Sets up the SDK, queries pools, builds swap transactions with slippage protection, and verifies a real swap settles on chain before declaring done.

When to use it

  • Building a DEX frontend, swap aggregator, or DeFi app that needs AMM liquidity on Sui.
  • The user wants to swap tokens through Cetus pools.
  • The user wants to provide concentrated liquidity (LP positions) on Cetus.
  • The user is targeting the DeFi & Payments track at Sui Overflow 2026.

When NOT to use it

  • For orderbook trading (limit orders, partial fills), use `deepbook-orderbook` instead.
  • For lending and borrowing, use `scallop-money-market` or `navi-lending`.
  • For research before building, use the idea-phase skill instead.
  • If the user has not scaffolded a project, use `scaffold-project` first.

If you activated this and the user actually wants something else, consult `skills/SKILL_ROUTER.md` and hand off.

Inputs

  • A Sui project (Move package and/or TS frontend).
  • Optional: `.suiperpower/build-context.md` from `scaffold-project`. Read it if present.
  • The token pair the user wants to swap or LP on (or "any liquid pair on testnet" for a demo).

If unclear, interview the user for:

  • What pair? (e.g. SUI/USDC, SUI/CETUS)
  • Swap only, liquidity provision only, or both?
  • Testnet or mainnet?
  • Frontend wallet-signed or backend keeper?

Outputs

  • Working Cetus swap code using the SDK V2 (`@cetusprotocol/sui-clmm-sdk`).
  • A verifiable testnet swap: one real swap executed, observable on suiscan with a recorded digest.
  • Optionally, position management code (open, add liquidity, close).
  • Append to `.suiperpower/build-context.md`:
  ## cetus-swap session, <timestamp>
  - pool id: <pool object id>
  - coin pair: <coinA> / <coinB>
  - fee tier: <rate>
  - first swap tx digest: <digest>
  - slippage: <value>
  - position id: <id, if LP>
  - open issues: <list>

The skill never deletes files outside the integration source path without explicit user confirmation.

Workflow

1. **Context gathering**

  • Read `.suiperpower/build-context.md` if it exists.
  • Confirm the token pair, direction (swap vs LP vs both), and target network.

2. **SDK setup**

  • Install the SDK V2 package and its peer dependency (V1 `@cetusprotocol/cetus-sui-clmm-sdk` is deprecated):
     npm install @cetusprotocol/sui-clmm-sdk @cetusprotocol/common-sdk
  • Initialize:
     import { CetusClmmSDK } from '@cetusprotocol/sui-clmm-sdk'
     const sdk = CetusClmmSDK.createSDK({ env: 'testnet' })
  • Optionally pass `full_rpc_url` for a custom RPC. Set the sender address after init via `sdk.setSenderAddress(wallet)`.

3. **Pool selection**

  • Query pools by coin types:
     const pools = await sdk.Pool.getPoolByCoins([coinTypeA, coinTypeB])
  • Read pool params: `fee_rate`, `tick_spacing`, `current_sqrt_price`, `liquidity`.
  • Coin type ordering rule: compare ASCII values of both coin type addresses. Higher ASCII = `coin_type_a`.
  • Document the chosen pool in `build-context.md`.

4. **Swap implementation**

  • **Pre-swap estimate**: `sdk.Swap.preSwap()` simulates on chain and returns `estimated_amount_in` / `estimated_amount_out`.
  • **Slippage**: `adjustForSlippage(toAmount, slippage, !byAmountIn)` computes the minimum acceptable output.
  • **Build payload**: `sdk.Swap.createSwapPayload()` with pool id, coin types, `a2b`, `by_amount_in`, `amount`, `amount_limit`.
  • **Execute**: `sdk.fullClient.sendTransaction(signer, swapPayload)`.
  • The `a2b` flag: `true` means coin_type_a to coin_type_b.
  • See `references/cetus-quickstart.md` for the full code flow.

5. **Liquidity provision (optional)**

  • Only if the user asks for LP. Do not add this by default.
  • Open a position: `sdk.Position.openPositionPayload()` or the price-based variant.
  • Add liquidity: `sdk.Position.createAddLiquidityFixTokenPayload()`.
  • Close position: `sdk.Position.closePositionPayload()` (must collect all pending rewards first).
  • See `references/cetus-quickstart.md` for add-liquidity code.

6. **Demo**

  • Execute a real testnet swap. Capture the transaction digest.
  • Verify on suiscan testnet: `https://suiscan.xyz/testnet/tx/<digest>`.
  • If doing LP, open a position and verify.

7. **Writeback**

  • Append session details to `.suiperpower/build-context.md`.

8. **Closing handoff**

  • If `.suiperpower/intent.md` exists and the session was non-trivial (new module, new sponsor integration, or material changes to public functions), recommend `verify-against-intent` as the next step so drift is caught before shipping.
  • If no `intent.md` exists and the session was non-trivial, surface that gap once: offer `clarify-intent` to backfill, do
Read more
@pivyme
Ships withsuiperpower

Build something meaningful, on Sui. A superpower for AI coding agents to ship real products on Sui. Your AI coding agent has never written Move before. Suiperpower fixes that.

1360 skills1 MCP
Get the whole plugin

Stars on GitHub

Momentum

stars in total
13
Star history of pivyme/suiperpower on GitHub, a chart by star-history.com

Other skills on suiperpower.

brand-design

brand-design

Pick a brand name, color palette, or typography for a Sui product. Use when the user wants to name or brand a Sui project.

@pivyme@pivymeInstall Skill
build-ai-agent

build-ai-agent

Build an AI agent that signs Sui transactions or runs onchain actions. Use when the user wants an AI agent on Sui.

@pivyme@pivymeInstall Skill
build-data-pipeline

build-data-pipeline

Build a Sui data indexer or analytics pipeline. Use when the user wants to index Sui events, build a pipeline, or query Sui RPC…

@pivyme@pivymeInstall Skill
build-mobile-sui

build-mobile-sui

Build a mobile Sui app with React Native or the Sui Mobile SDK. Use when the user wants iOS, Android, or mobile Sui flows.

@pivyme@pivymeInstall Skill
build-with-claude

build-with-claude

Pair with a coding agent to build a Sui MVP step by step. Use when the user wants to build the MVP iteratively with an agent.

@pivyme@pivymeInstall Skill
build-with-move

build-with-move

Author Sui Move modules and packages with a senior Move dev as your pair. Use when the user wants to write, build, author, add,…

@pivyme@pivymeInstall Skill

More skills from other plugins.

brainstorming
Auto-invoked

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…

@obra@obraInstall Skill
ask-matt

ask-matt

Ask which skill or flow fits your situation. A router over the skills in this repo.

skills13d309k
@mattpocock@mattpocockInstall Skill
accessibility
Auto-invoked

accessibility

Design, implement, and audit accessible UI to WCAG 2.2 Level AA across Web, iOS, and Android — semantic ARIA roles and labels,…

ecc2w293k
@affaan-m@affaan-mInstall Skill
compiler-commit

compiler-commit

Use when you want to verify compiler changes and commit with the correct convention. Runs tests, lint, and format, then commits…

react4d252k
@facebook@facebookInstall Skill

Questions about cetus-swap.

Which coding agents can use cetus-swap?
cetus-swap installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.