[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7AQSBJJ0JWAM28BXJFFDTGC":3,"skill-same:01M7AQSBJJ0JWAM28BXJFFDTGC":48},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":25,"commitSha":26,"skillDirectory":27,"forksCount":28,"repositoryHtmlUrl":29,"repositoryHomepageUrl":6,"ownerHtmlUrl":30,"ownerBlogUrl":31,"ownerDescription":32,"updatedAt":33,"install":34,"resources":47},"01M7AQSBJJ0JWAM28BXJFFDTGC","vue-patterns",null,"Vue.js 3 Composition API patterns, component architecture, reactivity best practices, Pinia state management, Vue Router navigation, and Nuxt SSR patterns. Activates for Vue, Nuxt, Vite, or Pinia projects. Use when building or reviewing Vue 3, Nuxt, or Pinia code — Composition API, reactivity, or router navigation.","Cyrilthetecchieee\u002Fcyril-code-","Cyrilthetecchieee","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F219787998?v=4","01M7AF0MMMKRAA0H61XMJPV92H","Julian Cyril D ","01M7AF0MQ10AVG6QJQ1C2BC0F5",2,"MIT","https:\u002F\u002Fgithub.com\u002FCyrilthetecchieee\u002Fcyril-code-\u002Fblob\u002Fmain\u002Fsrc\u002Fcyril_code\u002Fassets\u002F.skills_repo\u002Fskills\u002Fvue-patterns\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: vue-patterns\ndescription: Vue.js 3 Composition API patterns, component architecture, reactivity best practices, Pinia state management, Vue Router navigation, and Nuxt SSR patterns. Activates for Vue, Nuxt, Vite, or Pinia projects. Use when building or reviewing Vue 3, Nuxt, or Pinia code — Composition API, reactivity, or router navigation.\norigin: ECC\n---\n\n# Vue.js Patterns and Best Practices\n\nComprehensive guide for Vue.js 3 development using Composition API (`\u003Cscript setup>`), covering component design, reactivity, state management, routing, testing, and SSR patterns. Nuxt-specific guidance is included where it differs from vanilla Vue.\n\n## When to Activate\n\nActivate this skill when:\n- The project uses Vue.js (any version), Nuxt, Vite + Vue, or Pinia.\n- The user asks about Vue component architecture, composables, reactivity, or state management.\n- Reviewing Vue Single-File Components (`.vue` files).\n- Setting up Vue Router, Pinia stores, or Vite\u002FVitest configuration.\n- Discussing Vue-specific performance, security, or SSR patterns.\n\n---\n\n## 1. Project Structure\n\n### Recommended Layout (Feature-First)\n\n```\nsrc\u002F\n├── api\u002F              # API client and endpoint definitions\n├── assets\u002F           # Static assets (images, fonts, icons)\n├── components\u002F       # Shared\u002Freusable components\n│   ├── base\u002F         # Base UI primitives (Button, Input, Modal)\n│   └── features\u002F     # Feature-specific shared components\n├── composables\u002F      # Reusable Composition API logic\n├── layouts\u002F          # Page layouts (optional)\n├── pages\u002F            # Route-level page components\n├── router\u002F           # Vue Router configuration\n├── stores\u002F           # Pinia stores\n├── types\u002F            # TypeScript type definitions\n├── utils\u002F            # Pure utility functions\n└── App.vue           # Root component\n```\n\n### File Naming\n\n| Convention | When to Use |\n|-----------|-------------|\n| `PascalCase.vue` | All components (enforced by `vue\u002Fmulti-word-component-names`) |\n| `useCamelCase.ts` | Composables |\n| `camelCase.ts` | Utilities, API clients, types |\n| `kebab-case` directories | Route segments, feature folders |\n\n---\n\n## 2. Component Architecture\n\n### Single-File Component Order\n\n```vue\n\u003Cscript setup lang=\"ts\">\n\u002F\u002F 1. Imports (vue → ecosystem → absolute → relative)\n\u002F\u002F 2. Props & Emits & Slots\n\u002F\u002F 3. Composables\n\u002F\u002F 4. Local state (ref\u002Freactive)\n\u002F\u002F 5. Computed properties\n\u002F\u002F 6. Methods\n\u002F\u002F 7. Watchers\n\u002F\u002F 8. Lifecycle hooks\n\u003C\u002Fscript>\n\n\u003Ctemplate>\n  \u003C!-- Template content -->\n\u003C\u002Ftemplate>\n\n\u003Cstyle scoped>\n  \u002F* Scoped styles *\u002F\n\u003C\u002Fstyle>\n```\n\n### Presentational vs Container\n\n- **Container components**: Own data fetching, state, and side effects. Render presentational components.\n- **Presentational components**: Receive props, emit events. No API calls, no store access. Pure rendering.\n\n### Props Best Practices\n\n```ts\n\u002F\u002F Type-based props with defaults\ninterface Props {\n  label: string;\n  variant?: \"primary\" | \"secondary\";\n  disabled?: boolean;\n  items: Item[];\n}\n\nconst props = withDefaults(defineProps\u003CProps>(), {\n  variant: \"primary\",\n  disabled: false,\n});\n```\n\n- Always provide `type`, and `required`\u002F`default` where appropriate.\n- Boolean props: `isXxx`, `hasXxx`, `canXxx`.\n- Never mutate props — emit events instead.\n- For v-model binding, use `defineModel()` (Vue 3.4+) or `modelValue` + `update:modelValue`.\n\n### Events\n\n```ts\nconst emit = defineEmits\u003C{\n  submit: [];\n  \"update:modelValue\": [value: string];\n  select: [id: string, index: number];\n}>();\n```\n\n- Use kebab-case in templates (`@update:model-value`).\n- Use camelCase in script (`emit(\"update:modelValue\", val)`).\n\n---\n\n## 3. Composables (Reusable Logic)\n\n### Structure\n\n```ts\n\u002F\u002F composables\u002FuseDebounce.ts\nexport function useDebounce\u003CT>(value: MaybeRef\u003CT>, delay: number): Ref\u003CT> {\n  const debounced = ref(toValue(value)) as Ref\u003CT>;\n\n  let timer: ReturnType\u003Ctypeof setTimeout>;\n  watch(\n    () => toValue(value),\n    (newVal) => {\n      clearTimeout(timer);\n      timer = setTimeout(() => { debounced.value = newVal; }, delay);\n    }\n  );\n\n  onUnmounted(() => clearTimeout(timer));\n  return readonly(debounced);\n}\n```\n\n### Rules\n\n- Must start with `use` prefix.\n- Return reactive values (`ref`, `computed`, `reactive`), never plain primitives.\n- Accept reactive inputs via `MaybeRef` \u002F `toRef()` \u002F `toValue()`.\n- Clean up side effects in `onUnmounted` or watcher `onCleanup`.\n- No module-scope side effects.\n\n### vs Mixins\n\nComposables replace Vue 2 mixins entirely:\n- **Mixins**: Opaque data flow, source-of-truth collisions, name conflicts.\n- **Composables**: Explicit imports, clear return values, composable and tree-shakable.\n\n---\n\n## 4. State Management\n\n### When to Use What\n\n| Pattern | Use Case |\n|---------|----------|\n| `ref()` \u002F `reactive()` | Local component state |\n| Props + Emits | Parent-child communication |\n| Provide \u002F Inject | Theme, config, plugin API |\n| Pinia store | Global, shared, complex state |\n| Server state composable | API data with caching (wrap `fetch`\u002FTanStack Query) |\n\n### Pinia Setup Store (Preferred)\n\n```ts\n\u002F\u002F stores\u002FuseCartStore.ts\nexport const useCartStore = defineStore(\"cart\", () => {\n  const items = ref\u003CCartItem[]>([]);\n  const isLoading = ref(false);\n\n  const totalPrice = computed(() =>\n    items.value.reduce((sum, i) => sum + i.price * i.quantity, 0)\n  );\n  const itemCount = computed(() =>\n    items.value.reduce((sum, i) => sum + i.quantity, 0)\n  );\n\n  async function addItem(productId: string) {\n    isLoading.value = true;\n    try {\n      const item = await fetchProduct(productId);\n      const existing = items.value.find(i => i.id === item.id);\n      if (existing) existing.quantity++;\n      else items.value.push({ ...item, quantity: 1 });\n    } finally {\n      isLoading.value = false;\n    }\n  }\n\n  return { items, isLoading, totalPrice, itemCount, addItem };\n});\n```\n\n- Use Setup Store syntax (not Options Store).\n- Prefer actions for business-level mutations and `$patch()` for grouped updates.\n- Every async action: handle loading + success + error.\n\n---\n\n## 5. Vue Router\n\n### Route Definitions\n\n```ts\nconst routes = [\n  {\n    path: \"\u002Fusers\u002F:id\",\n    name: \"user-detail\",\n    component: () => import(\"@\u002Fpages\u002FUserDetail.vue\"), \u002F\u002F lazy\n    props: true, \u002F\u002F pass params as props\n    meta: { requiresAuth: true },\n  },\n];\n```\n\n### Navigation Guards\n\n```ts\nrouter.beforeEach((to, from) => {\n  const { isLoggedIn } = useAuthStore();\n  if (to.meta.requiresAuth && !isLoggedIn) {\n    return { name: \"login\", query: { redirect: to.fullPath } };\n  }\n});\n```\n\n### Reactive Route Params\n\nWhen a component stays mounted but route params change:\n\n```ts\nconst route = useRoute();\nconst id = computed(() => route.params.id as string);\nwatch(id, (newId) => fetchItem(newId));\n```\n\n---\n\n## 6. Template Patterns\n\n### Template Syntax\n\n```vue\n\u003C!-- v-if\u002Fv-else-if\u002Fv-else -->\n\u003Cdiv v-if=\"isLoading\">Loading...\u003C\u002Fdiv>\n\u003Cdiv v-else-if=\"error\">Error: {{ error }}\u003C\u002Fdiv>\n\u003Cdiv v-else>{{ content }}\u003C\u002Fdiv>\n\n\u003C!-- v-show for frequent toggles -->\n\u003Cdiv v-show=\"isOpen\">Toggled content\u003C\u002Fdiv>\n\n\u003C!-- v-for with stable keys -->\n\u003Cdiv v-for=\"item in items\" :key=\"item.id\">{{ item.name }}\u003C\u002Fdiv>\n\n\u003C!-- Computed filtered list (not v-if + v-for on same element) -->\n\u003Cdiv v-for=\"item in activeItems\" :key=\"item.id\">{{ item.name }}\u003C\u002Fdiv>\n\n\u003C!-- Event handling -->\n\u003Cform @submit.prevent=\"handleSubmit\">\n  \u003Cbutton type=\"submit\">Save\u003C\u002Fbutton>\n\u003C\u002Fform>\n\n\u003C!-- v-model -->\n\u003Cinput v-model=\"name\" \u002F>\n\u003CCustomInput v-model=\"value\" v-model:title=\"title\" \u002F>\n```\n\n---\n\n## 7. Performance\n\n| Technique | When to Use |\n|-----------|-------------|\n| `v-memo` | List items that rarely change |\n| `v-once` | Content rendered once and static forever |\n| `shallowRef()` | Large data structures replaced wholesale |\n| `shallowReactive()` | Only top-level properties are reactive |\n| `v-show` over `v-if` | Frequent visibility toggles |\n| `\u003CKeepAlive :max=\"10\">` | Cache toggled views |\n| Lazy routes | `() => import(...)` for non-critical routes |\n| `Suspense` | Async component loading with fallback |\n\n---\n\n## 8. Testing\n\n### Stack\n\n- **Vitest** for unit and component tests\n- **Vue Test Utils** for mounting and interaction\n- **@pinia\u002Ftesting** for store mocking\n- **Playwright** for E2E\n\n### Component Test Pattern\n\n```ts\nimport { mount } from \"@vue\u002Ftest-utils\";\nimport { createPinia, setActivePinia } from \"pinia\";\nimport UserCard from \".\u002FUserCard.vue\";\n\nbeforeEach(() => { setActivePinia(createPinia()); });\n\nit(\"renders and emits\", async () => {\n  const wrapper = mount(UserCard, {\n    props: { user: { id: \"1\", name: \"Alice\" } },\n  });\n  expect(wrapper.text()).toContain(\"Alice\");\n  await wrapper.find(\"button\").trigger(\"click\");\n  expect(wrapper.emitted(\"select\")![0]).toEqual([\"1\"]);\n});\n```\n\n---\n\n## 9. Nuxt-Specific Patterns\n\n### Auto-Imports\n\nNuxt auto-imports `ref`, `computed`, `watch`, `useFetch`, `useAsyncData`, etc. Use them directly without importing. For non-Nuxt projects, always import explicitly.\n\n### useAsyncData \u002F useFetch\n\n```ts\nconst { data: user, pending, error, refresh } = await useAsyncData(\n  \"user\", \u002F\u002F unique key for caching\n  () => $fetch(`\u002Fapi\u002Fusers\u002F${id}`),\n);\n\nconst { data: posts } = await useFetch(\"\u002Fapi\u002Fposts\", {\n  query: { page: 1 },\n  key: \"posts-page-1\", \u002F\u002F dedupes requests\n});\n```\n\n### Server Routes\n\n```ts\n\u002F\u002F server\u002Fapi\u002Fusers\u002F[id].ts\nexport default defineEventHandler(async (event) => {\n  const { id } = await getValidatedRouterParams(event, z.object({\n    id: z.string().uuid(),\n  }).parse);\n  \u002F\u002F ... fetch and return\n});\n```\n\n### Runtime Config\n\n```ts\n\u002F\u002F nuxt.config.ts\nexport default defineNuxtConfig({\n  runtimeConfig: {\n    \u002F\u002F server-only\n    apiSecret: \"\",\n    \u002F\u002F public (exposed to client)\n    public: {\n      apiBase: \"https:\u002F\u002Fapi.example.com\",\n    },\n  },\n});\n```\n\n---\n\n## 10. Vue 3.5+ New APIs\n\n### Reactive Props Destructure\n\nVue 3.5 stabilized reactive props destructure — destructured variables from `defineProps()` are automatically reactive:\n\n```ts\n\u002F\u002F Vue 3.5+: destructured props are reactive (no need for toRefs)\nconst { count = 0, msg = \"hello\" } = defineProps\u003C{\n  count?: number;\n  msg?: string;\n}>();\n\n\u002F\u002F Limitation: cannot watch destructured prop directly\nwatch(() => count, (newVal) => { ... }); \u002F\u002F PASS getter required\n```\n\n### `useTemplateRef()`\n\nReplace name-matched plain refs with `useTemplateRef()` for template references:\n\n```ts\nimport { useTemplateRef } from \"vue\";\nconst inputEl = useTemplateRef\u003CHTMLInputElement>(\"input\");\n\u002F\u002F \"input\" matches the ref=\"input\" attribute in template, not the variable name\n```\n\nSupports dynamic ref IDs: `useTemplateRef(dynamicRefId)`.\n\n### `onWatcherCleanup()`\n\nGlobally importable watcher cleanup API (Vue 3.5+). It must be called synchronously inside the watcher callback:\n\n```ts\nimport { watch, onWatcherCleanup } from \"vue\";\n\nwatch(userId, async (newId) => {\n  const controller = new AbortController();\n  onWatcherCleanup(() => controller.abort());\n  \u002F\u002F ... fetch with signal\n});\n```\n\n### `useId()`\n\nSSR-stable unique ID generation for form elements and accessibility:\n\n```ts\nimport { useId } from \"vue\";\nconst id = useId();\n```\n\n### `defer` Teleport\n\n`\u003CTeleport defer>` allows teleporting to targets rendered in the same cycle:\n\n```vue\n\u003CTeleport defer to=\"#container\">Content\u003C\u002FTeleport>\n\u003Cdiv id=\"container\">\u003C\u002Fdiv>\n```\n\n### Lazy Hydration (SSR)\n\n`defineAsyncComponent()` now supports `hydrate` strategy:\n\n```ts\nimport { defineAsyncComponent, hydrateOnVisible } from \"vue\";\nconst AsyncComp = defineAsyncComponent({\n  loader: () => import(\".\u002FComp.vue\"),\n  hydrate: hydrateOnVisible(),\n});\n```\n\n---\n\n## Anti-Patterns\n\n| Anti-Pattern | Why It's Wrong | The Fix |\n|-------------|---------------|---------|\n| Destructuring `defineProps()` (Vue \u003C 3.5) | Captures snapshot, loses reactivity | Access via `props.xxx` or use `toRefs()` |\n| `watch()` on destructured prop (Vue 3.5+) | Compile-time error — destructured props can't be watched directly | Use getter wrapper: `watch(() => count, ...)` |\n| `v-if` + `v-for` on same element | Ambiguous execution order | Use computed filtered array |\n| `v-for` key = index | Broken state on reorder | Use stable database IDs |\n| Mutating props | Violates one-way data flow | Emit events or use `v-model` |\n| `v-html` with user content | XSS vulnerability | Sanitize with DOMPurify |\n| Mixins in Vue 3 | Opaque, collision-prone | Replace with composables |\n| Module-scope side effects in composable | Shared across instances | Scope in `onMounted` + `onUnmounted` |\n| `reactive()` for replaceable state | Replacement breaks reactivity | Use `ref()` instead |\n| Watcher without cleanup | Memory leaks, race conditions | Use `onCleanup` or `onWatcherCleanup()` (Vue 3.5+) |\n| Options API in new Vue 3 code | Ecosystem move to Composition API | Use `\u003Cscript setup>` |\n| Plain ref for template references | No dynamic ref support, name-matching fragile | Use `useTemplateRef()` (Vue 3.5+) |\n\n## Related Skills\n\n- `accessibility` — ARIA, semantic HTML, focus management\n- `frontend-patterns` — Cross-framework frontend architecture\n- `typescript` — TypeScript best practices applied to Vue projects\n- `coding-standards` — General code quality standards\n","# Vue.js Patterns and Best Practices\n\nComprehensive guide for Vue.js 3 development using Composition API (`\u003Cscript setup>`), covering component design, reactivity, state management, routing, testing, and SSR patterns. Nuxt-specific guidance is included where it differs from vanilla Vue.\n\n## When to Activate\n\nActivate this skill when:\n- The project uses Vue.js (any version), Nuxt, Vite + Vue, or Pinia.\n- The user asks about Vue component architecture, composables, reactivity, or state management.\n- Reviewing Vue Single-File Components (`.vue` files).\n- Setting up Vue Router, Pinia stores, or Vite\u002FVitest configuration.\n- Discussing Vue-specific performance, security, or SSR patterns.\n\n---\n\n## 1. Project Structure\n\n### Recommended Layout (Feature-First)\n\n```\nsrc\u002F\n├── api\u002F              # API client and endpoint definitions\n├── assets\u002F           # Static assets (images, fonts, icons)\n├── components\u002F       # Shared\u002Freusable components\n│   ├── base\u002F         # Base UI primitives (Button, Input, Modal)\n│   └── features\u002F     # Feature-specific shared components\n├── composables\u002F      # Reusable Composition API logic\n├── layouts\u002F          # Page layouts (optional)\n├── pages\u002F            # Route-level page components\n├── router\u002F           # Vue Router configuration\n├── stores\u002F           # Pinia stores\n├── types\u002F            # TypeScript type definitions\n├── utils\u002F            # Pure utility functions\n└── App.vue           # Root component\n```\n\n### File Naming\n\n| Convention | When to Use |\n|-----------|-------------|\n| `PascalCase.vue` | All components (enforced by `vue\u002Fmulti-word-component-names`) |\n| `useCamelCase.ts` | Composables |\n| `camelCase.ts` | Utilities, API clients, types |\n| `kebab-case` directories | Route segments, feature folders |\n\n---\n\n## 2. Component Architecture\n\n### Single-File Component Order\n\n```vue\n\u003Cscript setup lang=\"ts\">\n\u002F\u002F 1. Imports (vue → ecosystem → absolute → relative)\n\u002F\u002F 2. Props & Emits & Slots\n\u002F\u002F 3. Composables\n\u002F\u002F 4. Local state (ref\u002Freactive)\n\u002F\u002F 5. Computed properties\n\u002F\u002F 6. Methods\n\u002F\u002F 7. Watchers\n\u002F\u002F 8. Lifecycle hooks\n\u003C\u002Fscript>\n\n\u003Ctemplate>\n  \u003C!-- Template content -->\n\u003C\u002Ftemplate>\n\n\u003Cstyle scoped>\n  \u002F* Scoped styles *\u002F\n\u003C\u002Fstyle>\n```\n\n### Presentational vs Container\n\n- **Container components**: Own data fetching, state, and side effects. Render presentational components.\n- **Presentational components**: Receive props, emit events. No API calls, no store access. Pure rendering.\n\n### Props Best Practices\n\n```ts\n\u002F\u002F Type-based props with defaults\ninterface Props {\n  label: string;\n  variant?: \"primary\" | \"secondary\";\n  disabled?: boolean;\n  items: Item[];\n}\n\nconst props = withDefaults(defineProps\u003CProps>(), {\n  variant: \"primary\",\n  disabled: false,\n});\n```\n\n- Always provide `type`, and `required`\u002F`default` where appropriate.\n- Boolean props: `isXxx`, `hasXxx`, `canXxx`.\n- Never mutate props — emit events instead.\n- For v-model binding, use `defineModel()` (Vue 3.4+) or `modelValue` + `update:modelValue`.\n\n### Events\n\n```ts\nconst emit = defineEmits\u003C{\n  submit: [];\n  \"update:modelValue\": [value: string];\n  select: [id: string, index: number];\n}>();\n```\n\n- Use kebab-case in templates (`@update:model-value`).\n- Use camelCase in script (`emit(\"update:modelValue\", val)`).\n\n---\n\n## 3. Composables (Reusable Logic)\n\n### Structure\n\n```ts\n\u002F\u002F composables\u002FuseDebounce.ts\nexport function useDebounce\u003CT>(value: MaybeRef\u003CT>, delay: number): Ref\u003CT> {\n  const debounced = ref(toValue(value)) as Ref\u003CT>;\n\n  let timer: ReturnType\u003Ctypeof setTimeout>;\n  watch(\n    () => toValue(value),\n    (newVal) => {\n      clearTimeout(timer);\n      timer = setTimeout(() => { debounced.value = newVal; }, delay);\n    }\n  );\n\n  onUnmounted(() => clearTimeout(timer));\n  return readonly(debounced);\n}\n```\n\n### Rules\n\n- Must start with `use` prefix.\n- Return reactive values (`ref`, `computed`, `reactive`), never plain primitives.\n- Accept reactive inputs via `MaybeRef` \u002F `toRef()` \u002F `toValue()`.\n- Clean up side effects in `onUnmounted` or watcher `onCleanup`.\n- No module-scope side effects.\n\n### vs Mixins\n\nComposables replace Vue 2 mixins entirely:\n- **Mixins**: Opaque data flow, source-of-truth collisions, name conflicts.\n- **Composables**: Explicit imports, clear return values, composable and tree-shakable.\n\n---\n\n## 4. State Management\n\n### When to Use What\n\n| Pattern | Use Case |\n|---------|----------|\n| `ref()` \u002F `reactive()` | Local component state |\n| Props + Emits | Parent-child communication |\n| Provide \u002F Inject | Theme, config, plugin API |\n| Pinia store | Global, shared, complex state |\n| Server state composable | API data with caching (wrap `fetch`\u002FTanStack Query) |\n\n### Pinia Setup Store (Preferred)\n\n```ts\n\u002F\u002F stores\u002FuseCartStore.ts\nexport const useCartStore = defineStore(\"cart\", () => {\n  const items = ref\u003CCartItem[]>([]);\n  const isLoading = ref(false);\n\n  const totalPrice = computed(() =>\n    items.value.reduce((sum, i) => sum + i.price * i.quantity, 0)\n  );\n  const itemCount = computed(() =>\n    items.value.reduce((sum, i) => sum + i.quantity, 0)\n  );\n\n  async function addItem(productId: string) {\n    isLoading.value = true;\n    try {\n      const item = await fetchProduct(productId);\n      const existing = items.value.find(i => i.id === item.id);\n      if (existing) existing.quantity++;\n      else items.value.push({ ...item, quantity: 1 });\n    } finally {\n      isLoading.value = false;\n    }\n  }\n\n  return { items, isLoading, totalPrice, itemCount, addItem };\n});\n```\n\n- Use Setup Store syntax (not Options Store).\n- Prefer actions for business-level mutations and `$patch()` for grouped updates.\n- Every async action: handle loading + success + error.\n\n---\n\n## 5. Vue Router\n\n### Route Definitions\n\n```ts\nconst routes = [\n  {\n    path: \"\u002Fusers\u002F:id\",\n    name: \"user-detail\",\n    component: () => import(\"@\u002Fpages\u002FUserDetail.vue\"), \u002F\u002F lazy\n    props: true, \u002F\u002F pass params as props\n    meta: { requiresAuth: true },\n  },\n];\n```\n\n### Navigation Guards\n\n```ts\nrouter.beforeEach((to, from) => {\n  const { isLoggedIn } = useAuthStore();\n  if (to.meta.requiresAuth && !isLoggedIn) {\n    return { name: \"login\", query: { redirect: to.fullPath } };\n  }\n});\n```\n\n### Reactive Route Params\n\nWhen a component stays mounted but route params change:\n\n```ts\nconst route = useRoute();\nconst id = computed(() => route.params.id as string);\nwatch(id, (newId) => fetchItem(newId));\n```\n\n---\n\n## 6. Template Patterns\n\n### Template Syntax\n\n```vue\n\u003C!-- v-if\u002Fv-else-if\u002Fv-else -->\n\u003Cdiv v-if=\"isLoading\">Loading...\u003C\u002Fdiv>\n\u003Cdiv v-else-if=\"error\">Error: {{ error }}\u003C\u002Fdiv>\n\u003Cdiv v-else>{{ content }}\u003C\u002Fdiv>\n\n\u003C!-- v-show for frequent toggles -->\n\u003Cdiv v-show=\"isOpen\">Toggled content\u003C\u002Fdiv>\n\n\u003C!-- v-for with stable keys -->\n\u003Cdiv v-for=\"item in items\" :key=\"item.id\">{{ item.name }}\u003C\u002Fdiv>\n\n\u003C!-- Computed filtered list (not v-if + v-for on same element) -->\n\u003Cdiv v-for=\"item in activeItems\" :key=\"item.id\">{{ item.name }}\u003C\u002Fdiv>\n\n\u003C!-- Event handling -->\n\u003Cform @submit.prevent=\"handleSubmit\">\n  \u003Cbutton type=\"submit\">Save\u003C\u002Fbutton>\n\u003C\u002Fform>\n\n\u003C!-- v-model -->\n\u003Cinput v-model=\"name\" \u002F>\n\u003CCustomInput v-model=\"value\" v-model:title=\"title\" \u002F>\n```\n\n---\n\n## 7. Performance\n\n| Technique | When to Use |\n|-----------|-------------|\n| `v-memo` | List items that rarely change |\n| `v-once` | Content rendered once and static forever |\n| `shallowRef()` | Large data structures replaced wholesale |\n| `shallowReactive()` | Only top-level properties are reactive |\n| `v-show` over `v-if` | Frequent visibility toggles |\n| `\u003CKeepAlive :max=\"10\">` | Cache toggled views |\n| Lazy routes | `() => import(...)` for non-critical routes |\n| `Suspense` | Async component loading with fallback |\n\n---\n\n## 8. Testing\n\n### Stack\n\n- **Vitest** for unit and component tests\n- **Vue Test Utils** for mounting and interaction\n- **@pinia\u002Ftesting** for store mocking\n- **Playwright** for E2E\n\n### Component Test Pattern\n\n```ts\nimport { mount } from \"@vue\u002Ftest-utils\";\nimport { createPinia, setActivePinia } from \"pinia\";\nimport UserCard from \".\u002FUserCard.vue\";\n\nbeforeEach(() => { setActivePinia(createPinia()); });\n\nit(\"renders and emits\", async () => {\n  const wrapper = mount(UserCard, {\n    props: { user: { id: \"1\", name: \"Alice\" } },\n  });\n  expect(wrapper.text()).toContain(\"Alice\");\n  await wrapper.find(\"button\").trigger(\"click\");\n  expect(wrapper.emitted(\"select\")![0]).toEqual([\"1\"]);\n});\n```\n\n---\n\n## 9. Nuxt-Specific Patterns\n\n### Auto-Imports\n\nNuxt auto-imports `ref`, `computed`, `watch`, `useFetch`, `useAsyncData`, etc. Use them directly without importing. For non-Nuxt projects, always import explicitly.\n\n### useAsyncData \u002F useFetch\n\n```ts\nconst { data: user, pending, error, refresh } = await useAsyncData(\n  \"user\", \u002F\u002F unique key for caching\n  () => $fetch(`\u002Fapi\u002Fusers\u002F${id}`),\n);\n\nconst { data: posts } = await useFetch(\"\u002Fapi\u002Fposts\", {\n  query: { page: 1 },\n  key: \"posts-page-1\", \u002F\u002F dedupes requests\n});\n```\n\n### Server Routes\n\n```ts\n\u002F\u002F server\u002Fapi\u002Fusers\u002F[id].ts\nexport default defineEventHandler(async (event) => {\n  const { id } = await getValidatedRouterParams(event, z.object({\n    id: z.string().uuid(),\n  }).parse);\n  \u002F\u002F ... fetch and return\n});\n```\n\n### Runtime Config\n\n```ts\n\u002F\u002F nuxt.config.ts\nexport default defineNuxtConfig({\n  runtimeConfig: {\n    \u002F\u002F server-only\n    apiSecret: \"\",\n    \u002F\u002F public (exposed to client)\n    public: {\n      apiBase: \"https:\u002F\u002Fapi.example.com\",\n    },\n  },\n});\n```\n\n---\n\n## 10. Vue 3.5+ New APIs\n\n### Reactive Props Destructure\n\nVue 3.5 stabilized reactive props destructure — destructured variables from `defineProps()` are automatically reactive:\n\n```ts\n\u002F\u002F Vue 3.5+: destructured props are reactive (no need for toRefs)\nconst { count = 0, msg = \"hello\" } = defineProps\u003C{\n  count?: number;\n  msg?: string;\n}>();\n\n\u002F\u002F Limitation: cannot watch destructured prop directly\nwatch(() => count, (newVal) => { ... }); \u002F\u002F PASS getter required\n```\n\n### `useTemplateRef()`\n\nReplace name-matched plain refs with `useTemplateRef()` for template references:\n\n```ts\nimport { useTemplateRef } from \"vue\";\nconst inputEl = useTemplateRef\u003CHTMLInputElement>(\"input\");\n\u002F\u002F \"input\" matches the ref=\"input\" attribute in template, not the variable name\n```\n\nSupports dynamic ref IDs: `useTemplateRef(dynamicRefId)`.\n\n### `onWatcherCleanup()`\n\nGlobally importable watcher cleanup API (Vue 3.5+). It must be called synchronously inside the watcher callback:\n\n```ts\nimport { watch, onWatcherCleanup } from \"vue\";\n\nwatch(userId, async (newId) => {\n  const controller = new AbortController();\n  onWatcherCleanup(() => controller.abort());\n  \u002F\u002F ... fetch with signal\n});\n```\n\n### `useId()`\n\nSSR-stable unique ID generation for form elements and accessibility:\n\n```ts\nimport { useId } from \"vue\";\nconst id = useId();\n```\n\n### `defer` Teleport\n\n`\u003CTeleport defer>` allows teleporting to targets rendered in the same cycle:\n\n```vue\n\u003CTeleport defer to=\"#container\">Content\u003C\u002FTeleport>\n\u003Cdiv id=\"container\">\u003C\u002Fdiv>\n```\n\n### Lazy Hydration (SSR)\n\n`defineAsyncComponent()` now supports `hydrate` strategy:\n\n```ts\nimport { defineAsyncComponent, hydrateOnVisible } from \"vue\";\nconst AsyncComp = defineAsyncComponent({\n  loader: () => import(\".\u002FComp.vue\"),\n  hydrate: hydrateOnVisible(),\n});\n```\n\n---\n\n## Anti-Patterns\n\n| Anti-Pattern | Why It's Wrong | The Fix |\n|-------------|---------------|---------|\n| Destructuring `defineProps()` (Vue \u003C 3.5) | Captures snapshot, loses reactivity | Access via `props.xxx` or use `toRefs()` |\n| `watch()` on destructured prop (Vue 3.5+) | Compile-time error — destructured props can't be watched directly | Use getter wrapper: `watch(() => count, ...)` |\n| `v-if` + `v-for` on same element | Ambiguous execution order | Use computed filtered array |\n| `v-for` key = index | Broken state on reorder | Use stable database IDs |\n| Mutating props | Violates one-way data flow | Emit events or use `v-model` |\n| `v-html` with user content | XSS vulnerability | Sanitize with DOMPurify |\n| Mixins in Vue 3 | Opaque, collision-prone | Replace with composables |\n| Module-scope side effects in composable | Shared across instances | Scope in `onMounted` + `onUnmounted` |\n| `reactive()` for replaceable state | Replacement breaks reactivity | Use `ref()` instead |\n| Watcher without cleanup | Memory leaks, race conditions | Use `onCleanup` or `onWatcherCleanup()` (Vue 3.5+) |\n| Options API in new Vue 3 code | Ecosystem move to Composition API | Use `\u003Cscript setup>` |\n| Plain ref for template references | No dynamic ref support, name-matching fragile | Use `useTemplateRef()` (Vue 3.5+) |\n\n## Related Skills\n\n- `accessibility` — ARIA, semantic HTML, focus management\n- `frontend-patterns` — Cross-framework frontend architecture\n- `typescript` — TypeScript best practices applied to Vue projects\n- `coding-standards` — General code quality standards\n",{"name":5,"origin":24,"description":7},"ECC","main","57e7aa6b6e03bce1a7d7862ba9c2ec312f7f19b5","src\u002Fcyril_code\u002Fassets\u002F.skills_repo\u002Fskills\u002Fvue-patterns",0,"https:\u002F\u002Fgithub.com\u002FCyrilthetecchieee\u002Fcyril-code-","https:\u002F\u002Fgithub.com\u002FCyrilthetecchieee","https:\u002F\u002Fwithcyril.me\u002F","Hi, I’m Julian Cyril D, a Computer Science and Business Systems student at PSNACET.\r\nI’m passionate about full-stack development, UI\u002FUX design, and building sma","2026-11-04 23:28:50",{"source":8,"skillName":5,"commands":35,"prompt":45,"zipAvailable":46},[36,39,42],{"tool":37,"command":38},"npx","npx skills add Cyrilthetecchieee\u002Fcyril-code- --skill vue-patterns",{"tool":40,"command":41},"bunx","bunx skills add Cyrilthetecchieee\u002Fcyril-code- --skill vue-patterns",{"tool":43,"command":44},"pnpm","pnpm dlx skills add Cyrilthetecchieee\u002Fcyril-code- --skill vue-patterns","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FCyrilthetecchieee\u002Fcyril-code-\u002Fblob\u002Fmain\u002Fsrc\u002Fcyril_code\u002Fassets\u002F.skills_repo\u002Fskills\u002Fvue-patterns\u002FSKILL.md",true,[],[49,58,65,73,80,87],{"skillNo":50,"name":51,"nameZh":6,"description":52,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":53,"licenseFileUrl":54,"sourceHtmlUrl":55,"categories":56,"keywords":57,"publishedAt":19},"01M7AQV6CYX8RMC78420V9WZ62","webapp-testing","Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.","Apache-2.0","https:\u002F\u002Fgithub.com\u002FCyrilthetecchieee\u002Fcyril-code-\u002Fblob\u002Fmain\u002Fsrc\u002Fcyril_code\u002Fassets\u002F.skills_repo\u002Fwebapp-testing\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002FCyrilthetecchieee\u002Fcyril-code-\u002Fblob\u002Fmain\u002Fsrc\u002Fcyril_code\u002Fassets\u002F.skills_repo\u002Fwebapp-testing\u002FSKILL.md",[],[],{"skillNo":59,"name":60,"nameZh":6,"description":61,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":62,"categories":63,"keywords":64,"publishedAt":19},"01M7AQV2895N3S1MEX6K76G6G2","youtube-downloader","Download YouTube videos with customizable quality and format options. Use this skill when the user asks to download, save, or grab YouTube videos. Supports various quality settings (best, 1080p, 720p, 480p, 360p), multiple formats (mp4, webm, mkv), and audio-only downloads as MP3.","https:\u002F\u002Fgithub.com\u002FCyrilthetecchieee\u002Fcyril-code-\u002Fblob\u002Fmain\u002Fsrc\u002Fcyril_code\u002Fassets\u002F.skills_repo\u002Fvideo-downloader\u002FSKILL.md",[],[],{"skillNo":66,"name":67,"nameZh":6,"description":68,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":53,"licenseFileUrl":69,"sourceHtmlUrl":70,"categories":71,"keywords":72,"publishedAt":19},"01M7AQTRNX62DNKVZ5GXEHRBKB","theme-factory","Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with colors\u002Ffonts that you can apply to any artifact that has been creating, or can generate a new theme on-the-fly.","https:\u002F\u002Fgithub.com\u002FCyrilthetecchieee\u002Fcyril-code-\u002Fblob\u002Fmain\u002Fsrc\u002Fcyril_code\u002Fassets\u002F.skills_repo\u002Ftheme-factory\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002FCyrilthetecchieee\u002Fcyril-code-\u002Fblob\u002Fmain\u002Fsrc\u002Fcyril_code\u002Fassets\u002F.skills_repo\u002Ftheme-factory\u002FSKILL.md",[],[],{"skillNo":74,"name":75,"nameZh":6,"description":76,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":77,"categories":78,"keywords":79,"publishedAt":19},"01M7AQTNNVHAAN9H6DA8T6ZVE0","template-skill","Replace with description of the skill and when Claude should use it.","https:\u002F\u002Fgithub.com\u002FCyrilthetecchieee\u002Fcyril-code-\u002Fblob\u002Fmain\u002Fsrc\u002Fcyril_code\u002Fassets\u002F.skills_repo\u002Ftemplate-skill\u002FSKILL.md",[],[],{"skillNo":81,"name":82,"nameZh":6,"description":83,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":84,"categories":85,"keywords":86,"publishedAt":19},"01M7AQTJ3MQ6AKX152MEX2MYCC","tailored-resume-generator","Analyzes job descriptions and generates tailored resumes that highlight relevant experience, skills, and achievements to maximize interview chances","https:\u002F\u002Fgithub.com\u002FCyrilthetecchieee\u002Fcyril-code-\u002Fblob\u002Fmain\u002Fsrc\u002Fcyril_code\u002Fassets\u002F.skills_repo\u002Ftailored-resume-generator\u002FSKILL.md",[],[],{"skillNo":88,"name":89,"nameZh":6,"description":90,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":53,"licenseFileUrl":91,"sourceHtmlUrl":92,"categories":93,"keywords":94,"publishedAt":19},"01M7AQTD7D5MYET2YWG7HG9WM3","slack-gif-creator","Toolkit for creating animated GIFs optimized for Slack, with validators for size constraints and composable animation primitives. This skill applies when users request animated GIFs or emoji animations for Slack from descriptions like \"make me a GIF for Slack of X doing Y\".","https:\u002F\u002Fgithub.com\u002FCyrilthetecchieee\u002Fcyril-code-\u002Fblob\u002Fmain\u002Fsrc\u002Fcyril_code\u002Fassets\u002F.skills_repo\u002Fslack-gif-creator\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002FCyrilthetecchieee\u002Fcyril-code-\u002Fblob\u002Fmain\u002Fsrc\u002Fcyril_code\u002Fassets\u002F.skills_repo\u002Fslack-gif-creator\u002FSKILL.md",[],[]]