vue-pinia-best-practices

Configure Pinia stores in Vue 3 apps to prevent setup timing errors.

Updated Dec 1, 2025
One-click install
npx skills add https://github.com/stevessr/dotsfiles --skill vue-pinia-best-practices-stevessr
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vue-pinia-best-practices
Source: https://github.com/stevessr/dotsfiles/tree/main/dot_agents/skills/vue-pinia-best-practices
Command: npx skills add https://github.com/stevessr/dotsfiles --skill vue-pinia-best-practices-stevessr

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Pinia best practices, common gotchas, and state management patterns.

Core Features & Use Cases

  • Store Setup: guidance to avoid "getActivePinia" error at startup and ensure state is preserved in SSR and DevTools.
  • Reactivity: avoid problematic destructuring and ensure store methods keep proper context in templates.
  • State Patterns: address ephemeral filters and DevTools/conventions for large apps.

Quick Start

Install Pinia in your Vue 3 app and apply these patterns to create robust stores, prevent common pitfalls, and ensure reliable state management.

Frequently Asked Questions about vue-pinia-best-practices

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

FAQPage Schema
How do I fix the getActivePinia error during Vue 3 startup?

To prevent the getActivePinia error in Vue 3, ensure the Pinia instance is registered on the app before mounting components. This skill provides setup patterns to avoid initialization timing errors and ensure state is preserved in SSR and DevTools.

Why does Pinia reactivity break when destructuring store properties in Vue 3?

Pinia reactivity breaks during destructuring because detached references lose their reactive context. This skill guides you to avoid problematic destructuring and use proper store methods to maintain reactivity in Vue 3 templates.

What are the best practices for configuring Pinia stores for SSR in Vue?

Configuring Pinia stores for SSR in Vue requires specific setup patterns to ensure state is preserved and hydrated correctly. This skill addresses SSR considerations and devtools compatibility to prevent state management gotchas.

How do I manage ephemeral state and filters in large Pinia applications?

To manage ephemeral filters in large Pinia applications, follow specific state patterns and devtools conventions. This skill provides guidance on addressing ephemeral filters and managing state effectively in large apps.

Does this Pinia state management guidance work for Vue 2?

No, this Pinia state management guidance is specifically designed for Vue 3 applications. It requires Vue 3 and Pinia to cover store setup patterns, reactivity best practices, and SSR considerations.