pinia

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

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Managing shared state across Vue components becomes error-prone with ad-hoc patterns, and developers need guidance on defining stores, handling reactivity, and integrating with SSR and Nuxt correctly. ## Core Features & Use Cases - Store Definition Patterns: Define Option Stores and Setup Stores with state, getters, and actions, including TypeScript typing and storeToRefs for safe destructuring. - Ecosystem Integration: Use composables, plugins, store composition, and Nuxt auto-imports with SSR state hydration. - Testing & Best Practices: Unit test stores with @pinia/testing, stub actions, mock getters, and enable HMR for development. - Use Case: When building a Nuxt 3 app that needs a cart store shared across pages, use this Skill to define the store, hydrate state on the client, and test it with mocked actions. ## Quick Start Use the pinia skill to create a setup store for user authentication with state, getters, and an async login action.

Frequently Asked Questions about pinia

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

FAQPage Schema
How do I define a store in Pinia?

Define a Pinia store with defineStore() using either the Option Store syntax (state, getters, actions objects) or the Setup Store syntax 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 modules. Stores in the stores directory are auto-imported, and SSR serialization plus XSS protection are handled automatically.

Why does destructuring a Pinia store break reactivity?

Destructuring state or getters directly from a store loses reactivity because they are plain values. Use storeToRefs() to extract state and getters as refs; actions can be destructured directly since they are bound to the store.

How do I test Pinia stores in Vue components?

Install @pinia/testing and mount components with createTestingPinia() as a global plugin. Actions are stubbed by default, initial state can be injected, and getters can be overridden directly in tests.

Does Pinia support server-side rendering?

Yes, Pinia supports SSR by calling stores inside setup or functions rather than module scope, and passing the pinia instance to useStore() in guards. Serialize state with devalue on the server and hydrate pinia.state.value on the client before any useStore call.