vite/SKILL.md
Vite — next-generation frontend build tool with instant dev server and optimized production builds. Use when building with Vite or asking about its APIs, configuration, plugins, SSR, environment variables, or integration with frameworks. Fetch live documentation for up-to-date details.
npx skillsauth add mikkelkrogsholm/dev-skills 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.
CRITICAL: Your training data for Vite is unreliable. APIs change between versions and memorized patterns may be wrong or deprecated. Before writing any code, you MUST use
WebFetchto read the live docs:
WebFetch("https://vite.dev/llms.txt")Do not proceed without fetching this URL first. Never assume a config option or plugin API exists — verify against current docs.
Vite is a frontend build tool that serves source files via native ES modules during development and uses Rollup for optimized production builds.
Vite has several built-in features developers commonly add external packages for:
ts-loader or babel-preset-typescript needed. Note: Vite only transpiles, it does not type-check; run tsc --noEmit separately.*.module.css is automatically a CSS module returning a scoped object — no extra plugin needed..scss, .sass, .less, .styl work out of the box — just npm install the preprocessor itself, no Vite plugin required.import { version } from './package.json' works and is tree-shaken — no need for a JSON loader plugin.import.meta.glob('./dir/*.js') handles dynamic multi-module imports natively — no require.context workaround needed.new Worker(new URL('./worker.js', import.meta.url)) syntax is supported natively alongside the ?worker query suffix.?url, ?raw, ?inline change how assets are imported — no file-loader/url-loader equivalents needed..env file loading with import.meta.env — no dotenv-webpack or similar needed.VITE_ prefix is required for client exposure. Only variables prefixed with VITE_ are exposed to client code via import.meta.env. Variables without this prefix are intentionally hidden to prevent secrets from leaking into the browser bundle. Coming from webpack's DefinePlugin, this is the single most common missed step.
Env variables are always strings. import.meta.env.VITE_PORT is "3000" not 3000. Cast explicitly: Number(import.meta.env.VITE_PORT) or import.meta.env.VITE_FLAG === 'true'.
.env changes require a server restart. Vite reads .env files at startup — modifying them does not trigger HMR. Many developers waste time waiting for a reload that never comes.
NODE_ENV and --mode are independent. Running vite build --mode staging still sets NODE_ENV=production. To change NODE_ENV, set it as a shell variable: NODE_ENV=development vite build.
development
Zod — TypeScript-first schema validation with static type inference. Use when building with Zod or asking about schema definitions, type inference, parsing, transformations, refinements, coercion, error handling, or integration with forms, APIs, or tRPC. Fetch live documentation for up-to-date details.
tools
Upstash — serverless Redis, QStash, and Vector database with per-request pricing optimized for edge and serverless environments. Use when building with Upstash or asking about its Redis client, QStash message queuing, rate limiting, workflows, or vector search. Fetch live documentation for up-to-date details.
tools
Turso — edge-hosted SQLite database built on libSQL with embedded replicas, multi-tenancy, and low-latency global distribution. Use when building with Turso or asking about its libSQL client, embedded replicas, database-per-tenant patterns, auth tokens, sync, or integration with Drizzle or other ORMs. Fetch live documentation for up-to-date details.
development
tRPC — end-to-end typesafe APIs for TypeScript without schemas or code generation. Use when building with tRPC or asking about its router setup, procedures, middleware, context, subscriptions, or integration with React, Next.js, or other frameworks. Fetch live documentation for up-to-date details.