pinia

Implement type-safe state management in Vue applications using Pinia stores.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Managing shared state across Vue components becomes error-prone and untyped as applications grow, especially with SSR, testing, and cross-store communication requirements. ## Core Features & Use Cases - Store Definition Patterns: Define Option Stores or Setup Stores with state, getters, and actions, including TypeScript typing and storeToRefs for safe destructuring. - Advanced Integration: Handle SSR state hydration, Nuxt auto-imports, hot module replacement, and plugins that extend every store with custom properties. - Testing Support: Unit test stores and components with @pinia/testing, action stubbing, and mocked getters. - Use Case: When building a Nuxt 3 application with authentication and shopping cart state, use this Skill to define composable stores, share data between them without circular dependencies, and hydrate state correctly during SSR. ## Quick Start Use the pinia skill to create a type-safe setup store for user authentication with state, getters, and async actions.

Frequently Asked Questions about pinia

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

FAQPage Schema
How do I define a Pinia store in Vue?

Define a Pinia store using defineStore() with a unique name, choosing either Option Stores (state, getters, actions objects) or Setup Stores (Composition API with ref, computed, and functions). Setup Stores are recommended for complex logic and composables.

How to use Pinia with Nuxt 3?

Install the @pinia/nuxt module with nuxi module add pinia, then add it to nuxt.config.ts modules. Stores in the stores/ directory are auto-imported, and SSR serialization is handled automatically.

Why does destructuring a Pinia store break reactivity?

Destructuring state or getters directly from a store extracts raw values and loses reactivity. Use storeToRefs() to destructure state and getters as refs, while actions can be destructured directly since they are bound to the store.

Does Pinia support server-side rendering?

Yes, Pinia supports SSR when stores are called inside setup or functions rather than at module scope. Serialize state on the server with devalue and hydrate pinia.state.value on the client before any useStore() call.

How do I test Pinia stores and components?

Unit test stores by calling setActivePinia(createPinia()) in beforeEach. For components, install @pinia/testing and use createTestingPinia(), which stubs actions by default and allows setting initial state and mocking getters.

How do I avoid circular dependencies between Pinia stores?

Avoid reading another store's state during store setup, as mutual reads cause infinite loops. Instead, access the other store inside getters, computed properties, or actions where evaluation is deferred.