react-patterns
Original:🇺🇸 English
Translated
React and Next.js performance optimization guidelines from Vercel Engineering, tuned for local/offline or docker-deployed apps.
10installs
Sourcesrbhr/resume-matcher
Added on
NPX Install
npx skill4agent add srbhr/resume-matcher react-patternsTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →Vercel React Best Practices (Local/Docker)
Comprehensive performance optimization guide for React and Next.js applications, maintained by Vercel. This version highlights the most important patterns for local installs or dockerized deployments.
Purpose
Provide a high-signal checklist to avoid async waterfalls, reduce client payloads, and keep UI responsive without relying on hosted or edge-specific optimizations.
When to Apply
- Building or refactoring React components or Next.js pages
- Implementing Server Actions, Route Handlers, or data fetching
- Reducing startup time or memory footprint for local installs
- Debugging sluggish UI or long hydration times
- Reviewing code for performance regressions
Offline and Docker Focus
- Optimize for cold-start and steady-state responsiveness over SEO.
- Use in-process caches because the server process persists.
- Avoid sequential awaits even for local APIs or databases.
- Defer non-critical work until after render or after responses are sent.
- Minimize RSC props to reduce hydration and memory overhead.
Top Findings
- Eliminate async waterfalls by starting work early and awaiting late with or
Promise.all.better-all - Use Suspense boundaries to stream UI instead of blocking the whole page on data.
- Reduce initial load and memory via dynamic imports, conditional loading, and direct imports.
- Minimize RSC payloads; pass only fields used and avoid duplicating serialized data.
- Cache hot server work: per request and LRU for cross-request reuse.
React.cache - Reduce client work with memoized subtrees, lazy state init, transitions, and for large lists.
content-visibility
Core Patterns
- and
async-parallelto eliminate waterfallsasync-api-routes - to stream slow sections
async-suspense-boundaries - and
bundle-barrel-importsto reduce startup costbundle-dynamic-imports - and
server-serializationto shrink RSC payloadsserver-dedup-props - and
server-cache-reactto reuse hot workserver-cache-lru - and
rerender-lazy-state-initfor responsive UIrerender-transitions - for long lists
rendering-content-visibility - for fetch deduplication
client-swr-dedup
Outputs
- for a condensed, offline-focused guide
REACT_PATTERNS.md - for the full compiled reference
AGENT.md
Rule Categories by Priority
| Priority | Category | Impact | Prefix |
|---|---|---|---|
| 1 | Eliminating Waterfalls | CRITICAL | |
| 2 | Bundle Size Optimization | CRITICAL | |
| 3 | Server-Side Performance | HIGH | |
| 4 | Client-Side Data Fetching | MEDIUM-HIGH | |
| 5 | Re-render Optimization | MEDIUM | |
| 6 | Rendering Performance | MEDIUM | |
| 7 | JavaScript Performance | LOW-MEDIUM | |
| 8 | Advanced Patterns | LOW | |
How to Use
Start with for the condensed guidance.
REACT_PATTERNS.mdFull Compiled Document
For the complete guide with all rules expanded:
AGENT.md