Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
asyrafhussin avatar

React Vite Best Practices

  • 1.9k installs
  • 58 repo stars
  • Updated May 16, 2026
  • asyrafhussin/agent-skills

react-vite-best-practices is an agent skill for React and Vite performance optimization guidelines. Use when writing, reviewing, or optimizing React components built with Vite. Triggers on tasks involving Vite configurat

About

React and Vite performance optimization guidelines Use when writing reviewing or optimizing React components built with Vite Triggers on tasks involving Vite configuration build optimization code splitting lazy loading HMR bundle size or React performance The react-vite-best-practices skill documents workflows and patterns from the repository SKILL md name react-vite-best-practices description React and Vite performance optimization guidelines Use when writing reviewing or optimizing React components built with Vite Triggers on tasks involving Vite configuration build optimization code splitting lazy loading HMR bundle size or React performance license MIT metadata author agent-skills version 2 0 0 React Vite Best Practices Comprehensive performance optimization guide for React applications built with Vite Contains 23 rules across 6 categories for build optimization code splitting development performance asset handling environment configuration and bundle analysis Metadata Version 2 0 0 Framework React Vite Rule Count 23 rules across 6 categories License MIT When to Apply Reference these guidelines when Configuring Vite for React projects Implementing code splitting and lazy loadi.

  • React + Vite Best Practices
  • **Framework:** React + Vite
  • **Rule Count:** 23 rules across 6 categories
  • Configuring Vite for React projects
  • Implementing code splitting and lazy loading

React Vite Best Practices by the numbers

  • 1,889 all-time installs (skills.sh)
  • +73 installs in the week ending Jul 28, 2026 (Skillselion tracking)
  • Ranked #393 of 2,184 Testing & QA skills by installs in the Skillselion catalog
  • Security screen: HIGH risk (skills.sh audit)
  • Data as of Jul 28, 2026 (Skillselion catalog sync)
At a glance

react-vite-best-practices capabilities & compatibility

Capabilities
react + vite best practices · **framework:** react + vite · **rule count:** 23 rules across 6 categories · configuring vite for react projects · implementing code splitting and lazy loading
Use cases
documentation
From the docs

What react-vite-best-practices says it does

--- name: react-vite-best-practices description: React and Vite performance optimization guidelines.
SKILL.md
Use when writing, reviewing, or optimizing React components built with Vite.
SKILL.md
Triggers on tasks involving Vite configuration, build optimization, code splitting, lazy loading, HMR, bundle size, or React performance.
SKILL.md
license: MIT metadata: author: agent-skills version: "2.0.0" --- # React + Vite Best Practices Comprehensive performance optimization guide for React applications built with Vite.
SKILL.md
npx skills add https://github.com/asyrafhussin/agent-skills --skill react-vite-best-practices

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs1.9k
repo stars58
Security audit3 / 3 scanners passed
Last updatedMay 16, 2026
Repositoryasyrafhussin/agent-skills

What problem does react-vite-best-practices solve for developers using the documented workflows?

React and Vite performance optimization guidelines. Use when writing, reviewing, or optimizing React components built with Vite. Triggers on tasks involving Vite configuration, build optimization, cod

Who is it for?

Developers working with react-vite-best-practices patterns described in the skill documentation.

Skip if: Skip when docs are empty or the task is outside the skill documented scope.

When should I use this skill?

React and Vite performance optimization guidelines. Use when writing, reviewing, or optimizing React components built with Vite. Triggers on tasks involving Vite configuration, build optimization, cod

What you get

Grounded guidance and workflows from SKILL.md for react-vite-best-practices.

  • Optimized Vite config patterns
  • Code-splitting and bundle-size improvements

By the numbers

  • Contains 23 rules across 6 categories at version 2.0.0
  • Covers build optimization, code splitting, dev performance, assets, env config, and bundle analysis

Files

SKILL.mdMarkdownGitHub ↗

React + Vite Best Practices

Comprehensive performance optimization guide for React applications built with Vite. Contains 23 rules across 6 categories for build optimization, code splitting, development performance, asset handling, environment configuration, and bundle analysis.

Metadata

  • Version: 2.0.0
  • Framework: React + Vite
  • Rule Count: 23 rules across 6 categories
  • License: MIT

When to Apply

