
Pinia V3
- 196 repo stars
- Updated July 25, 2026
- secondsky/claude-skills
Manage Vue 3 state with Pinia v3 using defineStore, getters, and actions, including Nuxt SSR and Vuex migration.
About
A frontend skill for Vue 3 state management with Pinia v3 using defineStore, getters, and actions. A developer uses it to build stores, handle Nuxt SSR and hydration, migrate from Vuex, and resolve store-composition and testing errors.
- Pinia v3 defineStore
- Getters and actions
- Nuxt SSR support
- Vuex migration
Pinia V3 by the numbers
- Data as of Jul 28, 2026 (Skillselion catalog sync)
/plugin marketplace add secondsky/claude-skills/plugin install pinia-v3@claude-skillsAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| repo stars | ★ 196 |
|---|---|
| Last updated | July 25, 2026 |
| Repository | secondsky/claude-skills ↗ |
What it does
Manage Vue 3 state with Pinia v3 using defineStore, getters, and actions, including Nuxt SSR and Vuex migration.
README.md
Pinia v3 - Vue State Management
Status: Production Ready ✅ Last Updated: 2025-11-11 Production Tested: Official Vue state management library, used in production Vue 3 applications worldwide
Auto-Trigger Keywords
Claude Code automatically discovers this skill when you mention:
Primary Keywords
- pinia
- pinia v3
- pinia stores
- vue state management
- defineStore
- createPinia
- vue 3 state
- pinia nuxt
- @pinia/nuxt
Secondary Keywords
- storeToRefs
- option stores
- setup stores
- pinia getters
- pinia actions
- pinia plugins
- pinia ssr
- state hydration
- store composition
- vue stores
- nuxt state
- pinia devtools
- pinia hmr
Error-Based Keywords
- "getActivePinia() was called with no active Pinia"
- "lost reactivity"
- "state not updating"
- "pinia destructuring"
- "$reset is not a function"
- "circular dependency"
- "useStore is not a function"
- "pinia not installed"
- "store not found"
- "vuex migration"
- "vuex to pinia"
What This Skill Does
This skill provides comprehensive knowledge for building Vue 3 applications with Pinia, the official state management library. It covers store creation, state management patterns, SSR hydration, testing strategies, Nuxt integration, and migration from Vuex.
Core Capabilities
✅ Store Creation: Option stores and setup stores with complete TypeScript support ✅ State Management: Defining, accessing, mutating, and subscribing to state changes ✅ Getters & Actions: Computed properties and async business logic patterns ✅ Store Composition: Safe patterns for sharing state between stores ✅ Plugins: Extending stores with custom functionality (persistence, debouncing, etc.) ✅ SSR Support: State hydration for server-side rendering with Nuxt ✅ Testing: Unit and component testing with @pinia/testing ✅ Options API: Full support for Vue Options API with mappers ✅ Hot Module Replacement: Live editing stores without page reload ✅ Vuex Migration: Complete migration guide from Vuex to Pinia ✅ DevTools Integration: Time-travel debugging and state inspection ✅ TypeScript: Full type inference and type safety
Known Issues This Skill Prevents
| Issue | Why It Happens | How Skill Fixes It |
|---|---|---|
| Lost reactivity from destructuring | JavaScript destructuring breaks Vue reactivity | Always use storeToRefs() for state/getters |
| Dynamic state properties not reactive | Pinia needs upfront property declaration | Declare all properties in state() initially |
| "getActivePinia() was called with no active Pinia" | Calling useStore() before app.use(pinia) |
Call app.use(pinia) before mounting |
| Setup store private state breaks SSR | Non-returned properties aren't tracked | Return ALL state from setup stores |
TypeScript errors with getter this |
Known TS limitation with type inference | Explicitly type return values |
| $reset() not available in setup stores | Setup stores don't have built-in reset | Implement custom $reset() function |
Actions after await break SSR |
Wrong Pinia instance used post-await | Call all useStore() before any await |
| Circular store dependencies crash | Both stores read each other's state | Use getters/actions for cross-store access |
| XSS vulnerability in SSR serialization | JSON.stringify() doesn't escape code |
Use devalue library for serialization |
| HMR not working in development | Vite/webpack HMR not configured | Add acceptHMRUpdate() block |
| Composables break option stores | state() can only return writable refs |
Use setup stores for complex composables |
| Tests fail intermittently | Shared Pinia instance across tests | Create fresh Pinia in beforeEach() |
When to Use This Skill
✅ Use When:
- Setting up Pinia in Vue 3 applications
- Creating new stores with state, getters, and actions
- Migrating from Vuex to Pinia
- Implementing SSR with Pinia (Nuxt or custom)
- Testing components that use Pinia stores
- Using Pinia with Options API
- Creating store plugins for persistence or middleware
- Composing stores and sharing state between them
- Debugging state management issues
- Setting up HMR for stores in development
- Using composables within stores
- Implementing authentication or API data stores
❌ Don't Use When:
- Working with Vue 2 (use Vuex or Pinia with compatibility layer)
- Building non-Vue applications
- State is purely local to a single component (use component state)
- Using Vuex 4+ and migration isn't needed
Quick Usage Example
# 1. Install Pinia
bun add pinia
# 2. Create and register Pinia
# main.ts
import { createApp } from 'vue'
import { createPinia } from 'pinia'
import App from './App.vue'
const pinia = createPinia()
const app = createApp(App)
app.use(pinia)
app.mount('#app')
// 3. Define a store
// stores/counter.ts
import { defineStore } from 'pinia'
export const useCounterStore = defineStore('counter', {
state: () => ({ count: 0 }),
getters: {
doubleCount: (state) => state.count * 2
},
actions: {
increment() {
this.count++
}
}
})
<!-- 4. Use in component -->
<script setup>
import { useCounterStore } from '@/stores/counter'
const counter = useCounterStore()
</script>
<template>
<button @click="counter.increment">
Count: {{ counter.count }}
</button>
</template>
Result: Working Pinia store with reactive state, computed getters, and type-safe actions
Full instructions: See SKILL.md
Package Versions (Verified 2025-11-11)
| Package | Version | Status |
|---|---|---|
| pinia | 3.0.4 | ✅ Latest stable |
| @pinia/nuxt | 0.11.2 | ✅ Latest stable |
| @pinia/testing | 1.0.2 | ✅ Latest stable |
| vue | 3.5.24 | ✅ Compatible |
| devalue | 5.3.2 | ✅ For SSR serialization |
Dependencies
Prerequisites: Vue 3.0+ (or Vue 2.7 with @vue/composition-api)
Integrates With:
- nuxt (optional) - SSR with @pinia/nuxt module
- vue-router (optional) - Navigation guards with stores
- vitest (optional) - Unit testing with @pinia/testing
- @vue/test-utils (optional) - Component testing
File Structure
pinia-v3/
├── SKILL.md # Complete documentation
├── README.md # This file
├── scripts/ # Example store templates
│ ├── option-store-template.ts
│ ├── setup-store-template.ts
│ ├── auth-store-example.ts
│ ├── api-store-example.ts
│ └── persistence-plugin.ts
├── references/ # Deep-dive guides
│ └── vuex-migration-checklist.md
└── assets/ # (empty - no static assets needed)
Official Documentation
- Pinia: https://pinia.vuejs.org/
- Getting Started: https://pinia.vuejs.org/getting-started.html
- Core Concepts: https://pinia.vuejs.org/core-concepts/
- SSR Guide: https://pinia.vuejs.org/ssr/
- Nuxt Integration: https://pinia.vuejs.org/ssr/nuxt.html
- Testing Guide: https://pinia.vuejs.org/cookbook/testing.html
- Vuex Migration: https://pinia.vuejs.org/cookbook/migration-vuex.html
- GitHub: https://github.com/vuejs/pinia
- Context7 Library: N/A
Related Skills
- nuxt - Nuxt 3 framework with built-in Pinia support
- vue-router - Vue routing for protected routes with auth stores
- vitest - Testing framework for unit testing stores
Contributing
Found an issue or have a suggestion?
- Open an issue: https://github.com/secondsky/claude-skills/issues
- See SKILL.md for detailed documentation
License
MIT License - See main repo LICENSE file
Production Tested: Official Vue.js state management library, battle-tested in thousands of production applications Token Savings: ~65% Error Prevention: 100% (12 documented issues prevented) Ready to use! See SKILL.md for complete setup.