jgamaraalv/ts-dev-kit/react-best-practices

Claude Code and agent skill by jgamaraalv/ts-dev-kit

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

React and Next.js performance patterns. Use when writing, reviewing, or optimizing React components.

Install

npx vskill@latest install jgamaraalv/ts-dev-kit/react-best-practices

SKILL.md

React & Next.js Performance Patterns

Performance optimization guide for React and Next.js applications, based on Vercel Engineering practices. 8 categories organized by impact.

<constraints>

When to Apply

  • Writing new React components or Next.js pages
  • Implementing data fetching (client or server-side)
  • Reviewing code for performance issues
  • Optimizing bundle size or load times

</constraints>

<references>

Quick Reference

1. Async Patterns (CRITICAL)

references/async-patterns.md

  • Prevent waterfall chains in API routes -- start promises early, await late
  • Defer await until needed -- move await into branches that use it
  • Dependency-based parallelization -- Promise.all() with .then() chaining
  • Strategic Suspense boundaries -- stream content with <Suspense>
2. Bundle Optimization (CRITICAL)

references/bundle-optimization.md

  • Avoid barrel file imports -- import directly from source files
  • Conditional module loading -- load only when feature is activated
  • Defer non-critical third-party libraries -- load after hydration
  • Dynamic imports for heavy components -- next/dynamic with ssr: false
  • Preload on user intent -- preload on hover/focus
3. Server-Side Performance (HIGH)

references/server-performance.md

  • after() for non-blocking operations -- logging, analytics after response
  • Authenticate Server Actions -- treat as public endpoints
  • Cross-request LRU caching -- share data across sequential requests
  • React.cache() deduplication -- per-request with primitive args
  • Avoid duplicate RSC serialization -- transform in client, not server
  • Parallel fetching via composition -- restructure component tree
  • Minimize serialization at boundaries -- pass only needed fields
4. Client-Side Patterns (MEDIUM-HIGH)

references/client-patterns.md

  • Deduplicate global event listeners -- useSWRSubscription
  • Version and minimize localStorage -- schema versioning, try-catch
  • Passive event listeners -- { passive: true } for scroll performance
  • SWR for automatic deduplication -- caching and revalidation
5. Re-render Optimization (MEDIUM)

references/rerender-optimization.md

  • Defer state reads to usage point -- read in callbacks, not render
  • Narrow effect dependencies -- use primitives, not objects
  • Derive state during render -- no state + effect for computed values
  • Functional setState -- stable callbacks, no stale closures
  • Hoist default non-primitive props -- stable defaults for memo()
  • Extract to memoized components -- skip computation with early returns
  • Interaction logic in event handlers -- not state + effect
  • useRef for transient values -- avoid re-render on frequent updates
6. Rendering Performance (MEDIUM)

references/rendering-performance.md

  • Animate SVG wrapper -- hardware-accelerated CSS on <div>, not <svg>
  • CSS content-visibility: auto -- defer off-screen rendering
  • Hoist static JSX -- extract constants outside components
  • Prevent hydration mismatch -- inline script for client-only data
  • useTransition over manual loading states -- built-in pending state
7. JavaScript Performance (LOW-MEDIUM)

references/js-performance.md

  • Avoid layout thrashing -- batch DOM reads and writes
  • Cache repeated function calls -- module-level Map
  • Cache storage API calls -- in-memory cache for localStorage/cookies
  • Build index Maps for lookups -- O(1) instead of O(n) .find()
  • Loop for min/max -- O(n) instead of O(n log n) sort
8. Advanced Patterns (LOW)

references/advanced-patterns.md

  • Store event handlers in refs -- stable effect subscriptions
  • Initialize app once per load -- module-level guard

</references>

Security

  • Security scanPassed, 90 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
12
Repository npm downloads, 7 days
13
7-day trend score
28

Stars and forks are for the whole GitHub repository, not this skill alone. Downloads are for the repository's npm package. Refreshed 24 Mar 2026, 8 months ago.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/jgamaraalv/ts-dev-kit/react-best-practices/badge)](https://verified-skill.com/skills/jgamaraalv/ts-dev-kit/react-best-practices)

Something wrong with this skill or its page? Tell us.