skills/react-vite-best-practices/SKILL.md
Improve React applications built with Vite. Use this whenever the user mentions Vite, `vite.config.*`, bundle size, slow builds, slow dev server startup, broken or slow HMR/Fast Refresh, route or component lazy loading, `React.lazy`, `Suspense`, manual chunks, dependency prebundling, asset loading, tree shaking, or asks for performance/review help on a React + Vite codebase even if they do not explicitly ask for "best practices."
npx skillsauth add cenjie/skills react-vite-best-practicesInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Use this skill to make React + Vite changes that are measurably better, not just conventionally tidy. Focus on the user's actual bottleneck first: production bundle size, runtime performance, startup/build speed, or dev-loop friction.
Use it when the request involves any of these:
vite.config.ts, vite.config.js, or plugin setupReact.lazy, Suspense, dynamic imports, or route-level splittingimport.meta.envDo not use this skill for generic React work that does not involve Vite, build tooling, or performance-sensitive frontend delivery.
Classify the task before editing:
perf: core performance issues (barrel files, plugin performance, import resolution, file warmup, native tooling)build: production bundle size, chunking, caching, minification, sourcemapssplit: route/component lazy loading, dynamic imports, chunk boundariesdev: startup time, dependency prebundling, dev server responsivenesshmr: Fast Refresh resets, full reloads, HMR misconfigurationasset: images, fonts, SVG strategy, static assetsenv: import.meta.env, VITE_ usage, mode-specific configbundle: tree shaking, dependency weight, visualizer-driven cleanupIf multiple categories apply, handle them in this order:
Look for the relevant files first:
vite.config.*package.jsonsrc/main.*vite-env.d.tsWhen reviewing, call out the concrete problem you found, such as:
import.meta.env misusePrefer changes that map directly to the symptom:
optimizeDeps tuning, plugin cleanup, fewer unnecessary transformsWhen proposing or applying a change, explain the tradeoff in one sentence:
Do not present an optimization as free if it increases complexity or shifts cost elsewhere.
Use these defaults unless the repo context suggests otherwise:
vite-plugin-svgr only when SVGs need component behaviorimport.meta.env when env vars are part of app logicOpen only the files relevant to the current task.
rules/build-manual-chunks.mdrules/build-chunk-strategy.mdrules/build-code-splitting.mdrules/build-minification.mdrules/build-minify-terser.mdrules/build-target-modern.mdrules/build-sourcemaps.mdrules/build-asset-hashing.mdrules/build-compression.mdrules/build-tree-shaking.mdrules/build-vendor-splitting.mdrules/bundle-tree-shaking.mdrules/split-route-lazy.mdrules/split-lazy-routes.mdrules/split-component-lazy.mdrules/split-dynamic-imports.mdrules/split-suspense-boundaries.mdrules/split-prefetch-hints.mdrules/split-library-chunks.mdrules/dev-dependency-prebundling.mdrules/dev-fast-refresh.mdrules/dev-hmr-config.mdrules/hmr-fast-refresh.mdrules/asset-image-optimization.mdrules/asset-svg-components.mdrules/env-vite-prefix.mdrules/perf-avoid-barrel-files.mdrules/perf-plugin-audit.mdrules/perf-resolve-operations.mdrules/perf-warmup-files.mdrules/perf-native-tooling.mdrules/perf-browser-setup.mdWhen using this skill, structure the output around the current task:
Avoid these common mistakes:
manualChunks without checking actual dependency usagevite.config.ts and make the build output saner?"import.meta.env.MY_API_URL undefined in production?"If you need detailed examples, open the matching rule files in rules/ rather than expanding this file with long embedded code samples.
development
Provides React Native performance optimization guidelines for FPS, TTI, bundle size, memory leaks, re-renders, and animations. Applies to tasks involving Hermes optimization, JS thread blocking, bridge overhead, FlashList, native modules, or debugging jank and frame drops.
development
Design engineering principles for making interfaces feel polished. Use when building UI components, reviewing frontend code, implementing animations, hover states, shadows, borders, typography, micro-interactions, enter/exit animations, or any visual detail work. Triggers on UI polish, design details, "make it feel better", "feels off", stagger animations, border radius, optical alignment, font smoothing, tabular numbers, image outlines, box shadows.
development
General-purpose Static Application Security Testing (SAST) skill for code vulnerability analysis. Trigger when the user asks to: "analyze code for vulnerabilities", "review code security", "find security bugs", "do a SAST scan", "check for [vulnerability type] in code", "audit source code", or requests a security code review of any language or framework. Covers 34 vulnerability classes across web, API, auth, mobile, and logic layers.
tools
Helps understand and write EAS workflow YAML files for Expo projects. Use this skill when the user asks about CI/CD or workflows in an Expo or EAS context, mentions .eas/workflows/, or wants help with EAS build pipelines or deployment automation.