
Description
v4 Security Foundations is an agent skill for writing Uniswap v4 hooks with security first. Hooks can drain user funds if they are written badly, so the skill makes the agent work through the threat model before writing code. It covers caller verification, which means only the PoolManager should call hook functions, and the fact that msg.sender is always the PoolManager and never the end user. It explains router context, where the sender parameter identifies the router rather than the person, and why hook state can be read in the middle of a transaction. It also covers reentrancy risk from external calls made inside a hook. The page includes a risk matrix for all 14 hook permission flags. The skill is for developers building Uniswap v4 hooks, and it triggers on mentions of v4 hooks, hook security, PoolManager, beforeSwap and afterSwap. It is a guide to follow while coding, not an audit service.…
Highlights
- Threat model reviewed before writing hook code
- Caller verification for the PoolManager
- Router allowlisting and sender identity
- Reentrancy guidance for external calls
- Risk matrix for all 14 hook permissions
Ratings & Reviews
No ratings yet
Be the first to rate v4-security-foundations.
People also visit
v4-security-foundations FAQ
What is this skill for?
It helps a coding agent write Uniswap v4 hooks while avoiding the common security mistakes that could put user funds at risk.
Who is it for?
Developers building Uniswap v4 hooks who want the security checks built into their workflow.
How do I install it?
Run npx skills add https://github.com/uniswap/uniswap-ai --skill v4-security-foundations.
What does the permission risk matrix show?
It lists all 14 hook permission flags with the risk level of each one.
What are the security audit results?
Gen Agent Trust Hub: Pass. Socket: Pass. Snyk: Pass.
What are the best v4-security-foundations alternatives?
Popular alternatives to v4-security-foundations include swap-integration, viem-integration and kukapay/uniswap-trader-mcp. See all v4-security-foundations alternatives










