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
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.
Activate when the user asks:
本技能來自小蔥技能站7w4.net。
| 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 |
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:
Produce an ordered implementation plan with effort estimates
Present the blueprint to the user covering:
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
integration-architect agent -- it does not call MCP tools directly.| 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 |
這個技能可以幫助你設計 Uniswap 整合方案,文件清晰、步驟明確,輸出格式規範。優點是結構完整、考慮周全(有安全建議、依賴清單、實施順序);不足是依賴其他元件配合才能工作,目前版本較新,積累的案例和模板可能還不夠豐富。總體來說質量中上,但深度和實用性還有提升空間。