vue-pinia-best-practices

Consolidate Pinia best practices for Vue 3 store setup and reactivity.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Pinia is a powerful state management solution for Vue 3 applications, but teams frequently encounter subtle pitfalls that hamper reactivity, debugging, and maintainability. This Skill consolidates proven patterns, anti-patterns, and pragmatic guidance to keep Pinia stores robust and scalable.

Core Features & Use Cases

  • Store setup conventions for both setup and options styles to ensure a consistent structure.
  • Reactivity patterns and safe template usage, including storeToRefs and correct method binding.
  • Debugging, SSR hydration, and architecture guidance for large-scale apps that rely on Pinia.

Quick Start

Install Pinia in your project, define a store using the recommended pattern, and wire it into your Vue components. Import the store in components with proper reactive bindings, and follow the examples to avoid common gotchas.

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 prevent Pinia reactivity issues in Vue 3 applications?

Prevent Pinia reactivity issues by using storeToRefs to extract state and getters, ensuring setup stores return all state, and binding methods correctly to maintain reactivity across Vue 3 components.

What is the best way to structure Pinia stores for large-scale Vue apps?

The best way to structure Pinia stores for large-scale Vue apps is following consistent setup conventions for both setup and options styles, ensuring scalable state management architecture.

How do I handle Pinia SSR hydration problems with Vue 3?

Handle Pinia SSR hydration problems by applying consolidated state management patterns that address server-side rendering gotchas, ensuring safe usage templates for hydration in Vue 3.

Does Pinia work with Vue DevTools for debugging state management?

Yes, Pinia works with Vue DevTools for debugging state management, providing scenarios and patterns to inspect reactivity, trace store state, and debug large-scale applications effectively.

Why does my Pinia store lose reactivity when destructuring properties?

Pinia stores lose reactivity when destructuring properties because state values are detached; using storeToRefs resolves this common gotcha by preserving reactivity patterns during property extraction.

When should I not use Pinia options style for Vue state management?

Avoid Pinia options style when your Vue state management requires complex async logic or composables reuse; setup stores provide safer usage patterns and templates for scalable architectures.