back
loading skill details...
Guide for implementing oRPC contract-first API patterns in Dify frontend. Trigger when creating or updating contracts in web/contract, wiring router…
Contract-first API patterns for Dify frontend using oRPC with TanStack Query integration.
Define contracts in web/contract/* as single source of truth; consume via useQuery(consoleQuery.xxx.queryOptions(...)) at call sites for 1:1 endpoint mappings
Use .key() for partial matching in invalidation/refetch, .queryKey() for specific query identity, and .mutationKey() for mutation defaults or status filtering
Extract queryOptions helpers only when 3+ call sites share identical options; create use-* hooks only for multi-query orchestration or domain-level derived state
Follow input structure { params, query?, body? } in contracts; omit .input(...) for GET endpoints without input; group router nesting by API prefix
oRPC Contract-First Development
Intent
Keep contract as single source of truth in web/contract/*.
Default query usage: call-site useQuery(consoleQuery|marketplaceQuery.xxx.queryOptions(...)) when endpoint behavior maps 1:1 to the contract.
Keep abstractions minimal and preserve TypeScript inference.
Minimal Structuredon't have the plugin yet? install it then click "run inline in claude" again.