vue-patterns

Guide Vue 3 Composition API, reactivity, Pinia, and SSR patterns.

1|Updated Mar 1, 2026
One-click install
npx skills add https://github.com/hjemmesidekongen/ai --skill vue-patterns-hjemmesidekongen
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vue-patterns
Source: https://github.com/hjemmesidekongen/ai/tree/main/plugins/smedjen/skills/vue-patterns
Command: npx skills add https://github.com/hjemmesidekongen/ai --skill vue-patterns-hjemmesidekongen

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps developers write more maintainable, scalable, and performant Vue.js applications by providing best practices and patterns for modern Vue development.

Core Features & Use Cases

  • Composition API: Learn advanced patterns for extracting and composing logic.
  • Reactivity System: Understand ref, reactive, computed, watch, and their pitfalls.
  • Pinia State Management: Master store composition, plugins, and persistence.
  • SSR/Nuxt: Avoid hydration mismatches and understand server-side rendering nuances.
  • Use Case: Refactor a complex Vue component by extracting reusable logic into composables, improving testability and reducing code duplication.

Quick Start

Review the best practices for using provide and inject for dependency injection in Vue applications.

Frequently Asked Questions about vue-patterns

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

FAQPage Schema
How do I extract reusable logic using Vue 3 Composition API composables?

Vue 3 Composition API allows extracting reusable logic into composables, which are functions encapsulating reactive state and methods. This pattern improves testability and reduces code duplication by isolating complex component logic.

Why does destructuring a reactive object break reactivity in Vue 3?

Destructuring a reactive object breaks reactivity in Vue 3 because primitive values lose their reactive proxies when unpacked. To maintain reactivity, you should use ToRefs or avoid destructuring reactive objects directly, preventing common state synchronization pitfalls.

What is the best way to manage state in Vue 3 with Pinia?

The best way to manage state in Vue 3 with Pinia is by using store composition and plugins. Pinia offers a straightforward API for defining stores, handling persistence, and integrating seamlessly with the Composition API for scalable applications.

How do I avoid hydration mismatches during Vue SSR?

To avoid hydration mismatches during Vue SSR, you must ensure server and client render identical content initially. This involves understanding server-side rendering nuances and carefully managing asynchronous data fetching and browser-only APIs within Nuxt.

Can I use provide and inject for dependency injection in Vue?

Yes, you can use provide and inject for dependency injection in Vue applications. This pattern allows parent components to supply dependencies to deeply nested child components without prop drilling, following best practices for clean architecture.

How do I migrate Vue 2 components to Vue 3 Composition API?

Migrating Vue 2 components to Vue 3 Composition API involves replacing Options API logic with setup functions, refs, and computeds. You progressively refactor data properties, methods, and lifecycle hooks into composable structures for better maintainability.