Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
ejirocodes avatar

Vue Best Practices

  • 140 installs
  • 5 repo stars
  • Updated June 25, 2026
  • ejirocodes/agent-skills

For integrating A developer tool for AI integration and automation

About

A developer tool for AI integration and automation. This is a developer tool for building and integrating AI-powered features.

  • AI
  • Developer tool

Vue Best Practices by the numbers

  • 140 all-time installs (skills.sh)
  • Ranked #3,485 of 16,546 AI & Agent Building skills by installs in the Skillselion catalog
  • Data as of Jul 24, 2026 (Skillselion catalog sync)
npx skills add https://github.com/ejirocodes/agent-skills --skill vue-best-practices

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs140
repo stars5
Last updatedJune 25, 2026
Repositoryejirocodes/agent-skills

What it does

For integrating A developer tool for AI integration and automation

Files

SKILL.mdMarkdownGitHub ↗

Vue 3 Best Practices

Quick Reference

TopicWhen to UseReference
TypeScriptProps extraction, generic components, useTemplateRef, JSDoc, reactive props destructuretypescript.md
VolarIDE config, strictTemplates, CSS modules, directive comments, Volar 3.0 migrationvolar.md
ComponentsdefineModel, deep watch, onWatcherCleanup, useId, deferred teleportcomponents.md
ToolingmoduleResolution, HMR SSR, duplicate plugin detectiontooling.md
TestingPinia store mocking, setup stores, Vue Router typed paramstesting.md

Essential Patterns

Extract Component Props

import type { ComponentProps } from 'vue-component-type-helpers'
import MyButton from './MyButton.vue'

type Props = ComponentProps<typeof MyButton>

Reactive Props Destructure (Vue 3.5+)

<script setup lang="ts">
// Destructured props are reactive - preferred in Vue 3.5+
const { name, count = 0 } = defineProps<{ name: string; count?: number }>()
</script>

useTemplateRef (Vue 3.5+)

<script setup lang="ts">
import { useTemplateRef, onMounted } from 'vue'

const inputRef = useTemplateRef('input')  // Auto-typed
onMounted(() => inputRef.value?.focus())
</script>
<template><input ref="input" /></template>

onWatcherCleanup (Vue 3.5+)

import { watch, onWatcherCleanup } from 'vue'

watch(query, async (q) => {
  const controller = new AbortController()
  onWatcherCleanup(() => controller.abort())
  await fetch(`/api?q=${q}`, { signal: controller.signal })
})

defineModel with Required

// Returns Ref<Item> instead of Ref<Item | undefined>
const model = defineModel<Item>({ required: true })

Deep Watch with Numeric Depth

// Vue 3.5+ - watch array mutations without full traversal
watch(items, handler, { deep: 1 })

Pinia Store Test Setup

import { createTestingPinia } from '@pinia/testing'
import { vi } from 'vitest'

mount(Component, {
  global: {
    plugins: [createTestingPinia({ createSpy: vi.fn })]
  }
})

Common Mistakes

1. Using `InstanceType<typeof Component>['$props']` - Use ComponentProps instead 2. Missing `createSpy` in createTestingPinia - Required in @pinia/testing 1.0+ 3. Using `withDefaults` with union types - Use Reactive Props Destructure 4. `strictTemplates` in wrong tsconfig - Add to tsconfig.app.json, not root 5. ts_ls with Volar 3.0 - Use vtsls instead (Neovim) 6. `deep: true` on large structures - Use numeric depth for performance 7. Watching destructured props directly - Wrap in getter: watch(() => count, ...) 8. Random IDs in SSR - Use useId() for hydration-safe IDs

Related skills

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.