frontend-react-vite

Enforces React and Vite conventions for server state, schema validation, code-splitting, and env vars.

Updated Aug 22, 2026
One-click install
npx skills add https://github.com/balajirags/aifsd-kit --skill frontend-react-vite-balajirags
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: frontend-react-vite
Source: https://github.com/balajirags/aifsd-kit/tree/main/docs/skills/frontend-react-vite
Command: npx skills add https://github.com/balajirags/aifsd-kit --skill frontend-react-vite-balajirags

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? React + Vite codebases often accumulate subtle bugs: stale server data in client stores, unvalidated API responses, secrets leaked into browser bundles, and monolithic JS bundles that slow every page load. This Skill gives an AI agent a concrete, enforceable rule set so generated frontend code avoids these pitfalls from the start. ## Core Features & Use Cases - Server-state discipline: Mandates a server-state library like @tanstack/react-query for API data instead of bare useEffect + fetch, with client stores (e.g. Zustand) reserved for UI-only state. - Boundary validation: Requires schema validation (e.g. Zod) on form input and API responses, typing responses as unknown and narrowing via schemas instead of any. - Build and deployment rules: Covers route-level lazy loading, manualChunks vendor splitting, SPA fallback routing, immutable caching for hashed assets, and the rule that VITE_* env vars are public and must never hold secrets. - Use Case: Ask the agent to scaffold a new reservations page; it will produce a useQuery hook with a Zod-parsed response, a lazy-loaded route, and config read from a centralized VITE_* module. ## Quick Start Apply the frontend-react-vite conventions to review or generate the React components in my Vite project.

Frequently Asked Questions about frontend-react-vite

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fetch API data in React without useEffect?

Use a server-state library like @tanstack/react-query with a useQuery hook keyed by the resource. This provides caching, request deduplication, and automatic revalidation that a bare useEffect plus fetch call cannot.

Should I store API data in Zustand or React Query?

Keep server-fetched data in React Query's cache, not Zustand. Zustand and similar client stores are for UI-only state like toggles and form progress; server data stored there goes stale because nothing invalidates it.

Are VITE_ env variables secret in a Vite app?

No. Every VITE_* variable is baked into the built JavaScript bundle and readable by anyone who opens the app. Secrets and API keys belong server-side only; never put them in a VITE_* variable.

How do I validate API responses in TypeScript?

Type the response as unknown and parse it with a schema library like Zod at the boundary. This avoids any and guarantees the runtime shape matches your types before the data enters the app.

Why does my Vite SPA 404 on page refresh?

The server hosting the build lacks SPA fallback routing. Configure nginx, the CDN, or the static server to fall back unknown paths to index.html so client-side routes survive hard refreshes and shared deep links.