
V4 security foundations
Security checklists and vulnerability patterns for building Uniswap v4 hooks safely
V4 security foundations is an open-source agent skill for developer tools. It is available on Claude Code.
- Scripts
- None
- Platforms
- Claude Code
- GitHub stars
- 236
- Last commit
- License
- MIT
- Listing updated
Similar skills
About V4 security foundations
This skill guides an agent through writing Uniswap v4 hooks with a security-first approach. It lays out a threat model covering caller verification, sender identity and router context, and reentrancy, then rates each of the 14 hook permission flags by risk level. Particular attention goes to the beforeSwapReturnDelta permission, with an explanation of the NoOp rug pull pattern and a short list of checks to run before using such a hook.
The guide also covers delta accounting through the PoolManager (take, settle and sync ordering), access control patterns that restrict callbacks to the PoolManager, and hazards from non-standard tokens such as fee-on-transfer and rebasing assets. It includes gas budget targets per callback, common gas pitfalls, and Foundry commands for gas profiling. A scoring system maps a hook's permissions, external calls, state, upgradability and token handling to a recommended audit tier.
The skill ships a base hook template with all permissions disabled by default, plus reference files for the template, a vulnerabilities catalog and a detailed audit checklist. It is written for Solidity developers working with v4-core and v4-periphery, and it runs no scripts of its own.
When your agent uses it
Security-first Uniswap v4 hook development. Use when user mentions "v4 hooks", "hook security", "PoolManager", "beforeSwap", "afterSwap", or asks about V4 hook best practices, vulnerabilities, or audit requirements.
From the skill's SKILL.md. Your agent reads this description to decide when to load the skill.
What it can access
- Instructions only, no scripts(see the files on GitHub)
- Asks for: Read, Glob, Grep, WebFetch, Task(subagent_type:Explore)(see the files on GitHub)
- License: MIT(see the files on GitHub)
From a static check of its 4 files (49 KB) on GitHub on 3 December 2026. Nothing was run. Read the files before you install a skill: it can tell your agent to run anything its tools allow.
Check another skill before you install it.
Install
This skill ships in the uniswap-hooks plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):
/plugin marketplace add Uniswap/uniswap-ai
/plugin install uniswap-hooks@uniswap-aiOr copy only this skill to ~/.claude/skills/v4-security-foundations:
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/Uniswap/uniswap-ai.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/v4-security-foundations &&
cp -R "$tmp/packages/plugins/uniswap-hooks/skills/v4-security-foundations" ~/.claude/skills/v4-security-foundations &&
rm -rf "$tmp"For one project only, put the folder in .claude/skills/v4-security-foundations inside it instead.
Copy the skill folder to ~/.agents/skills/v4-security-foundations to use it in every repository:
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/Uniswap/uniswap-ai.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/v4-security-foundations &&
cp -R "$tmp/packages/plugins/uniswap-hooks/skills/v4-security-foundations" ~/.agents/skills/v4-security-foundations &&
rm -rf "$tmp"For one repository only, put the folder in .agents/skills/v4-security-foundations inside it instead.
Copy the skill folder to ~/.cursor/skills/v4-security-foundations to use it in every project:
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/Uniswap/uniswap-ai.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/v4-security-foundations &&
cp -R "$tmp/packages/plugins/uniswap-hooks/skills/v4-security-foundations" ~/.cursor/skills/v4-security-foundations &&
rm -rf "$tmp"For one project only, put the folder in .cursor/skills/v4-security-foundations inside it instead.
Run in a terminal (add --scope workspace to install it for the current workspace only):
gemini skills install https://github.com/Uniswap/uniswap-ai.git --path packages/plugins/uniswap-hooks/skills/v4-security-foundationsOr copy the folder to ~/.gemini/skills/v4-security-foundations yourself.
For GitHub Copilot in VS Code, copy the skill folder to ~/.copilot/skills/v4-security-foundations:
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/Uniswap/uniswap-ai.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/v4-security-foundations &&
cp -R "$tmp/packages/plugins/uniswap-hooks/skills/v4-security-foundations" ~/.copilot/skills/v4-security-foundations &&
rm -rf "$tmp"For one project only, put the folder in .github/skills/v4-security-foundations inside it instead.
Get the folder:
git clone --depth 1 https://github.com/Uniswap/uniswap-ai.gitThen copy uniswap-ai/packages/plugins/uniswap-hooks/skills/v4-security-foundations into your agent's skills folder as v4-security-foundations. Agents that support SKILL.md read one folder per skill.
What it does
- Permission risk matrix
- Rates each of the 14 v4 hook permission flags by risk level with notes on what can go wrong.
- NoOp attack guidance
- Explains the beforeSwapReturnDelta attack pattern and the checks to run before trusting such a hook.
- Delta accounting rules
- Describes PoolManager credit and debit settlement with the correct sync, transfer and settle order.
- Caller and router checks
- Shows how to restrict callbacks to the PoolManager and handle the sender parameter for router allowlisting.
- Gas budget targets
- Lists target and ceiling gas figures per hook callback and common gas pitfalls with Foundry profiling commands.
- Audit tier scoring
- Scores a hook's risk across several categories and recommends the audit level for the result.
Good for
- Review a Uniswap v4 hook for access control mistakes before deployment
- Check whether a hook that returns swap deltas is safe to use
- Write a base v4 hook contract with permissions disabled by default
- Estimate how much audit coverage a planned v4 hook needs
- Profile gas usage of beforeSwap and afterSwap callbacks
V4 security foundations FAQ
What does V4 security foundations trigger on?
It is meant to load when the user mentions terms such as v4 hooks, hook security, PoolManager, beforeSwap or afterSwap, or asks about hook best practices, vulnerabilities or audit requirements.
Which clients does V4 security foundations work with?
It is packaged as a Claude Code plugin marketplace entry (uniswap-ai), so it is tied to Claude Code.
Does V4 security foundations run any scripts?
No. The skill folder contains no scripts. It provides written guidance, a Solidity template and reference documents.
What tools does V4 security foundations allow the agent to use?
It lists Read, Glob, Grep, WebFetch and a Task subagent of type Explore.
What license applies?
The skill is released under the MIT license.
How do I install V4 security foundations in Claude Code?
Copy the skill folder from GitHub to ~/.claude/skills/v4-security-foundations to use it in all your projects, or to .claude/skills/v4-security-foundations 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 security foundations 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 security foundations?
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 security foundations?
The closest alternatives to V4 security foundations are Uniswap v4 hook access control, V4 hook generator, V4 SDK integration, Permissioned pools issuer and Permissioned pools deployer.
Where this comes from
- Description: from the skill's own SKILL.md.
More from Uniswap/uniswap-ai

Guides your agent through configuring Uniswap CCA token auction contract parameters
- Open source
- 236 GitHub stars
- Finance and payments

Guides an agent through deploying Uniswap CCA auction contracts via the factory
- Open source
- 236 GitHub stars
- Developer tools

Plans Uniswap liquidity positions and generates pre-filled position deep links
- Open source
- 236 GitHub stars
- Finance and payments

Plans token swaps on Uniswap across chains and builds pre-filled swap links
- Open source
- 236 GitHub stars
- Finance and payments

Guides an agent to scaffold Uniswap v4 hook contracts via the OpenZeppelin Wizard MCP
- Open source
- 236 GitHub stars
- Developer tools

Collects and validates Uniswap v4 permissioned pool parameters into a deploy-ready JSON
- Open source
- 236 GitHub stars
- Developer tools


