Uniswap 集成架构设计专家
简介
为 DeFi 项目设计 Uniswap 集成架构,智能推荐最佳集成方案(Trading API/SDK/合约),输出完整技术蓝图与实施路线
原始描述
Design a Uniswap integration architecture. Use when user is building a project that needs to integrate Uniswap and wants recommendations on integration method (Trading API vs SDK vs direct contract), architecture patterns, required dependencies, and security considerations.
通过你的 Agent 添加
点「快速安装」复制一段指令,粘给你正在用的 Agent(Claude Code、Codex、OpenClaw 等),它会自己完成安装。
或者手动安装
包里是 SKILL.md 加作者附带的文件,解压后目录名就是技能名。
技能申请的权限由作者决定,装之前请确认它能读什么、能执行什么。
中文使用说明 来自收录源
核心用途
design-integration 是专为 Uniswap 集成场景打造的专业架构设计技能。它将复杂的 DEX 集成决策流程标准化,通过 integration-architect 子智能体为用户输出定制化的技术蓝图。
核心用法
调用时需明确以下参数:
- projectType: 项目类型(DeFi 仪表盘/套利机器人/钱包应用/DeFi 协议等)
- functionality: 所需功能(swap/LP/both/custom)
- environment: 执行环境(frontend/backend/smart contract/full-stack)
- chains: 目标链(支持 11 条 Uniswap 部署链)
- scale: 规模需求(交易量、并发用户、延迟要求)
显著优点
- 智能方案推荐:自动评估 Trading API、Universal Router SDK、直接合约调用、V4 Hooks 四种集成方式的适用场景,给出主方案 + 备选方案
- 完整技术蓝图:输出包含组件架构、数据流、依赖清单、版本锁定、安全审查的全套文档
- 现代化技术栈:强制使用 viem(非 ethers.js)、Permit2(非传统 approve),符合当前最佳实践
- 有序实施计划:按依赖关系排序的开发任务清单,附工期估算
潜在局限
- 无实时执行能力:仅输出设计文档,不实际执行代码生成或合约部署
- 依赖子智能体质量:最终输出质量取决于
integration-architect的能力边界 - 链支持限制:仅覆盖 Uniswap 官方部署的 11 条链,长尾链需自定义适配
适合人群
- 需要集成 Uniswap 的 DeFi 协议开发者
- 构建 DEX 聚合器或套利系统的量化团队
- 为 dApp 添加兑换功能的前端/全栈工程师
- 评估技术方案的技术负责人与架构师
常规风险
| 风险类型 | 说明 |
|---|---|
| 报价失效 | 链上价格波动导致预执行报价与实际成交差异 |
| 授权管理 | Permit2 过期或额度配置不当导致交易失败 |
| MEV 攻击 | 大额交易面临三明治攻击风险 |
| RPC 依赖 | 节点服务不稳定影响用户体验 |
| 合约升级 | Uniswap 协议升级可能引入兼容性问题 |
安全等级说明
技能本身为设计顾问型,不直接操作资金或合约,安全风险主要来自输出建议被误用。建议结合专业安全审计实施。
技能正文
name: design-integration description: >- Design a Uniswap integration architecture. Use when user is building a project that needs to integrate Uniswap and wants recommendations on integration method (Trading API vs SDK vs direct contract), architecture patterns, required dependencies, and security considerations. allowed-tools: >- Read, Write, Edit, Glob, Grep, Task(subagent_type:integration-architect), mcp__uniswap__get_supported_chains model: opus
Design Integration
Overview
Designs a complete Uniswap integration architecture for any project by delegating to the integration-architect agent. Produces a comprehensive blueprint covering: integration method recommendation (Trading API vs Universal Router SDK vs direct contract vs V4 hooks), component architecture, dependency list with versions, security review with mitigations, and ordered implementation plan.
When to Use
Activate when the user asks:
- "Help me integrate Uniswap"
- "Design a swap integration"
- "Architecture for a DEX aggregator"
- "How to build an arbitrage bot"
- "Uniswap integration plan"
- "How should I add swaps to my dApp?"
- "Best way to integrate Uniswap in my backend"
- "Architecture for a DeFi protocol that uses Uniswap"
- "What SDK should I use for Uniswap?"
Parameters
| Parameter | Required | Default | Description |
|---|---|---|---|
| projectType | Yes | -- | Type of project (e.g., "DeFi dashboard", "arb bot", "wallet app", "DeFi protocol") |
| functionality | Yes | -- | Required Uniswap functionality: "swap", "LP", "both", or "custom" |
| environment | No | Auto-detect | Execution environment: "frontend", "backend", "smart contract", or "full-stack" |
| chains | No | ethereum | Target chain(s): single chain name or comma-separated list |
| scale | No | -- | Expected scale: transaction volume, concurrent users, latency requirements |
Workflow
-
Extract parameters from the user's request: identify the project type, required functionality, target environment, chains, and scale requirements. If the user has an existing codebase, note it for the agent to analyze.
-
Delegate to integration-architect: Invoke
Task(subagent_type:integration-architect)with the full context. The integration-architect will:- Understand the project context and requirements
- Evaluate integration methods and recommend primary + fallback
- Design the component architecture with data flow
- Identify all dependencies (NPM packages, APIs, infrastructure)
- Perform a security review with attack vectors and mitigations
- Produce an ordered implementation plan with effort estimates
-
Present the blueprint to the user covering:
- Integration method recommendation with clear rationale
- Architecture overview (components, data flow, error handling)
- Complete dependency list with versions and purposes
- Security considerations with specific mitigations
- Step-by-step implementation order with effort estimates
- Overall complexity assessment
Output Format
Present a structured integration blueprint:
Integration Blueprint: DeFi Dashboard with Swap (Ethereum + Base)
Recommended Method: Trading API (primary), Universal Router SDK (fallback)
Rationale: Trading API provides optimized routing with minimal frontend
complexity. Fallback to SDK for advanced use cases or API downtime.
Architecture:
User -> QuoteService -> ApprovalManager -> SwapExecutor -> Wallet -> Chain
Components:
QuoteService: Fetches and caches quotes from Trading API
ApprovalManager: Manages Permit2 approvals and allowances
SwapExecutor: Constructs and submits swap transactions
ChainManager: Multi-chain config and RPC connections
Dependencies:
@uniswap/sdk-core ^5.8.0 Token and price primitives
viem ^2.21.0 Ethereum client
wagmi ^2.14.0 React wallet hooks
@tanstack/react-query ^5.0.0 Data fetching and caching
Security:
- Stale quotes: Refresh every 15s, enforce deadline (block.timestamp + 300s)
- Approvals: Permit2 with exact amounts and 30-min expiry
- Key management: wagmi wallet connection only, never handle keys
Implementation Order:
1. Wallet connection (wagmi) — 1 day
2. Chain configuration — 0.5 days
3. Quote fetching service — 1 day
4. Permit2 approval flow — 1 day
5. Swap execution and tracking — 1.5 days
6. Error handling and retry logic — 1 day
Complexity: Medium
Important Notes
- This skill delegates entirely to the
integration-architectagent -- it does not call MCP tools directly. - The blueprint is tailored to the specific project type and requirements -- not a generic template.
- For existing codebases, the agent will analyze the current code and recommend integration patterns that fit the existing architecture.
- The implementation order considers dependencies between components -- follow the order for smoothest development.
- Always uses viem (not ethers.js) and Permit2 (not legacy approve) per project conventions.
Error Handling
| Error | User-Facing Message | Suggested Action |
|---|---|---|
VAGUE_PROJECT |
"Need more detail about your project to recommend an integration approach." | Describe project type and what Uniswap functionality is needed |
DEPRECATED_APPROACH |
"The requested integration method is deprecated. Recommending alternatives." | Follow the updated recommendation |
UNSUPPORTED_CHAIN |
"Uniswap is not deployed on the specified chain." | Choose from the 11 supported chains |
CONFLICTING_REQUIREMENTS |
"The requirements conflict (e.g., frontend + direct contract calls)." | Clarify the execution environment and adjust expectations |
正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。