Loading...
Loading...
Use this skill whenever building, reviewing, or refactoring React components that fetch data from APIs — especially at scale (recommender carousels, infinite feeds, pages with many parallel fetches, dashboards). Covers request orchestration (parallelism, batching, deduplication), cache strategy (keys, normalization, staleTime, SWR), backend protection (concurrency caps, debounce/throttle, jittered retries, circuit breakers), prefetching (route loaders, hover/intent, idle, server hydration), failure resilience (AbortController, timeouts, error boundaries, stale fallback, idempotent mutations), and feed/carousel patterns (virtualization, cursor pagination, summary/detail split). Trigger even if the user doesn't explicitly mention "performance" or "scale" — any non-trivial React data-fetching code benefits from these patterns. Includes 5 ready-to-use scaffolding templates (resource query hook, carousel data loader, infinite feed, hover-prefetch link, request collapser).
npx skill4agent add pproenca/dot-skills react-fetch-cache-patternsfetchuseQueryuseSWR| # | Category | Impact | Prefix | Rules |
|---|---|---|---|---|
| 1 | Request Orchestration | CRITICAL | | 7 |
| 2 | Cache Strategy | CRITICAL | | 7 |
| 3 | Backend Protection | CRITICAL | | 7 |
| 4 | Prefetch & Hydration | HIGH | | 6 |
| 5 | Failure Resilience | HIGH | | 6 |
| 6 | Feed & Carousel Patterns | MEDIUM-HIGH | | 7 |
| 7 | Mutation & Invalidation | MEDIUM | | 4 |
| 8 | Component Patterns | MEDIUM | | 4 |
orch-parallelize-independent-fetchesPromise.allawaitorch-batch-n-plus-one-fanoutorch-dedupe-in-flight-requestsorch-lift-fetch-to-route-loaderorch-avoid-effect-chainsorch-server-fetch-when-possibleorch-prefer-bulk-endpoint-for-fanoutcache-deterministic-keyscache-normalize-shared-entitiescache-set-stale-timestaleTimecache-stale-while-revalidatecache-select-subscribed-fieldscache-shared-key-factorycache-tiered-stale-freshstaleTimeprotect-concurrency-limit-fanoutp-limitprotect-collapse-identical-requestsprotect-debounce-user-driven-fetchesprotect-throttle-scroll-triggeredprotect-jittered-retry-backoffprotect-circuit-breakerprotect-rate-limit-aware-clientRetry-AfterX-RateLimit-*prefetch-hover-intent-linksprefetch-parallel-loader-queriesprefetch-hydrate-server-cacheHydrationBoundaryprefetch-idle-likely-nextrequestIdleCallbackprefetch-viewport-triggered-next-pagerootMarginprefetch-budget-and-prioritySave-Dataresilience-abort-on-unmountAbortSignalresilience-bounded-timeoutsAbortSignal.timeout()resilience-scoped-error-boundariesresilience-stale-fallbackresilience-no-auto-retry-mutationsresilience-graceful-degradationfeed-virtualize-long-listsfeed-cursor-paginationfeed-split-summary-from-detailfeed-multi-carousel-isolationfeed-stable-keys-across-pagesfeed-image-lazy-and-sizedloading="lazy"feed-bounded-working-setmaxPagesmutate-optimistic-updates-with-rollbackmutate-surgical-invalidationmutate-set-data-over-invalidatemutate-cancel-queries-on-mutaterender-stable-query-keysuseMemorender-cap-fanout-in-listsrender-suspense-per-sectionrender-colocate-fetch-with-consumeruseQueryassets/templates/| Template | Library deps | Purpose |
|---|---|---|
| TanStack Query | Standard query hook with key factory, retry, abort, optional suspense |
| None (pure React + AbortController) | Same patterns as above, library-free: hand-rolled cache, dedup, retry with jitter, staleTime/gcTime, concurrency limit |
| TanStack Query + react-error-boundary | Single carousel (summary + viewport-triggered detail) and multi-carousel feed with per-carousel failure isolation |
| TanStack Query + TanStack Virtual | Cursor-paginated infinite feed with virtualization and bounded working set |
| None | Hover/intent prefetch link wrapper |
| None | In-flight deduplication + concurrency limit utility |
use-resource-query-no-deps.template.tsxrequest-collapserprefetch-link| File | Description |
|---|---|
| references/_sections.md | Category definitions, ordering, impact rationale |
| assets/templates/_template.md | Template for authoring new rules |
| metadata.json | Version, references, abstract |
react-optimisenextjs-bundle-optimizerinngest-nextjs-patterns