vue-best-practices

Applies Vue 3 Composition API best practices for components, reactivity, composables, and performance.

Updated Sep 17, 2026
One-click install
npx skills add https://github.com/bramanda48/skills --skill vue-best-practices-bramanda48
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vue-best-practices
Source: https://github.com/bramanda48/skills/tree/main/skills/vue-best-practices
Command: npx skills add https://github.com/bramanda48/skills --skill vue-best-practices-bramanda48

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Vue projects often accumulate inconsistent patterns: oversized components, unclear data flow, misused reactivity primitives, and premature optimization. This Skill provides a structured workflow that enforces Vue 3 best practices so generated or refactored code follows predictable, maintainable conventions. ## Core Features & Use Cases - Architecture-First Workflow: Confirms the stack (Vue 3 + Composition API + <script setup lang="ts">) and plans component boundaries before writing code. - Core Reference Library: Ships in-depth references on reactivity, SFC structure, component data flow, and composables that must be applied to every Vue task. - On-Demand Feature Guidance: Loads targeted references for slots, Teleport, Suspense, KeepAlive, transitions, directives, plugins, and state management only when requirements call for them. - Performance Pass: Applies virtualization, v-once/v-memo, and list-abstraction guidance strictly after behavior is verified. - Use Case: Ask the agent to build a CRUD todo feature in Vue; it will split the UI into container, form, list, and filter components, use typed props/emits contracts, extract stateful logic into composables, and only then consider performance tuning. ## Quick Start Use the vue-best-practices skill to build a typed Vue 3 todo list feature with Composition API and script setup.

Frequently Asked Questions about vue-best-practices

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I structure Vue 3 components with Composition API?

Use script setup with TypeScript, keep each component to a single responsibility, and split components that own both state orchestration and multiple UI sections. Move reusable stateful logic into composables and keep route-level views as thin composition surfaces.

Should I use ref, reactive, or shallowRef in Vue 3?

Use shallowRef for primitives, ref when you frequently replace entire objects, reactive when you mainly mutate properties in place, and shallowRef for opaque external instances. Derive values with computed and reserve watchers for side effects.

Composition API vs Options API in Vue 3, which should I use?

Composition API with script setup is the recommended default for new Vue 3 work, offering better TypeScript inference and logic reuse via composables. Options API remains valid when a project explicitly standardizes on it.

When should I use KeepAlive, Teleport, or Suspense in Vue?

Use KeepAlive to preserve state across tab or view switches, Teleport for overlays that must escape stacking contexts, and Suspense to coordinate async dependencies with fallback UI. Add them only when the requirement exists, not by default.

How do I optimize large list rendering performance in Vue?

Virtualize lists over roughly 50-100 items using vue-virtual-scroller or @tanstack/vue-virtual so only visible rows render. Also flatten component abstraction in list items and apply v-memo so items re-render only when their relevant state changes.

Why is my Vue watcher not firing on reactive object properties?

watch() requires a getter, ref, or reactive object; passing state.count directly loses reactivity. Use a getter like () => state.count or convert properties with toRefs before watching them.