# V4 hook generator

> V4 hook generator is an open-source agent skill for developer tools. Guides an agent to scaffold Uniswap v4 hook contracts via the OpenZeppelin Wizard MCP. It is available on Claude Code.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code
- **Website:** https://github.com/Uniswap/uniswap-ai/tree/main/packages/plugins/uniswap-hooks/skills/v4-hook-generator
- **Repository:** https://github.com/uniswap/uniswap-ai
- **GitHub stars:** 236
- **License:** MIT
- **Skill name:** v4-hook-generator
- **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 helps an agent pick the right Uniswap v4 hook base type for a goal such as custom swap logic, dynamic fees, MEV protection, limit orders or oracles. It walks through choosing which pool lifecycle callbacks to enable, which utility libraries to include, how shares and access control should be configured, and what numeric inputs apply to certain hook types.

The workflow runs in four stages: gather requirements, select the hook type, assemble a canonical JSON argument, and call the OpenZeppelin Contracts Wizard MCP tool to receive Solidity source. The MCP tool returns code as a string and does not write files, so the agent is expected to save the output to disk and explain the generated constructor and permission sections. The skill also notes manual steps such as mining a deployment salt with HookMiner so the hook address encodes its permission bits.

The skill is a planning and scaffolding guide rather than a code generator on its own. It expects a working MCP connection to the OpenZeppelin Wizard, familiarity with Solidity and Foundry or Hardhat style deployments, and it points users to a companion security skill to run before any deployment.

## When your agent uses it

> Generate Uniswap v4 hook contracts via OpenZeppelin MCP. Use when building custom swap logic, async swaps, hook-owned liquidity, custom curves, dynamic fees, MEV protection, limit orders, or oracle hooks.

## 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-hooks/skills/v4-hook-generator)
- [Asks for: Read, Glob, Grep, WebFetch, Bash](https://github.com/Uniswap/uniswap-ai/blob/HEAD/packages/plugins/uniswap-hooks/skills/v4-hook-generator/SKILL.md)
- [License: MIT](https://github.com/Uniswap/uniswap-ai/tree/HEAD/packages/plugins/uniswap-hooks/skills/v4-hook-generator)

## Features

- **Hook type selection:** Maps a stated goal to one of fourteen Uniswap v4 base hook types with trade-off guidance.
- **Permission configuration:** Explains each of the fourteen permission flags, when to enable it and its risk level.
- **Utility library choices:** Covers when to include currency settling, safe casting and transient storage helpers.
- **Shares and access options:** Compares no share token, ERC20, ERC6909 and ERC1155 plus ownable, roles and managed access.
- **MCP call assembly:** Provides the canonical JSON argument structure for the OpenZeppelin Wizard generate_hook tool.
- **Deployment address notes:** Describes how permission bits are encoded in the hook address and how to mine a matching salt.

## Good for

- Scaffold a Uniswap v4 hook that charges dynamic swap fees
- Create an oracle hook compatible with a v3-style pool interface
- Generate a limit order hook for a Uniswap v4 pool
- Choose which permission flags a MEV protection hook needs
- Produce Solidity for a hook with role-based admin access

## Install

### Claude Code

This skill ships in the `uniswap-hooks` 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-hooks@uniswap-ai
```

Or copy only this skill to `~/.claude/skills/v4-hook-generator`:

```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-hook-generator &&
cp -R "$tmp/packages/plugins/uniswap-hooks/skills/v4-hook-generator" ~/.claude/skills/v4-hook-generator &&
rm -rf "$tmp"
```

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

### Codex

Copy the skill folder to `~/.agents/skills/v4-hook-generator` 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-hook-generator &&
cp -R "$tmp/packages/plugins/uniswap-hooks/skills/v4-hook-generator" ~/.agents/skills/v4-hook-generator &&
rm -rf "$tmp"
```

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

### Cursor

Copy the skill folder to `~/.cursor/skills/v4-hook-generator` 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-hook-generator &&
cp -R "$tmp/packages/plugins/uniswap-hooks/skills/v4-hook-generator" ~/.cursor/skills/v4-hook-generator &&
rm -rf "$tmp"
```

For one project only, put the folder in `.cursor/skills/v4-hook-generator` 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-hooks/skills/v4-hook-generator
```

Or copy the folder to `~/.gemini/skills/v4-hook-generator` yourself.

### VS Code

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

```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-hook-generator &&
cp -R "$tmp/packages/plugins/uniswap-hooks/skills/v4-hook-generator" ~/.copilot/skills/v4-hook-generator &&
rm -rf "$tmp"
```

For one project only, put the folder in `.github/skills/v4-hook-generator` 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-hooks/skills/v4-hook-generator` into your agent's skills folder as `v4-hook-generator`. Agents that support SKILL.md read one folder per skill.

## FAQ

### What does V4 hook generator need to run?

It calls the OpenZeppelin Contracts Wizard generate_hook MCP tool, so that MCP server must be available. It lists Read, Glob, Grep, WebFetch and Bash as allowed tools.

### Does V4 hook generator write the generated contract to my project?

No. The MCP tool returns Solidity as a string, and the agent must write it to disk itself.

### What should I run after generating a hook?

The skill tells the agent to apply the v4-security-foundations skill to audit permissions, delta accounting and access control before any deployment.

### Why must permissions be set before deployment?

Enabled permissions are encoded as bits in the hook's deployed address, so the address must match at deployment and cannot be changed afterward.

### How do I install V4 hook generator in Claude Code?

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

### Does V4 hook generator 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 hook generator?

Claude Code. It reads skills in the SKILL.md format; the install steps on this page show where to put the folder.

### What are the best alternatives to V4 hook generator?

The closest alternatives to V4 hook generator are V4 security foundations, Permissioned pools deployer, V4 SDK integration, Writing hooks and Permissioned pools configurator.

## Where this comes from

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

## Alternatives

- [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 SDK integration](https://ai-powered.com/skills/v4-sdk-integration): V4 SDK integration is an open-source agent skill for developer tools.
- [Writing hooks](https://ai-powered.com/skills/writing-hooks-xiaolai): Writing hooks 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.
- [Moodle hooks API](https://ai-powered.com/skills/moodle-hooks-api): Moodle hooks API 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.
- [Dynamic workflow mode](https://ai-powered.com/skills/dynamic-workflow-mode): Dynamic workflow mode is an open-source agent skill for developer tools.

---
Source: https://ai-powered.com/skills/v4-hook-generator
