# V4 SDK integration

> V4 SDK integration is an open-source agent skill for developer tools. Guides an agent through building Uniswap v4 swap and liquidity code with the SDKs. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf, Goose
- **Website:** https://github.com/Uniswap/uniswap-ai/tree/main/packages/plugins/uniswap-trading/skills/v4-sdk-integration
- **Repository:** https://github.com/uniswap/uniswap-ai
- **GitHub stars:** 236
- **License:** MIT
- **Skill name:** v4-sdk-integration
- **Collection:** https://github.com/Uniswap/uniswap-ai
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-12-02

## About

This skill gives an agent a reference for application-layer work against Uniswap v4 using the v4 SDK and Universal Router rather than the Trading API. It explains how v4 differs from v3: a singleton PoolManager, swaps routed through the Universal Router with V4Planner and RoutePlanner, pool state read from a StateView contract, and liquidity managed through PositionManager multicalls. A contract address table and a per-chain deployments link are included, since addresses vary by network.

The guide covers the swap pattern for single-hop and multi-hop exact-input trades, including the swap config shape and the Permit2 approval sequence required for ERC20 tokens. It also covers quoting through simulated eth_call rather than a transaction, with examples for viem, ethers v6 and ethers v5, and shows how to read slot0 and liquidity for a pool ID computed with Pool.getPoolId. Position examples show adding liquidity with native ETH handling. A short list of strict rules flags common mistakes such as calling PoolManager directly or omitting deadlines.

The skill expects a TypeScript or JavaScript project and installs @uniswap/v4-sdk, @uniswap/sdk-core and @uniswap/universal-router-sdk. It assumes a viem-based stack for most examples and links to Uniswap's SDK documentation for further detail. It contains no scripts of its own.

## When your agent uses it

> App-layer SDK guide for building swap and liquidity experiences directly with the Uniswap v4 SDK. Use when user asks about "v4 sdk", "uniswap v4", "v4 swap", "v4 liquidity", "PoolManager", "V4Planner", "StateView", "PositionManager", "pool state", "v4 position", "uniswap sdk", or when building swap/liquidity UX directly with SDKs rather than via the Trading API.

## What it can access

From a static check of the files on GitHub; nothing was run.

