23 performance optimization rules for React and Vite across build, code splitting, development, assets, environment, and bundle analysis.
Works with
Covers six rule categories prioritized by impact: build optimization and code splitting (critical), development and asset handling (high), environment config and bundle analysis (medium)
Includes route-based lazy loading with React.lazy() and Suspense, manual vendor chunk separation, and strategic prefetching patterns
Provides recommended vite.conf
AI-first code editor with Composer
Before installing skills in Cursor, ensure your development environment meets these requirements:
node --versionreact-vite-best-practicesExecute the skills CLI command in your project's root directory to begin installation:
Fetches react-vite-best-practices from asyrafhussin/agent-skills and configures it for Cursor.
The CLI shows a list of agents. Use arrow keys and space to select Cursor:
Confirm successful installation by checking the skill directory location:
Restart Cursor to activate react-vite-best-practices. Access via /react-vite-best-practices in your agent's command palette.
We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.
Skills execute code in your environment. Always review source, verify the publisher, and test in isolation before production.
Submit your Claude Code skill and start earning
Automate repetitive workflows and reduce manual effort
Example
Generate reports, summarize documents, draft communications
Save 3-5 hours per week on routine tasks
Learn new skills, understand complex topics, get expert guidance
Example
Explain concepts, provide examples, suggest learning resources
Accelerate learning and skill development by 2x
Enhance output quality through reviews, suggestions, and refinements
Example
Review drafts, suggest improvements, catch errors
Improve work quality by 30-40% with less effort
49
total installs
49
this week
24
GitHub stars
0
upvotes
Run in your terminal
49
installs
49
this week
24
stars
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.
Reference these guidelines when:
| Priority | Category | Impact | Prefix |
|---|---|---|---|
| 1 | Build Optimization | CRITICAL | build- |
| 2 | Code Splitting | CRITICAL | split- |
| 3 | Development | HIGH | dev- |
| 4 | Asset Handling | HIGH | asset- |
| 5 | Environment Config | MEDIUM | env- |
| 6 | Bundle Analysis | MEDIUM | bundle- |
build-manual-chunks - Configure manual chunks for vendor separationbuild-minification - Minification with OXC (default) or Terserbuild-target-modern - Target modern browsers (baseline-widely-available)build-sourcemaps - Configure sourcemaps per environmentbuild-tree-shaking - Ensure proper tree shaking with ESMbuild-compression - Gzip and Brotli compressionbuild-asset-hashing - Content-based hashing for cache bustingsplit-route-lazy - Route-based splitting with React.lazy()split-suspense-boundaries - Strategic Suspense boundary placementsplit-dynamic-imports - Dynamic import() for heavy componentssplit-component-lazy - Lazy load non-critical componentssplit-prefetch-hints - Prefetch chunks on hover/idle/viewportdev-dependency-prebundling - Configure optimizeDeps for faster startsdev-fast-refresh - React Fast Refresh patternsdev-hmr-config - HMR server configurationasset-image-optimization - Image optimization and lazy loadingasset-svg-components - SVGs as React components with SVGRasset-fonts - Web font loading strategyasset-public-dir - Public directory vs JavaScript importsenv-vite-prefix - VITE_ prefix for client variablesenv-modes - Mode-specific environment filesenv-sensitive-data - Never expose secrets in client codebundle-visualizer - Analyze bundles with rollup-plugin-visualizerimport { 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,
},
},
})
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>
)
}
// 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
}
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
For the complete guide with all rules expanded: AGENTS.md
Prerequisites
Time Estimate
15-45 minutes depending on use case complexity
Steps
Common Pitfalls
โ Do
โ Don't
๐ก Pro Tips
โ Use when
Use when skill capabilities match your task, clear ROI on time saved, and you can validate outputs. Best for repetitive tasks, learning, and quality improvement.
โ Avoid when
Avoid when task requires deep expertise you can't validate, involves sensitive decisions, or when learning process is more valuable than speed of completion.
jwynia/agent-skills
asyrafhussin/agent-skills
kadajett/agent-nestjs-skills
uni-helper/skills
anthropics/claude-code
github/awesome-copilot
We added react-vite-best-practices from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.
I recommend react-vite-best-practices for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.
Solid pick for teams standardizing on skills: react-vite-best-practices is focused, and the summary matches what you get after install.
Keeps context tight: react-vite-best-practices is the kind of skill you can hand to a new teammate without a long onboarding doc.
Useful defaults in react-vite-best-practices โ fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.
react-vite-best-practices has been reliable in day-to-day use. Documentation quality is above average for community skills.
react-vite-best-practices is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
Keeps context tight: react-vite-best-practices is the kind of skill you can hand to a new teammate without a long onboarding doc.
react-vite-best-practices has been reliable in day-to-day use. Documentation quality is above average for community skills.
Useful defaults in react-vite-best-practices โ fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.
showing 1-10 of 28