React Development (TypeScript)
Type-safe React patterns for React 18 and 19. Compile-time guarantees enable confident refactoring.
Key Patterns & Documentation
- references/react-19-patterns.md — React 19 forwardRef removal, useActionState, use()
- references/hooks.md — Type-safe useState, useRef, useReducer, useContext
- references/event-handlers.md — Typed event handlers (Mouse, Form, Keyboard)
- examples/generic-components.md — Generic Table and Component Patterns
- examples/server-components.md — Server Components, Actions, and async patterns
Vercel React Best Practices
Comprehensive performance optimization guide for React and Next.js applications, maintained by Vercel. Contains 58 rules across 8 categories, prioritized by impact to guide automated refactoring and code generation.
When to Apply
Reference these guidelines when:
- Writing new React components or Next.js pages
- Implementing data fetching (client or server-side)
- Reviewing code for performance issues
- Refactoring existing React/Next.js code
- Optimizing bundle size or load times
Rule Categories by Priority
| Priority |
Category |
Impact |
Prefix |
| 1 |
Eliminating Waterfalls |
CRITICAL |
async- |
| 2 |
Bundle Size Optimization |
CRITICAL |
bundle- |
| 3 |
Server-Side Performance |
HIGH |
server- |
| 4 |
Client-Side Data Fetching |
MEDIUM-HIGH |
client- |
| 5 |
Re-render Optimization |
MEDIUM |
rerender- |
| 6 |
Rendering Performance |
MEDIUM |
rendering- |
| 7 |
JavaScript Performance |
LOW-MEDIUM |
js- |
| 8 |
Advanced Patterns |
LOW |
advanced- |
Quick Reference
1. Eliminating Waterfalls (CRITICAL)
async-defer-await - Move await into branches where actually used
async-parallel - Use Promise.all() for independent operations
async-dependencies - Use better-all for partial dependencies
async-api-routes - Start promises early, await late in API routes
async-suspense-boundaries - Use Suspense to stream content
2. Bundle Size Optimization (CRITICAL)
bundle-barrel-imports - Import directly, avoid barrel files
bundle-dynamic-imports - Use next/dynamic for heavy components
bundle-defer-third-party - Load analytics/logging after hydration
bundle-conditional - Load modules only when feature is activated
bundle-preload - Preload on hover/focus for perceived speed
3. Server-Side Performance (HIGH)
server-auth-actions - Authenticate server actions like API routes
server-cache-react - Use React.cache() for per-request deduplication
server-cache-lru - Use LRU cache for cross-request caching
server-dedup-props - Avoid duplicate serialization in RSC props
server-hoist-static-io - Hoist static I/O (fonts, logos) to module level
server-serialization - Minimize data passed to client components
server-parallel-fetching - Restructure components to parallelize fetches
server-after-nonblocking - Use after() for non-blocking operations
4. Client-Side Data Fetching (MEDIUM-HIGH)
client-swr-dedup - Use SWR for automatic request deduplication
client-event-listeners - Deduplicate global event listeners
client-passive-event-listeners - Use passive listeners for scroll
client-localstorage-schema - Version and minimize localStorage data
5. Re-render Optimization (MEDIUM)
rerender-defer-reads - Don't subscribe to state only used in callbacks
rerender-memo - Extract expensive work into memoized components
rerender-memo-with-default-value - Hoist default non-primitive props
rerender-dependencies - Use primitive dependencies in effects
rerender-derived-state - Subscribe to derived booleans, not raw values
rerender-derived-state-no-effect - Derive state during render, not effects
rerender-functional-setstate - Use functional setState for stable callbacks
rerender-lazy-state-init - Pass function to useState for expensive values
rerender-simple-expression-in-memo - Avoid memo for simple primitives
rerender-move-effect-to-event - Put interaction logic in event handlers
rerender-transitions - Use startTransition for non-urgent updates
rerender-use-ref-transient-values - Use refs for transient frequent values
6. Rendering Performance (MEDIUM)
rendering-animate-svg-wrapper - Animate div wrapper, not SVG element
rendering-content-visibility - Use content-visibility for long lists
rendering-hoist-jsx - Extract static JSX outside components
rendering-svg-precision - Reduce SVG coordinate precision
rendering-hydration-no-flicker - Use inline script for client-only data
rendering-hydration-suppress-warning - Suppress expected mismatches
rendering-activity - Use Activity component for show/hide
rendering-conditional-render - Use ternary, not && for conditionals
rendering-usetransition-loading - Prefer useTransition for loading state
7. JavaScript Performance (LOW-MEDIUM)
js-batch-dom-css - Group CSS changes via classes or cssText
js-index-maps - Build Map for repeated lookups
js-cache-property-access - Cache object properties in loops
js-cache-function-results - Cache function results in module-level Map
js-cache-storage - Cache localStorage/sessionStorage reads
js-combine-iterations - Combine multiple filter/map into one loop
js-length-check-first - Check array length before expensive comparison
js-early-exit - Return early from functions
js-hoist-regexp - Hoist RegExp creation outside loops
js-min-max-loop - Use loop for min/max instead of sort
js-set-map-lookups - Use Set/Map for O(1) lookups
js-tosorted-immutable - Use toSorted() for immutability
8. Advanced Patterns (LOW)
advanced-event-handler-refs - Store event handlers in refs
advanced-init-once - Initialize app once per app load
advanced-use-latest - useLatest for stable callback refs
How to Use
Read individual rule files for detailed explanations and code examples:
rules/async-parallel.md
rules/bundle-barrel-imports.md
Each rule file contains:
- Brief explanation of why it matters
- Incorrect code example with explanation
- Correct code example with explanation
- Additional context and references
Full Compiled Document
For the complete guide with all rules expanded: AGENTS.md
React Composition Patterns
Composition patterns for building flexible, maintainable React components. Avoid
boolean prop proliferation by using compound components, lifting state, and
composing internals. These patterns make codebases easier for both humans and AI
agents to work with as they scale.
When to Apply
Reference these guidelines when:
- Refactoring components with many boolean props
- Building reusable component libraries
- Designing flexible component APIs
- Reviewing component architecture
- Working with compound components or context providers
Rule Categories by Priority
| Priority |
Category |
Impact |
Prefix |
| 1 |
Component Architecture |
HIGH |
architecture- |
| 2 |
State Management |
MEDIUM |
state- |
| 3 |
Implementation Patterns |
MEDIUM |
patterns- |
| 4 |
React 19 APIs |
MEDIUM |
react19- |
Quick Reference
1. Component Architecture (HIGH)
architecture-avoid-boolean-props - Don't add boolean props to customize
behavior; use composition
architecture-compound-components - Structure complex components with shared
context
2. State Management (MEDIUM)
state-decouple-implementation - Provider is the only place that knows how
state is managed
state-context-interface - Define generic interface with state, actions, meta
for dependency injection
state-lift-state - Move state into provider components for sibling access
3. Implementation Patterns (MEDIUM)
patterns-explicit-variants - Create explicit variant components instead of
boolean modes
patterns-children-over-render-props - Use children for composition instead
of renderX props
4. React 19 APIs (MEDIUM)
⚠️ React 19+ only. Skip this section if using React 18 or earlier.
react19-no-forwardref - Don't use forwardRef; use use() instead of useContext()
How to Use
Read individual rule files for detailed explanations and code examples:
rules/architecture-avoid-boolean-props.md
rules/state-context-interface.md
Each rule file contains:
- Brief explanation of why it matters
- Incorrect code example with explanation
- Correct code example with explanation
- Additional context and references
Full Compiled Document
For the complete guide with all rules expanded: AGENTS.md
1---2name: react-development-23domain: web-development4skill_type: skill5description: >-6 Type-safe React development with TypeScript covering components, hooks, events,7 Server Components, routing, performance optimization, and architectural best8 practices. Use when building React applications, optimizing rendering/bundle9 size, refactoring component APIs, or working with React 18/19 features. Triggers10 include "React component", "React performance", "Next.js optimization",11 "composition patterns", "Server Components", "React 19". Do NOT use for non-12 React TypeScript or vanilla JavaScript projects.13license: MIT14tags: [react, typescript, hooks, components, server-components, frontend, react-19, performance, architecture, nextjs]15metadata:16 source: https://skillmd.com/skills/knuckles-team/react-development-217 version: '1.6.0'18 author: Genius19---2021# React Development (TypeScript)2223Type-safe React patterns for React 18 and 19. Compile-time guarantees enable confident refactoring.2425---2627## Key Patterns & Documentation2829- [references/react-19-patterns.md](references/react-19-patterns.md) — React 19 forwardRef removal, useActionState, use()30- [references/hooks.md](references/hooks.md) — Type-safe useState, useRef, useReducer, useContext31- [references/event-handlers.md](references/event-handlers.md) — Typed event handlers (Mouse, Form, Keyboard)32- [examples/generic-components.md](examples/generic-components.md) — Generic Table and Component Patterns33- [examples/server-components.md](examples/server-components.md) — Server Components, Actions, and async patterns34---3536## Vercel React Best Practices3738Comprehensive performance optimization guide for React and Next.js applications, maintained by Vercel. Contains 58 rules across 8 categories, prioritized by impact to guide automated refactoring and code generation.3940## When to Apply4142Reference these guidelines when:43- Writing new React components or Next.js pages44- Implementing data fetching (client or server-side)45- Reviewing code for performance issues46- Refactoring existing React/Next.js code47- Optimizing bundle size or load times4849## Rule Categories by Priority5051| Priority | Category | Impact | Prefix |52|----------|----------|--------|--------|53| 1 | Eliminating Waterfalls | CRITICAL | `async-` |54| 2 | Bundle Size Optimization | CRITICAL | `bundle-` |55| 3 | Server-Side Performance | HIGH | `server-` |56| 4 | Client-Side Data Fetching | MEDIUM-HIGH | `client-` |57| 5 | Re-render Optimization | MEDIUM | `rerender-` |58| 6 | Rendering Performance | MEDIUM | `rendering-` |59| 7 | JavaScript Performance | LOW-MEDIUM | `js-` |60| 8 | Advanced Patterns | LOW | `advanced-` |6162## Quick Reference6364### 1. Eliminating Waterfalls (CRITICAL)6566- `async-defer-await` - Move await into branches where actually used67- `async-parallel` - Use Promise.all() for independent operations68- `async-dependencies` - Use better-all for partial dependencies69- `async-api-routes` - Start promises early, await late in API routes70- `async-suspense-boundaries` - Use Suspense to stream content7172### 2. Bundle Size Optimization (CRITICAL)7374- `bundle-barrel-imports` - Import directly, avoid barrel files75- `bundle-dynamic-imports` - Use next/dynamic for heavy components76- `bundle-defer-third-party` - Load analytics/logging after hydration77- `bundle-conditional` - Load modules only when feature is activated78- `bundle-preload` - Preload on hover/focus for perceived speed7980### 3. Server-Side Performance (HIGH)8182- `server-auth-actions` - Authenticate server actions like API routes83- `server-cache-react` - Use React.cache() for per-request deduplication84- `server-cache-lru` - Use LRU cache for cross-request caching85- `server-dedup-props` - Avoid duplicate serialization in RSC props86- `server-hoist-static-io` - Hoist static I/O (fonts, logos) to module level87- `server-serialization` - Minimize data passed to client components88- `server-parallel-fetching` - Restructure components to parallelize fetches89- `server-after-nonblocking` - Use after() for non-blocking operations9091### 4. Client-Side Data Fetching (MEDIUM-HIGH)9293- `client-swr-dedup` - Use SWR for automatic request deduplication94- `client-event-listeners` - Deduplicate global event listeners95- `client-passive-event-listeners` - Use passive listeners for scroll96- `client-localstorage-schema` - Version and minimize localStorage data9798### 5. Re-render Optimization (MEDIUM)99100- `rerender-defer-reads` - Don't subscribe to state only used in callbacks101- `rerender-memo` - Extract expensive work into memoized components102- `rerender-memo-with-default-value` - Hoist default non-primitive props103- `rerender-dependencies` - Use primitive dependencies in effects104- `rerender-derived-state` - Subscribe to derived booleans, not raw values105- `rerender-derived-state-no-effect` - Derive state during render, not effects106- `rerender-functional-setstate` - Use functional setState for stable callbacks107- `rerender-lazy-state-init` - Pass function to useState for expensive values108- `rerender-simple-expression-in-memo` - Avoid memo for simple primitives109- `rerender-move-effect-to-event` - Put interaction logic in event handlers110- `rerender-transitions` - Use startTransition for non-urgent updates111- `rerender-use-ref-transient-values` - Use refs for transient frequent values112113### 6. Rendering Performance (MEDIUM)114115- `rendering-animate-svg-wrapper` - Animate div wrapper, not SVG element116- `rendering-content-visibility` - Use content-visibility for long lists117- `rendering-hoist-jsx` - Extract static JSX outside components118- `rendering-svg-precision` - Reduce SVG coordinate precision119- `rendering-hydration-no-flicker` - Use inline script for client-only data120- `rendering-hydration-suppress-warning` - Suppress expected mismatches121- `rendering-activity` - Use Activity component for show/hide122- `rendering-conditional-render` - Use ternary, not && for conditionals123- `rendering-usetransition-loading` - Prefer useTransition for loading state124125### 7. JavaScript Performance (LOW-MEDIUM)126127- `js-batch-dom-css` - Group CSS changes via classes or cssText128- `js-index-maps` - Build Map for repeated lookups129- `js-cache-property-access` - Cache object properties in loops130- `js-cache-function-results` - Cache function results in module-level Map131- `js-cache-storage` - Cache localStorage/sessionStorage reads132- `js-combine-iterations` - Combine multiple filter/map into one loop133- `js-length-check-first` - Check array length before expensive comparison134- `js-early-exit` - Return early from functions135- `js-hoist-regexp` - Hoist RegExp creation outside loops136- `js-min-max-loop` - Use loop for min/max instead of sort137- `js-set-map-lookups` - Use Set/Map for O(1) lookups138- `js-tosorted-immutable` - Use toSorted() for immutability139140### 8. Advanced Patterns (LOW)141142- `advanced-event-handler-refs` - Store event handlers in refs143- `advanced-init-once` - Initialize app once per app load144- `advanced-use-latest` - useLatest for stable callback refs145146## How to Use147148Read individual rule files for detailed explanations and code examples:149150```151rules/async-parallel.md152rules/bundle-barrel-imports.md153```154155Each rule file contains:156- Brief explanation of why it matters157- Incorrect code example with explanation158- Correct code example with explanation159- Additional context and references160161## Full Compiled Document162163For the complete guide with all rules expanded: `AGENTS.md`164## React Composition Patterns165166Composition patterns for building flexible, maintainable React components. Avoid167boolean prop proliferation by using compound components, lifting state, and168composing internals. These patterns make codebases easier for both humans and AI169agents to work with as they scale.170171## When to Apply172173Reference these guidelines when:174175- Refactoring components with many boolean props176- Building reusable component libraries177- Designing flexible component APIs178- Reviewing component architecture179- Working with compound components or context providers180181## Rule Categories by Priority182183| Priority | Category | Impact | Prefix |184| -------- | ----------------------- | ------ | --------------- |185| 1 | Component Architecture | HIGH | `architecture-` |186| 2 | State Management | MEDIUM | `state-` |187| 3 | Implementation Patterns | MEDIUM | `patterns-` |188| 4 | React 19 APIs | MEDIUM | `react19-` |189190## Quick Reference191192### 1. Component Architecture (HIGH)193194- `architecture-avoid-boolean-props` - Don't add boolean props to customize195 behavior; use composition196- `architecture-compound-components` - Structure complex components with shared197 context198199### 2. State Management (MEDIUM)200201- `state-decouple-implementation` - Provider is the only place that knows how202 state is managed203- `state-context-interface` - Define generic interface with state, actions, meta204 for dependency injection205- `state-lift-state` - Move state into provider components for sibling access206207### 3. Implementation Patterns (MEDIUM)208209- `patterns-explicit-variants` - Create explicit variant components instead of210 boolean modes211- `patterns-children-over-render-props` - Use children for composition instead212 of renderX props213214### 4. React 19 APIs (MEDIUM)215216> **⚠️ React 19+ only.** Skip this section if using React 18 or earlier.217218- `react19-no-forwardref` - Don't use `forwardRef`; use `use()` instead of `useContext()`219220## How to Use221222Read individual rule files for detailed explanations and code examples:223224```225rules/architecture-avoid-boolean-props.md226rules/state-context-interface.md227```228229Each rule file contains:230231- Brief explanation of why it matters232- Incorrect code example with explanation233- Correct code example with explanation234- Additional context and references235236## Full Compiled Document237238For the complete guide with all rules expanded: `AGENTS.md`