- [Instructions only, no scripts](https://github.com/Uniswap/uniswap-ai/tree/HEAD/packages/plugins/uniswap-trading/skills/v4-sdk-integration)
- [Asks for: Read, Write, Edit, Glob, Grep, Bash(npm:*), Bash(npx:*), Bash(yarn:*)…](https://github.com/Uniswap/uniswap-ai/blob/HEAD/packages/plugins/uniswap-trading/skills/v4-sdk-integration/SKILL.md)
- [License: MIT](https://github.com/Uniswap/uniswap-ai/tree/HEAD/packages/plugins/uniswap-trading/skills/v4-sdk-integration)

## Features

- **Swap execution via Universal Router:** Shows how to plan single-hop and multi-hop exact-input swaps through V4Planner and the Universal Router.
- **Quoting with simulated calls:** Explains how to fetch quotes through eth_call across viem and ethers versions, including the four quoter methods.
- **Pool state reads:** Covers reading slot0 and liquidity from StateView using a computed pool ID.
- **Liquidity position management:** Describes adding, removing, collecting and creating positions with PositionManager multicalls.
- **Permit2 approval flow:** Lays out the two-step token approval needed for ERC20 swaps in v4.
- **v3 to v4 differences:** Compares contract architecture, native ETH handling, fee collection and position discovery between v3 and v4.

## Good for

- Build a token swap interface on top of Uniswap v4 pools
- Show a live quote before a v4 trade is submitted
- Add or remove liquidity from a v4 position in a dApp
- Read the current price and liquidity of a v4 pool
- Route a multi-hop swap through several v4 pools

## Install

### Claude Code

This skill ships in the `uniswap-trading` plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):

```sh
/plugin marketplace add Uniswap/uniswap-ai
/plugin install uniswap-trading@uniswap-ai
```

Or copy only this skill to `~/.claude/skills/v4-sdk-integration`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/Uniswap/uniswap-ai.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/v4-sdk-integration &&
cp -R "$tmp/packages/plugins/uniswap-trading/skills/v4-sdk-integration" ~/.claude/skills/v4-sdk-integration &&
rm -rf "$tmp"
```

For one project only, put the folder in `.claude/skills/v4-sdk-integration` inside it instead.

### Codex

Copy the skill folder to `~/.agents/skills/v4-sdk-integration` to use it in every repository:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/Uniswap/uniswap-ai.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/v4-sdk-integration &&
cp -R "$tmp/packages/plugins/uniswap-trading/skills/v4-sdk-integration" ~/.agents/skills/v4-sdk-integration &&
rm -rf "$tmp"
```

For one repository only, put the folder in `.agents/skills/v4-sdk-integration` inside it instead.

### Cursor

Copy the skill folder to `~/.cursor/skills/v4-sdk-integration` to use it in every project:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/Uniswap/uniswap-ai.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/v4-sdk-integration &&
cp -R "$tmp/packages/plugins/uniswap-trading/skills/v4-sdk-integration" ~/.cursor/skills/v4-sdk-integration &&
rm -rf "$tmp"
```

For one project only, put the folder in `.cursor/skills/v4-sdk-integration` inside it instead.

### Gemini CLI

Run in a terminal (add `--scope workspace` to install it for the current workspace only):

```sh
gemini skills install https://github.com/Uniswap/uniswap-ai.git --path packages/plugins/uniswap-trading/skills/v4-sdk-integration
```

Or copy the folder to `~/.gemini/skills/v4-sdk-integration` yourself.

### VS Code

For GitHub Copilot in VS Code, copy the skill folder to `~/.copilot/skills/v4-sdk-integration`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/Uniswap/uniswap-ai.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/v4-sdk-integration &&
cp -R "$tmp/packages/plugins/uniswap-trading/skills/v4-sdk-integration" ~/.copilot/skills/v4-sdk-integration &&
rm -rf "$tmp"
```

For one project only, put the folder in `.github/skills/v4-sdk-integration` inside it instead.

### Other agents

Get the folder:

```sh
git clone --depth 1 https://github.com/Uniswap/uniswap-ai.git
```

Then copy `uniswap-ai/packages/plugins/uniswap-trading/skills/v4-sdk-integration` into your agent's skills folder as `v4-sdk-integration`. Agents that support SKILL.md read one folder per skill.

## FAQ

### What does V4 SDK integration need to run?

It targets TypeScript or JavaScript projects and uses the @uniswap/v4-sdk, @uniswap/sdk-core and @uniswap/universal-router-sdk packages, with most examples written for viem.

### When should I use V4 SDK integration instead of the Trading API guide?

It is for building swap and liquidity experiences directly with the v4 SDK; the Trading API and v3-centric swaps are covered by a separate swap-integration skill.

### Does V4 SDK integration include Solidity hook contracts?

No. Solidity hook contract work is handled by the separate uniswap-hooks skill.

### Are the contract addresses the same on every chain?

No. The skill states that v4 addresses differ per chain and points to Uniswap's deployments page, except Permit2 which is listed as the same across chains.

### How do I install V4 SDK integration in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/v4-sdk-integration to use it in all your projects, or to .claude/skills/v4-sdk-integration in one project. Or install the uniswap-trading plugin, which includes it: /plugin marketplace add Uniswap/uniswap-ai, then /plugin install uniswap-trading@uniswap-ai.

### Does V4 SDK integration run scripts?

No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

### Which AI agents can use V4 SDK integration?

Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose. Each reads skills in the SKILL.md format from its own folder; the install steps on this page list them.

### What are the best alternatives to V4 SDK integration?

The closest alternatives to V4 SDK integration are Swap integration, Lp integration, V4 security foundations, Permissioned pools deployer and V4 hook generator.

## Where this comes from

- Description: from the skill's own SKILL.md.

## Alternatives

- [Swap integration](https://ai-powered.com/skills/swap-integration): Swap integration is an open-source agent skill for finance and payments.
- [Lp integration](https://ai-powered.com/skills/lp-integration): Lp integration is an open-source agent skill for developer tools.
- [V4 security foundations](https://ai-powered.com/skills/v4-security-foundations): V4 security foundations is an open-source agent skill for developer tools.
- [Permissioned pools deployer](https://ai-powered.com/skills/permissioned-pools-deployer): Permissioned pools deployer is an open-source agent skill for developer tools.
- [V4 hook generator](https://ai-powered.com/skills/v4-hook-generator): V4 hook generator is an open-source agent skill for developer tools.
- [Permissioned pools issuer](https://ai-powered.com/skills/permissioned-pools-issuer): Permissioned pools issuer is an open-source agent skill for developer tools.
- [Viem integration](https://ai-powered.com/skills/viem-integration): Viem integration is an open-source agent skill for developer tools.
- [Permissioned pools configurator](https://ai-powered.com/skills/permissioned-pools-configurator): Permissioned pools configurator is an open-source agent skill for developer tools.

---
Source: https://ai-powered.com/skills/v4-sdk-integration
