LogoAwesome Skills
  • Search
  • Category
  • Tag
  • Blog
LogoAwesome Skills
LogoAwesome Skills

Discover Open-Source Agent Skills for AI Coding Assistants

Product

  • Search
  • Category
  • Tag
  • Blog

Resources

  • Claude Skill Docs
  • Antigravity Skills Docs

Tools

  • Claude Code
  • OpenCode
  • Cursor
  • Codex
  • Antigravity

Company

  • Privacy Policy
  • Terms of Service
  • Sitemap

©2026 Awesome Skills. All rights reserved.

Privacy PolicyTerms
Back to Skills

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 loading, HMR, bundle size, or React performance.

52stars8forksUpdated 7/11/2026
Web Development#performance#react#build-optimization#code-splitting#bundle-analysis#vite

Security Assessment

Medium Risk(50/100)

Detected risks:

Secret Exposure([AGENTS.md] token =, [AGENTS.md] API_KEY=, [AGENTS.md] SECRET=)
Sensitive File Access([AGENTS.md] .env, [rules/_sections.md] .env, [rules/bundle-visualizer.md] .env)
Security Score50/100

About react-vite-best-practices

A performance optimization guide for React applications built with Vite, organized as 23 rules across six prioritized categories. The categories, each with a naming prefix, are Build Optimization (build-, critical), Code Splitting (split-, critical), Development (dev-, high), Asset Handling (asset-, high), Environment Config (env-, medium), and Bundle Analysis (bundle-, medium). Build rules cover manual vendor chunking, minification with OXC (the default) or Terser, targeting modern browsers via baseline-widely-available, per-environment sourcemaps, ESM tree shaking, gzip and Brotli compression, and content-based asset hashing for cache busting. Code splitting rules cover route-based splitting with React.lazy(), strategic Suspense boundary placement, dynamic import() for heavy components, lazy loading non-critical components, and prefetch hints on hover, idle, or viewport. Development rules address optimizeDeps dependency pre-bundling for faster starts, React Fast Refresh, and HMR server configuration. Asset rules cover image optimization and lazy loading, importing SVGs as React components with SVGR, web font loading strategy, and choosing between the public directory and JavaScript imports. Environment rules cover the VITE_ prefix for client-exposed variables, mode-specific env files, and never exposing secrets in client code. Bundle analysis recommends rollup-plugin-visualizer. The guide ships concrete starting configurations, including a recommended vite.config.ts with a path alias, a modern build target, manual vendor chunks for react and react-dom, optimizeDeps includes, and HMR overlay settings, plus examples for route-based splitting and typed environment variables via an ImportMetaEnv interface. Each rule has a dedicated file under rules/ for detailed explanations and code, and a fully expanded reference is compiled in AGENTS.md. Apply it when configuring Vite, implementing code splitting, reducing bundle size, tuning dev-server performance, or handling assets and environment variables.

FAQ

How many rules does the guide contain?

23 rules across six categories — Build Optimization, Code Splitting, Development, Asset Handling, Environment Config, and Bundle Analysis — each category tagged with a naming prefix like build- or split-.

Which categories are the highest priority?

Build Optimization and Code Splitting are both marked CRITICAL, followed by Development and Asset Handling (HIGH), then Environment Config and Bundle Analysis (MEDIUM).

How does it recommend splitting code by route?

Use React.lazy() to dynamically import page components such as Home, Dashboard, and Settings, then wrap them in a Suspense boundary with a fallback so each route becomes its own chunk.

How do I expose environment variables to the client safely?

Prefix client-exposed variables with VITE_, use mode-specific env files, and never place secrets in client code; the variables can be typed via an ImportMetaEnv interface.

How do I analyze my bundle size?

The bundle-visualizer rule recommends rollup-plugin-visualizer, and the build config sets a chunkSizeWarningLimit and manual vendor chunks to help keep bundles in check.

All Files

29 files
metadata.json1.5 KB
View
rules/_template.md0.9 KB
View
AGENTS.md85.4 KB
View
README.md1.5 KB
View
rules/asset-image-optimization.md4.1 KB
View
rules/build-compression.md4.1 KB
View
rules/_sections.md1.7 KB
View
rules/asset-public-dir.md3.4 KB
View
rules/build-manual-chunks.md2.9 KB
View
rules/asset-fonts.md3.3 KB
View
rules/build-asset-hashing.md4.1 KB
View
rules/bundle-visualizer.md3.8 KB
View
rules/env-modes.md3.2 KB
View
rules/split-dynamic-imports.md4.3 KB
View
SKILL.md4.8 KB
View
rules/asset-svg-components.md4.1 KB
View
rules/build-minification.md4.1 KB
View
rules/dev-fast-refresh.md4.6 KB
View
rules/env-vite-prefix.md3.0 KB
View
rules/split-route-lazy.md3.3 KB
View
rules/build-sourcemaps.md3.3 KB
View
rules/dev-hmr-config.md4.5 KB
View
rules/split-component-lazy.md5.8 KB
View
rules/split-suspense-boundaries.md3.5 KB
View
rules/build-target-modern.md2.5 KB
View
rules/build-tree-shaking.md3.6 KB
View
rules/dev-dependency-prebundling.md2.3 KB
View
rules/env-sensitive-data.md3.4 KB
View
rules/split-prefetch-hints.md5.8 KB
View

Install react-vite-best-practices

Download and extract the skill files to your .claude/skills/ directory.

Quick Setup:

  1. Copy the skill folder to .claude/skills/
  2. Claude will automatically detect and use the skill

Repository

asyrafhussin/agent-skills

Related Skills

claude-for-safari

95

youtube-thumbnail

4,282

mantis-history

2,480

mantis-patch

2,480