.claude/skills/vite/SKILL.md
Configures Vite 5.x build tool, dev server, and frontend asset optimization for the Luxia e-commerce platform. Use when: configuring builds, adding environment variables, optimizing bundle size, setting up testing, debugging HMR issues, or adding Vite plugins.
npx skillsauth add kaxuna1/ecomsite viteInstall 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.
This e-commerce frontend uses Vite 5.2 with React 18. The configuration prioritizes code splitting via lazy-loaded routes (41+ pages), theme-aware Tailwind CSS with CSS variables, and environment-based API proxy configuration.
cd frontend
npm run dev # http://localhost:5173 with HMR
npm run build # tsc -b && vite build
npm run preview # Preview production build
// vite.config.ts
export default defineConfig({
plugins: [react()],
server: {
port: 5173,
host: '0.0.0.0',
proxy: {
'/api': {
target: 'http://localhost:4000',
changeOrigin: true
}
}
}
});
| Concept | Usage | Example |
|---------|-------|---------|
| Environment Variables | Prefix with VITE_ | import.meta.env.VITE_API_URL |
| Dev Mode Detection | Built-in flag | import.meta.env.DEV |
| Lazy Loading | Route-based splitting | lazy(() => import('./pages/X')) |
| Proxy Config | Backend during dev | /api → localhost:4000 |
| Production API | Relative path | VITE_API_URL=/api |
// src/api/client.ts
const api = axios.create({
baseURL: import.meta.env.VITE_API_URL ?? 'http://localhost:4000/api'
});
// src/App.tsx
const ProductsPage = lazy(() => import('./pages/ProductsPage'));
<Suspense fallback={<LoadingScreen />}>
<Routes>{/* routes */}</Routes>
</Suspense>
Detected: No Vitest in frontend/package.json
npm install -D vitest @testing-library/react @testing-library/jest-dom jsdom
tools
Zustand lightweight state management with persistence and middleware. Use when: managing client-side state (cart, auth, UI preferences), replacing React Context with simpler API, accessing state outside React components, implementing localStorage persistence
development
Zod schema validation and TypeScript integration for runtime type safety. Use when: Validating API payloads, form inputs, environment variables, or any external data boundaries where TypeScript types alone cannot guarantee safety.
development
Enforces strict TypeScript types across frontend and backend codebases. Use when: Writing new services, DTOs, interfaces, type guards, debugging type errors, or ensuring type safety at API boundaries.
development
Manages server state, API caching, and data fetching with TanStack React Query v5. Use when: Fetching API data, managing server state, polling for updates, handling mutations with cache invalidation.