vue-pinia-best-practices

Analyze Pinia stores in Vue 3 applications for state-management pitfalls.

Updated Mar 24, 2026
One-click install
npx skills add https://github.com/NgDuyKhanhs/open-mmo --skill vue-pinia-best-practices-ngduykhanhs
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vue-pinia-best-practices
Source: https://github.com/NgDuyKhanhs/open-mmo/tree/main/frontend/.agents/skills/vue-pinia-best-practices
Command: npx skills add https://github.com/NgDuyKhanhs/open-mmo --skill vue-pinia-best-practices-ngduykhanhs

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

  • Identify and fix common Pinia pitfalls (setup timing, state exposure, reactive destructuring, and template method binding).
  • Provide guidelines for large-scale store architecture, SSR compatibility, and DevTools integration.
  • Real-world scenarios with code-smell checks and recommended patterns.

Quick Start

Analyze an existing Pinia setup and apply best-practices to ensure all state is returned, stores are used after initialization, and template interactions preserve reactivity.

Frequently Asked Questions about vue-pinia-best-practices

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

FAQPage Schema
Why does destructuring Pinia store state break reactivity in Vue 3?

Destructuring Pinia store properties in Vue 3 breaks reactivity because it detaches the reference from the reactive proxy. Use the store object directly in templates or wrap destructured properties in storeToRefs to maintain reactive state.

How do I expose state correctly when using setup stores in Pinia?

To expose state correctly in Pinia setup stores, return all reactive state properties from the setup function. This ensures the state is accessible and maintains reactivity across your Vue 3 application components.

What are common Pinia pitfalls for large-scale Vue 3 applications?

Common Pinia pitfalls include improper setup timing, failing to return all state in setup stores, losing reactivity through destructuring, and incorrect template method binding. Following established patterns prevents these scalable state management issues.

Can I use Pinia for state management across multiple stores in Vue 3?

Yes, Pinia supports state management across multiple stores in Vue 3. You can architect scalable state patterns by ensuring proper store initialization, avoiding destructuring, and correctly binding template interactions.

How do I fix template method binding issues with Pinia stores?

Fix template method binding issues by ensuring Pinia stores are used after initialization and methods are properly bound. Avoid reactive destructuring of methods and call them directly from the store instance in your Vue 3 templates.