.agents/skills/how-to-write-component/references/data.md
Read this document when a component consumes generated contracts, nullable API values, TanStack Query, mutations, prefetching, authentication, or workspace state.
packages/contracts/generated/enterprise/*.{ params, query?, body? } input shape; when it is wrong, fix the backend schema and regenerate packages/contracts/generated/*.null, undefined, and intentional empty strings until the final boundary. Do not use value || undefined when an empty string means clearing a field.filter(Boolean), truthiness filters, non-null assertions after filters, and placeholder values used only to satisfy types.useQuery(consoleQuery.xxx.queryOptions(...)), marketplaceQuery, or the equivalent generated client.atomWithQuery; do not unwrap the atom in a component solely to call useQuery.skipToken. Add enabled only for an independent execution condition; do not put skipToken inside a placeholder payload or coerce IDs to empty strings.queryOptions(), infiniteOptions(), or mutationOptions() directly from TanStack Query atoms. Pass supported options into the generated call instead of spreading into a parallel object.mutationOptions() directly for owner-local mutations.createTanstackQueryUtils(...experimental_defaults...). Local callbacks may own toast, close, and navigation effects but must not replace shared cache policy.mutate(...). Use mutateAsync(...) only when Promise composition is required, and catch awaited failures.prefetchQuery is cache warmup, not an authorization or availability gate. Use a hard fetch boundary when the server must decide whether rendering may proceed.