Guide for implementing Dify frontend query and mutation patterns with TanStack Query and oRPC. Trigger when creating or updating contracts in web/contract, wiring router composition, consuming consoleQuery or marketplaceQuery in components or services, deciding whether to call queryOptions() directly or extract a helper or use-* hook, handling conditional queries, cache invalidation, mutation error handling, or migrating legacy service calls to contract-first query and mutation helpers.
web/contract/*.queryOptions() and mutationOptions().references/contract-patterns.md for contract files, router composition, client helpers, and query or mutation call-site shape.references/runtime-rules.md for conditional queries, invalidation, error handling, and legacy migrations.useQuery(...) or useMutation(...) calls with oRPC helpers at the call site.web/service/use-{domain}.ts only for orchestration or shared domain behavior.{ params, query?, body? } shape.mutate(...); use mutateAsync(...) only when Promise semantics are required.web/contract/console/*.tsweb/contract/marketplace.tsweb/contract/router.tsweb/service/client.tsweb/service/use-*.tsconsoleQuery or marketplaceQueryreferences/contract-patterns.md for contract shape, router registration, query and mutation helpers, and anti-patterns that degrade inference.references/runtime-rules.md for conditional queries, invalidation, mutate versus mutateAsync, and legacy migration rules.Treat this skill as the single query and mutation entry point for Dify frontend work. Keep detailed rules in the reference files instead of duplicating them in project docs.