Reference these guidelines when:

  • Configuring Vite for React projects
  • Implementing code splitting and lazy loading
  • Optimizing build output and bundle size
  • Setting up development environment and HMR
  • Handling images, fonts, SVGs, and static assets
  • Managing environment variables across environments
  • Analyzing bundle size and dependencies

Rule Categories by Priority

PriorityCategoryImpactPrefix
1Build OptimizationCRITICALbuild-
2Code SplittingCRITICALsplit-
3DevelopmentHIGHdev-
4Asset HandlingHIGHasset-
5Environment ConfigMEDIUMenv-
6Bundle AnalysisMEDIUMbundle-

Quick Reference

1. Build Optimization (CRITICAL)

  • build-manual-chunks - Configure manual chunks for vendor separation
  • build-minification - Minification with OXC (default) or Terser
  • build-target-modern - Target modern browsers (baseline-widely-available)
  • build-sourcemaps - Configure sourcemaps per environment
  • build-tree-shaking - Ensure proper tree shaking with ESM
  • build-compression - Gzip and Brotli compression
  • build-asset-hashing - Content-based hashing for cache busting

2. Code Splitting (CRITICAL)

  • split-route-lazy - Route-based splitting with React.lazy()
  • split-suspense-boundaries - Strategic Suspense boundary placement
  • split-dynamic-imports - Dynamic import() for heavy components
  • split-component-lazy - Lazy load non-critical components
  • split-prefetch-hints - Prefetch chunks on hover/idle/viewport

3. Development (HIGH)

  • dev-dependency-prebundling - Configure optimizeDeps for faster starts
  • dev-fast-refresh - React Fast Refresh patterns
  • dev-hmr-config - HMR server configuration

4. Asset Handling (HIGH)

  • asset-image-optimization - Image optimization and lazy loading
  • asset-svg-components - SVGs as React components with SVGR
  • asset-fonts - Web font loading strategy
  • asset-public-dir - Public directory vs JavaScript imports

5. Environment Config (MEDIUM)

  • env-vite-prefix - VITE_ prefix for client variables
  • env-modes - Mode-specific environment files
  • env-sensitive-data - Never expose secrets in client code

6. Bundle Analysis (MEDIUM)

  • bundle-visualizer - Analyze bundles with rollup-plugin-visualizer

Essential Configurations

Recommended vite.config.ts

import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import path from 'path'

export default defineConfig({
  plugins: [react()],

  resolve: {
    alias: {
      '@': path.resolve(__dirname, './src'),
    },
  },

  build: {
    target: 'baseline-widely-available',
    sourcemap: false,
    chunkSizeWarningLimit: 500,
    rollupOptions: {
      output: {
        manualChunks: {
          vendor: ['react', 'react-dom'],
        },
      },
    },
  },

  optimizeDeps: {
    include: ['react', 'react-dom'],
  },

  server: {
    port: 3000,
    hmr: {
      overlay: true,
    },
  },
})

Route-Based Code Splitting

import { lazy, Suspense } from 'react'

const Home = lazy(() => import('./pages/Home'))
const Dashboard = lazy(() => import('./pages/Dashboard'))
const Settings = lazy(() => import('./pages/Settings'))

function App() {
  return (
    <Suspense fallback={<LoadingSpinner />}>
      {/* Routes here */}
    </Suspense>
  )
}

Environment Variables

// src/vite-env.d.ts
/// <reference types="vite/client" />

interface ImportMetaEnv {
  readonly VITE_API_URL: string
  readonly VITE_APP_TITLE: string
}

interface ImportMeta {
  readonly env: ImportMetaEnv
}

How to Use

Read individual rule files for detailed explanations and code examples:

rules/build-manual-chunks.md
rules/split-route-lazy.md
rules/env-vite-prefix.md

References

Full Compiled Document

For the complete guide with all rules expanded: AGENTS.md

Related skills

How it compares

Pick react-vite-best-practices over generic React performance tips when the project uses Vite and needs categorized, rule-numbered bundle and splitting guidance.

FAQ

Who is React Vite Best Practices for?

Developers and software engineers working with react-vite-best-practices patterns from the skill documentation.

When should I use React Vite Best Practices?

React and Vite performance optimization guidelines. Use when writing, reviewing, or optimizing React components built with Vite. Triggers on tasks involving Vite configuration, build optimization, code splitting, lazy lo

Is React Vite Best Practices safe to install?

Review the Security Audits panel on this page before installing in production.

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.