微算力 · API 导航与自营网关
API 接入 EN
未登录登录
🦄

Uniswap 集成架构设计专家

design-integration · vv0.1.0
开发 安全 S 级 作者 wpank 公开目录收录
1.2k 下载 588 安装 2.6k 收藏 23.5k 浏览

简介

基于 Uniswap 官方技术栈的架构设计助手,为 DeFi 项目提供从选型到实施的完整蓝图、依赖清单与安全保障方案。

原始描述

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 添加

安装目录:design-integration/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。

点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。

或者手动安装

Claude Code~/.claude/skills/design-integration/
Codex CLI~/.codex/skills/design-integration/
DeepSeek Harness~/.agents/skills/design-integration/

包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可; 目录名不用换,也不要把包直接解压到 skills 根目录。 技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。

中文使用说明 来自收录源

核心用法

design-integration 是一个纯文档型Skill,本身不执行代码,而是通过 Task 工具将请求委派给 integration-architect 子代理。用户只需描述项目类型(如DeFi面板、套利机器人)、所需功能(swap/LP/两者)、执行环境(前端/后端/合约/全栈)、目标链及规模预期,即可获得量身定制的集成方案。

显著优点

  1. 架构决策自动化:自动评估 Trading API vs Universal Router SDK vs 直接合约调用 vs V4 hooks 的优劣,给出主方案+备选方案
  2. 端到端蓝图:输出包含组件架构图、数据流、依赖清单(版本锁定)、安全审查及实施计划
  3. 现代技术栈:默认推荐 viem(而非 ethers.js)和 Permit2(而非传统 approve),符合当前最佳实践
  4. 多链支持:内置调用 mcp__uniswap__get_supported_chains 查询官方支持的11条链,避免部署到未支持网络
  5. 安全优先设计:内置安全审查环节,涵盖报价失效、授权管理、密钥安全等DeFi常见风险

潜在局限

  • 依赖子代理质量:实际方案质量完全取决于 integration-architect 子代理的能力,本Skill本身无校验逻辑
  • 无实时数据:除链支持查询外,不直接调用Uniswap API或合约获取实时数据(如汇率、流动性)
  • 个人维护来源:维护者为GitHub个人账号(wpank),非Uniswap官方或顶级基金会,长期维护稳定性需观察
  • 文档型限制:T-MD分类意味着无法执行动态测试或代码生成,所有实现需用户自行完成

适合人群

  • DeFi协议开发者:需要评估多种集成方式并制定技术路线的团队
  • dApp前端工程师:寻求最佳SDK选择和Permit2集成方案
  • 量化/套利策略开发者:需要架构设计指导的backend-focused用户
  • 技术负责人:需要快速产出技术评估文档和工时估算的场景

常规风险

  • 方案实施风险:生成的蓝图需开发团队正确实施,Skill本身不保证最终实现无漏洞
  • Permit2认知门槛:虽然推荐更安全,但Permit2授权模式对不熟悉EIP-2612的开发者有学习成本
  • API依赖:若选择Trading API方案,需承担Uniswap API服务可用性和费率变化的风险
  • V4 Hooks复杂性:对于高级用法(自定义V4 hooks),文档可能无法覆盖所有边界情况

技能正文


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

  1. 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.

  2. 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
  3. 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-architect agent -- 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

正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。

标签

defiblockchaindevelopment-engineeringbackendfrontendapidocssmart-contract

同类 Skill