1---2name: pinia3description: Pinia official Vue state management library, type-safe and extensible. Use when defining stores, working with state/getters/actions, or implementing store patterns in Vue apps.4---56# Pinia78Pinia is the official state management library for Vue, designed to be intuitive and type-safe. It supports both Options API and Composition API styles, with first-class TypeScript support and devtools integration.910> The skill is based on Pinia v3.0.4, generated at 2026-01-28.1112## Core References1314| Topic | Description | Reference |15|-------|-------------|-----------|16| Stores | Defining stores, state, getters, actions, storeToRefs, subscriptions | [core-stores](references/core-stores.md) |1718## Features1920### Extensibility2122| Topic | Description | Reference |23|-------|-------------|-----------|24| Plugins | Extend stores with custom properties, state, and behavior | [features-plugins](references/features-plugins.md) |2526### Composability2728| Topic | Description | Reference |29|-------|-------------|-----------|30| Composables | Using Vue composables within stores (VueUse, etc.) | [features-composables](references/features-composables.md) |31| Composing Stores | Store-to-store communication, avoiding circular dependencies | [features-composing-stores](references/features-composing-stores.md) |3233## Best Practices3435| Topic | Description | Reference |36|-------|-------------|-----------|37| Testing | Unit testing with @pinia/testing, mocking, stubbing | [best-practices-testing](references/best-practices-testing.md) |38| Outside Components | Using stores in navigation guards, plugins, middlewares | [best-practices-outside-component](references/best-practices-outside-component.md) |3940## Advanced4142| Topic | Description | Reference |43|-------|-------------|-----------|44| SSR | Server-side rendering, state hydration | [advanced-ssr](references/advanced-ssr.md) |45| Nuxt | Nuxt integration, auto-imports, SSR best practices | [advanced-nuxt](references/advanced-nuxt.md) |46| HMR | Hot module replacement for development | [advanced-hmr](references/advanced-hmr.md) |4748## Key Recommendations4950- **Prefer Setup Stores** for complex logic, composables, and watchers51- **Use `storeToRefs()`** when destructuring state/getters to preserve reactivity52- **Actions can be destructured directly** - they're bound to the store53- **Call stores inside functions** not at module scope, especially for SSR54- **Add HMR support** to each store for better development experience55- **Use `@pinia/testing`** for component tests with mocked stores