.agents/skills/frontend-code-review/references/data-query-contracts.md
Use these rules for generated contracts, TanStack Query, mutations, auth/SSR boundaries, URL state, and client persistence.
Flag:
queryOptions() or mutationOptions().Use web/contract/* as the API shape source of truth. Follow existing { params, query?, body? } input shape.
Flag:
enabled used to hide missing required input instead of input: skipToken.prefetchQuery treated as a hard gate or as returning data/errors to the caller.Use useQuery(consoleQuery.xxx.queryOptions(...)) or useQuery(marketplaceQuery.xxx.queryOptions(...)) directly unless a feature hook performs real orchestration.
Flag:
useInvalid or useReset.mutateAsync used without a need for Promise semantics.try/catch.Use generated mutationOptions() directly when possible. Put shared cache behavior in createTanstackQueryUtils(...experimental_defaults...).
Flag:
next.config redirects().workspaces.current implemented as static path redirects.prefetchQuery.Separate hard gates from soft prefetches. fetchQuery can be a server decision boundary; prefetchQuery is cache warmup.
Flag:
workspace_id and tenant_id without tracing the current backend/API contract.Current Dify workspace switch should be reviewed as a tenant cache boundary first.
Flag:
window.localStorage, globalThis.localStorage, or raw storage calls in app code.Use URL state for shareable UI state, feature/Jotai/store state for live UI state, and @/hooks/use-local-storage only for low-frequency client-only preferences, dismissed notices, and UI defaults.