react-performance
React performance optimization patterns including memoization, code splitting, bundle size reduction, re-render elimination, and profiling. Covers React Compiler automatic optimization, manual memo/useMemo/useCallback targeting, React.lazy with Suspense, barrel file avoidance, content-visibility for large lists, startTransition for non-urgent updates, and React DevTools profiling. Use when optimizing React app performance, reducing bundle size, eliminating unnecessary re-renders, debugging slow components, code splitting, or profiling rendering bottlenecks. Use for performance audit, bundle analysis, re-render diagnosis, lazy loading, virtualization.
What this skill does
# React Performance ## Overview Dedicated performance optimization skill for React applications. Covers the full spectrum from build-time optimizations (code splitting, barrel file avoidance) through runtime techniques (memoization, transitions, content-visibility) to diagnostic tooling (React DevTools Profiler, bundle analyzers). **When to use:** Reducing Time to Interactive, shrinking bundle size, eliminating re-renders, profiling slow components, optimizing large lists, lazy loading heavy dependencies, auditing React app performance. **When NOT to use:** General React component patterns (use `react-patterns` skill), framework-specific optimizations like Next.js caching (use framework skill), non-React performance (network, database, CDN). ## Quick Reference | Category | Technique | Key Points | | ----------- | ---------------------------- | ------------------------------------------------------------------------------------- | | Compiler | React Compiler | Automatic memoization at build time; eliminates manual memo/useMemo/useCallback | | Memoization | `React.memo(Component)` | Wrap components receiving stable primitive props from frequently re-rendering parents | | Memoization | `useMemo(fn, deps)` | Expensive computations only: sorting, filtering, Set/Map construction | | Memoization | `useCallback(fn, deps)` | Only when passed to memoized children; use functional setState for stable refs | | Splitting | `React.lazy(() => import())` | Lazy-load heavy components with `<Suspense>` fallback | | Splitting | Preload on intent | Trigger `import()` on hover/focus for perceived speed | | Bundle | Direct imports | Avoid barrel files; import from specific paths to reduce module count | | Bundle | Defer third-party | Load analytics, logging after hydration | | Re-renders | `startTransition` | Mark non-urgent updates (search, scroll tracking) as interruptible | | Re-renders | Functional setState | `setState(prev => ...)` eliminates state dependencies from callbacks | | Re-renders | Derived state | Subscribe to booleans, not continuous values; compute during render | | Re-renders | Defer state reads | Read dynamic state (searchParams) inside callbacks, not at render | | Rendering | `content-visibility: auto` | Skip layout/paint for off-screen items in long lists | | Rendering | Hoist static JSX | Extract constant elements outside component functions | | Profiling | React DevTools Profiler | Record renders, identify slow components, flamegraph analysis | | Profiling | Bundle analyzer | Visualize chunk sizes, find oversized dependencies | ## Common Mistakes | Mistake | Correct Pattern | | ------------------------------------------------------------------ | ------------------------------------------------------------------------------------------- | | Wrapping everything in useMemo/useCallback | Trust React Compiler first; only memoize expensive computations or memoized-child callbacks | | Memoizing cheap operations like `value * 2` | Skip memo for simple primitives; overhead exceeds recomputation cost | | Importing from barrel files (`lucide-react`, `@mui/material`) | Import directly from specific paths or use `optimizePackageImports` | | Loading analytics/tracking in the initial bundle | Defer with lazy + mounted state to load after hydration | | Subscribing to continuous values (window width) for boolean checks | Use `useMediaQuery` or derived boolean to re-render only on threshold change | | Referencing state in useCallback dependency array | Use functional setState `setState(prev => ...)` for stable callbacks | | Using `useEffect` to derive state from props | Compute derived values during render; effects add an extra render cycle | | Creating new object literals as props on every render | Hoist static objects outside component; use useMemo for dynamic objects | | Profiling in development mode | Always profile production builds; dev mode includes extra warnings that skew results | ## Delegation - **Profile and diagnose performance bottlenecks**: Use `Explore` agent to run React DevTools Profiler, analyze bundle composition, and trace re-render cascades - **Apply performance optimizations to existing code**: Use `Task` agent to implement code splitting, add memoization boundaries, and optimize rendering - **Plan performance improvement strategy**: Use `Plan` agent to prioritize optimizations by impact (waterfalls > bundle > re-renders) and create an optimization roadmap > If the `react-patterns` skill is available, delegate general component architecture and React 19 API questions to it. > Otherwise, recommend: `npx skills add oakoss/agent-skills --skill react-patterns` ## References - [Rendering optimization: memo, useMemo, useCallback, compiler, re-render elimination](references/rendering-optimization.md) - [Code splitting: React.lazy, Suspense, dynamic imports, bundle optimization](references/code-splitting.md) - [Profiling and debugging: DevTools, performance measurement, common bottlenecks](references/profiling-and-debugging.md)
Related in Image & Video
watch
IncludedWatch a video (URL or local path). Downloads with yt-dlp, extracts auto-scaled frames with ffmpeg, pulls the transcript from captions (or Whisper API fallback), and hands the result to Claude so it can answer questions about what's in the video.
physical-ai-defect-image-generation
IncludedUse when the user wants to orchestrate defect image generation, run associated setup, or handle outputs on OSMO. The Day 0 path handles cold-start with USD-to-ROI, image-edit augmentation, and AnomalyGen to create initial PCBA datasets. The Day 1 path performs inference and labeling on real images. This skill helps with first-time asset setup, creation of finetuning checkpoints, and configuring deployment. Trigger keywords: defect image generation, dig workflow, dig pipeline, defect image detection workflow, aoi pipeline, aoi anomalygen, usd2roi anomalygen, day 0 pcba, day 1 pcba, day 1 real-photo alignment, day 1 manual roi, metal surface anomaly, glass defect, anomalygen finetune, setup_pcb, setup_metal, setup_glass, setup_pretrained, dig setup, dig datasets, dig pretrained checkpoint, dig image-edit endpoint.
accelint-react-best-practices
IncludedReact performance optimization and best practices. ALWAYS use this skill when working with any React code - writing components, hooks, JSX; refactoring; optimizing re-renders, memoization, state management; reviewing for performance; fixing hydration mismatches; debugging infinite re-renders, stale closures, input focus loss, animations restarting; preventing remounting; implementing transitions, lazy initialization, effect dependencies. Even simple React tasks benefit from these patterns. Covers React 19+ (useEffectEvent, Activity, ref props). Triggers - useEffect, useState, useMemo, useCallback, memo, inline components, nested components, components inside components, re-render, performance, hydration, SSR, Next.js, useDeferredValue, combined hooks.
elevenlabs-agents
IncludedBuild conversational AI voice agents with ElevenLabs Platform using React, JavaScript, React Native, or Swift SDKs. Configure agents, tools (client/server/MCP), RAG knowledge bases, multi-voice, and Scribe real-time STT. Use when: building voice chat interfaces, implementing AI phone agents with Twilio, configuring agent workflows or tools, adding RAG knowledge bases, testing with CLI "agents as code", or troubleshooting deprecated @11labs packages, Android audio cutoff, CSP violations, dynamic variables, or WebRTC config. Keywords: ElevenLabs Agents, ElevenLabs voice agents, AI voice agents, conversational AI, @elevenlabs/react, @elevenlabs/client, @elevenlabs/react-native, @elevenlabs/elevenlabs-js, @elevenlabs/agents-cli, elevenlabs SDK, voice AI, TTS, text-to-speech, ASR, speech recognition, turn-taking model, WebRTC voice, WebSocket voice, ElevenLabs conversation, agent system prompt, agent tools, agent knowledge base, RAG voice agents, multi-voice agents, pronunciation dictionary, voice speed control, elevenlabs scribe, @11labs deprecated, Android audio cutoff, CSP violation elevenlabs, dynamic variables elevenlabs, case-sensitive tool names, webhook authentication
humanizer
IncludedHumanize AI-generated text by detecting and removing patterns typical of LLM output. Rewrites text to sound natural, specific, and human. Uses 28 pattern detectors, 560+ AI vocabulary terms across 3 tiers, and statistical analysis (burstiness, type-token ratio, readability) for comprehensive detection. Use when asked to humanize text, de-AI writing, make content sound more natural/human, review writing for AI patterns, score text for AI detection, or improve AI-generated drafts. Covers content, language, style, communication, and filler categories.
generating-mermaid-diagrams
IncludedSalesforce architecture diagrams using Mermaid with ASCII fallback. Use this skill when generating text-based diagrams for Salesforce architecture, OAuth flows, ERDs, integration sequences, or Agentforce structure. TRIGGER when: user says "diagram", "visualize", "ERD", or asks for sequence diagrams, flowcharts, class diagrams, or architecture visualizations in Mermaid. DO NOT TRIGGER when: user wants PNG/SVG image output (use generating-visual-diagrams), or asks about non-Salesforce systems.