1---2name: frontend-vue33description: Build, maintain, and debug Vue 3 frontends (Vite + TypeScript).4---56# Frontend - Vue 378## When to use this skill9- Feature work or fixes in Vue 3 projects scaffolded with Vite.10- Creating pages/components, routing, forms, state (Pinia), or API integration.11- Testing, linting, performance, or accessibility improvements in the Vue app.1213## Quick start141. Install: `npm ci` (or `pnpm i`, `yarn` as project standard).152. Env: copy `.env.example` -> `.env`; set `VITE_API_URL` and other `VITE_` vars.163. Dev server: `npm run dev`; build: `npm run build`; preview: `npm run preview`.174. Quality: `npm run lint` for ESLint; `npm run test` (Vitest) if present.1819## Project structure basics20- `src/main.ts`: app bootstrap; registers router, Pinia, global styles.21- `src/router/*`: route definitions; lazy-load views to shrink bundles.22- `src/stores/*`: Pinia stores for shared state.23- `src/components/*`: reusable UI; keep props typed and emit events explicitly.24- `src/composables/*`: extract logic into composables for reuse/testability.2526## Coding principles27- Keep components small; move logic to composables; keep stores focused and typed.28- Validate inputs, handle loading/error states explicitly, and surface user-friendly messages.29- Accessibility first: semantic elements, focus management, keyboard support.30- Enforce lint/type/test/build before merge (see `scripts/dev-check.sh`).3132## Patterns and snippets33- Composition, router, Pinia, form, and HTTP client templates live in references/snippets.md.34- Prefer route-level code splitting; centralize HTTP client (base URL, auth, error normalization).35- Use `v-model` + client-side validation; show per-field API errors.3637## Testing38- Component tests with Vitest + Vue Test Utils; mock stores and router as needed.39- Prefer testing behavior (rendered text, emitted events) over implementation details.4041## Performance and DX42- Use `<script setup>` and `<Suspense>` for async components when helpful.43- Split vendor chunks via Vite config if bundles grow large.44- Keep components small; extract logic to composables; avoid unnecessary reactive nesting.4546## Accessibility and UI47- Use semantic elements first; bind `aria-*` labels for interactive controls.48- Manage focus on navigation or modal open/close; ensure keyboard access.4950## Bundled resources51- scripts/dev-check.sh: run before committing/raising a PR to ensure lint, type-check, tests, and build all pass with the detected package manager.52- references/coding-standards.md: quick guardrails on component sizing, typing, accessibility, and pre-merge checks.53- references/best-practices.md: deeper guidance for routing, state, styling, API, testing, performance, and a11y decisions.54- references/snippets.md: ready-to-use templates for composition API, routing, Pinia, forms, and HTTP client setup.55- assets/pr-template.md: use when opening PRs so reviewers see scope, testing proof, and UI evidence (desktop/mobile, a11y/perf notes).5657## Delivery checklist58- Lint and tests clean; types pass.59- No console logs left; env vars documented; API errors surfaced to users.60- Routes lazy-loaded; bundle size reasonable; loading states present for async flows.