v4-hook-generator
БесплатноБез исполняемых скриптовНе проверенGenerate Uniswap v4 hook contracts via OpenZeppelin MCP. Use when building custom swap logic, async swaps, hook-owned liquidity, custom curves, dynamic fees…
от Uniswap★ 236 звёзд на GitHubОб этом скилле
v4 Hook Generator
Generate Uniswap v4 hook contracts via the OpenZeppelin Contracts Wizard MCP tool. This skill guides you through selecting the right hook type, configuring permissions and utilities, assembling the canonical MCP JSON, and invoking the MCP tool to produce ready-to-compile Solidity code.
Security companion: Generated hook code touches fund-handling contracts. Always apply the
v4-security-foundationsskill immediately after generation to audit permissions, delta accounting, and access control before deploying to any network.
When to Use This Skill
Use this skill when you need to:
- Scaffold a new Uniswap v4 hook contract from scratch
- Select the right base hook type for a specific use case (fees, MEV protection, oracles, etc.)
- Configure hook permissions, utility libraries, shares, and access control
- Produce the canonical MCP tool call JSON to invoke the OpenZeppelin Contracts Wizard
- Understand trade-offs between hook configuration options before committing to an implementation
Prerequisite / companion skill: v4-security-foundations — run it before writing custom logic
and again before deployment. Hook misconfiguration can drain user funds.
Hook Type Decision Table
Choose the base hook type that matches your primary goal. If your hook has multiple goals, choose the type that covers the most critical concern and layer additional logic on top.
| Goal | Use Hook |
|---|---|
| Custom swap logic | BaseHook |
| Async/delayed swaps | BaseAsyncSwap |
| Hook-owned liquidity | BaseCustomAccounting |
| Custom curve | BaseCustomCurve |
| Dynamic LP fees | BaseDynamicFee |
| Dynamic swap fees | BaseOverrideFee |
| Post-swap fees | BaseDynamicAfterFee |
| Fixed hook fees | BaseHookFee |
| MEV protection | AntiSandwichHook |
| JIT protection | LiquidityPenaltyHook |
| Limit orders | LimitOrderHook |
| Yield on idle | ReHypothecationHook |
| Oracle | BaseOracleHook |
| V3-compatible oracle | OracleHookWithV3Adapters |
Selection tips:
BaseHookis the general-purpose starting point — choose a specialized type only when the built-in logic provides concrete value.BaseCustomCurvereplaces the entire AMM math; only use it if you are implementing a novel pricing algorithm.AntiSandwichHookandLiquidityPenaltyHookboth address MEV but target different actors (traders vs. JIT LPs). Clarify which attack vector you are mitigating.OracleHookWithV3Adaptersis appropriate when downstream integrations expect a Uniswap v3IUniswapV3Pool-compatible oracle interface.
Minimal Decision Checklist
Before calling the MCP tool, confirm all six decisions:
- Hook type — chosen from the decision table above
- Permissions to enable — only the callbacks your logic actually uses (
beforeSwap,afterSwap, etc.) - Utility libraries —
currencySettler,safeCast,transientStorageas needed - Shares —
false,ERC20,ERC6909, orERC1155 - Access control —
ownable,roles, ormanaged - Hook inputs —
blockNumberOffset,maxAbsTickDelta(only for hook types that use them)
Permission Configuration
All 14 permission flags with guidance on when to enable each. Start with all flags false and
enable only what your hook logic requires. Every enabled permission increases the hook's attack
surface and requires a specific bit to be set in the hook's deployed address (see address encoding
note below).
| Permission Flag | Enable When | Risk |
|---|---|---|
beforeInitialize |
You need to validate or restrict pool creation params | LOW |
afterInitialize |
You need to set up state after a pool is created | LOW |
beforeAddLiquidity |
You need to gate or transform LP deposits | MEDIUM |
afterAddLiquidity |
You track LP positions or distribute rewards | LOW |
beforeRemoveLiquidity |
You need lock-up periods or fee-on-exit logic | HIGH |
afterRemoveLiquidity |
You track position removals for accounting |
Установить v4-hook-generator в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadGlobGrepWebFetchBashFAQ
Что делает скилл v4-hook-generator?
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.
Как установить скилл v4-hook-generator?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл v4-hook-generator запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic