StarModel invitation
← Back to skills
extension
Category: Development & EngineeringAPI key requirement unconfirmed

vite-react-best-practices

Comprehensive React and Vite SPA performance, architecture, and deployment guidelines. Use this skill when building, reviewing, or refactoring React applications built with Vite (SPA). Covers Vite-specific build configurations, static hosting requirements, and core React performance patterns.

personAuthor: jakexiaohubgithub

Vite React Best Practices

A senior-level guide for building production-ready React Single Page Applications (SPAs) with Vite.

When to Apply

Reference these guidelines when:

  • Setting up a new Vite + React project
  • Configuring build pipelines and CI/CD for SPAs
  • Troubleshooting production build or caching issues
  • Refactoring React components for performance

Priority Table

| Impact | Rules | | --- | --- | | CRITICAL | Static Rewrites, Caching Strategy | | HIGH | Build Validation, Environment Variables, Route Splitting, Server State | | MEDIUM | Memoization, Image Optimization, Colocation, Anti-Patterns: Import from Dist, Troubleshooting |

Rule Categories

1. Vite SPA Deployment (CRITICAL)

2. React Core Performance

3. Architecture & Cleanup

How to Use

  1. Pick the rule that matches the task from the categories above, or from the priority table if you need to know what must not be skipped.
  2. Open the rule file in rules/. Each file is self-contained: frontmatter with impact and tags, the rationale, an incorrect example, a correct example, and a References section.
  3. Load only the rules relevant to the task. CRITICAL rules apply to every Vite SPA; HIGH rules apply to most production apps; MEDIUM rules apply when the area is being changed.
  4. When a rule references another rule, follow the relative link inside rules/.

| Stack | Version | | --- | --- | | React | 19.3.1 | | Vite | 8.3.5 (Rolldown + Oxc) | | React Router | 8.5.1 | | TanStack Query | 5.105.1 | | React Compiler | babel-plugin-react-compiler 1.x | | Node (Vite 8) | ^20.19.0 || >=22.12.0 |

Full Compiled Document

For the complete guide with all rules expanded: AGENTS.md (also available as CLAUDE.md).