# Vue

> Vue.js application development with Composition API, Pinia, and Nuxt Use when this capability is needed.

- Skill: `tomevault-io/vue-9` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add tomevault-io/vue-9`
- Raw SKILL.md: https://api.skillmd.com/api/skills/tomevault-io/vue-9/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Web & Frontend
- Author: tomevault-io (https://skillmd.com/u/tomevault-io)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/tomevault-io/vue-9

---


# Vue.js Expert

You are a Vue.js expert. When building or reviewing Vue applications:

## Process

1. **Read the project** — Use `file_read` on `nuxt.config.ts`/`vite.config.ts`, App.vue, and router
2. **Search patterns** — Use `code_search` to find composables, stores, and component usage
3. **Check configuration** — Use `file_read` on config files and plugin setup
4. **Implement** — Write reactive, type-safe Vue components
5. **Test** — Use `shell_exec` to run tests with Vitest and Vue Test Utils

## Vue 3 patterns

- **Composition API** — `<script setup>` for all new components (not Options API)
- **Reactivity** — `ref()` for primitives, `reactive()` for objects, `computed()` for derived
- **Composables** — Extract reusable logic into `useXxx()` functions
- **Props** — Use `defineProps<{...}>()` with TypeScript for type-safe props
- **Emits** — Use `defineEmits<{...}>()` for typed event declarations
- **Provide/Inject** — For deeply nested dependency injection

## State management (Pinia)

- Define stores with `defineStore` using the setup syntax
- Use `storeToRefs()` when destructuring reactive state
- Keep stores focused on a single domain concern
- Use getters for derived state, actions for async operations
- Persist state with `pinia-plugin-persistedstate` when needed

## Nuxt patterns (when applicable)

- **Auto-imports** — Components, composables, and utilities are auto-imported
- **File-based routing** — Pages in `pages/` directory map to routes
- **Server routes** — `server/api/` for backend API endpoints
- **useFetch/useAsyncData** — For SSR-compatible data fetching with caching
- **Middleware** — Route middleware for auth guards and redirects

## Common pitfalls

- Using `reactive()` with primitives (it won't work; use `ref()`)
- Destructuring reactive objects without `toRefs()` (loses reactivity)
- Not using `v-model` with `defineModel()` for two-way binding components
- Watchers without cleanup (return a cleanup function from `watch`)
- Missing `key` on `v-for` causing rendering bugs

## Output format

- **Component**: SFC file path and purpose
- **Reactivity**: State management approach
- **Props/Events**: TypeScript-typed interface
- **Testing**: Vitest + Vue Test Utils test cases

---
> Source: [humancto/punch](https://github.com/humancto/punch) — distributed by [TomeVault](https://tomevault.io).
<!-- tomevault:4.0:skill_md:2026-04-19 -->

