Installs into .claude/skills of the current project.
Are you the author of 2519 Uniswap Hooks 623506dd?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/tools-only-2519-uniswap-hooks-623506dd)
---
title: Uniswap Hooks
order: 3
---
# Uniswap Hooks
AI-powered, security-first assistance for creating Uniswap v4 hooks.
## Installation
```bash
/plugin install uniswap-hooks
```
## Skills
| Skill | Description | Invocation |
| ------------------------------------------------------------ | -------------------------------------------- | -------------------------- |
| [v4 Security Foundations](../skills/v4-security-foundations) | Security-first guide for V4 hook development | `/v4-security-foundations` |
## Hook Callbacks
Hooks are smart contracts that intercept and modify pool actions at specific points:
| Callback | When Called | Use Case |
| ----------------------- | --------------------- | ------------------------- |
| `beforeInitialize` | Before pool creation | Validate pool parameters |
| `afterInitialize` | After pool creation | Set up hook state |
| `beforeAddLiquidity` | Before LP deposit | Custom fee logic |
| `afterAddLiquidity` | After LP deposit | Update rewards |
| `beforeRemoveLiquidity` | Before LP withdrawal | Lock periods |
| `afterRemoveLiquidity` | After LP withdrawal | Distribute rewards |
| `beforeSwap` | Before swap execution | Price oracles, routing |
| `afterSwap` | After swap execution | MEV protection, analytics |
| `beforeDonate` | Before donation | Access control |
| `afterDonate` | After donation | Track donations |
## Hook Flags
Hooks declare which callbacks they implement via a permissions struct. The hook address must encode which callbacks are enabled in its last 14 bits. Use the hook miner to find valid addresses during deployment.
```solidity
function getHookPermissions() public pure override returns (Hooks.Permissions memory) {
return Hooks.Permissions({
beforeInitialize: false,
afterInitialize: true,
beforeSwap: true,
afterSwap: true,
// ... remaining flags
});
}
```
## Development Guidelines
- **Address requirements**: v4 hooks must have specific address patterns where the last 14 bits encode enabled callbacks
- **State management**: Use transient storage for temporary data; consider gas costs for persistent state
- **Security**: Validate all inputs, guard against reentrancy, consider MEV implications
- **Testing**: Test edge cases with extreme tick ranges
## Related
- [Plugins Overview](/plugins/) - All available plugins
- [Skills](/skills/) - All available skills
- [Uniswap v4 Core](https://github.com/Uniswap/v4-core)
- [v4 Periphery](https://github.com/Uniswap/v4-periphery)