From harness-claude
Manage shared application state with Pinia stores using Options or Setup syntax. Includes DevTools support, type safety, and lazy loading.
How this skill is triggered — by the user, by Claude, or both
Slash command
/harness-claude:vue-pinia-patternThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
> Manage shared application state with Pinia stores in the Options or Setup style
Manage shared application state with Pinia stores in the Options or Setup style
defineStore('id', { state, getters, actions }) or the Setup syntax.defineStore('id', () => { ... }).storeToRefs() when destructuring reactive state from a store.import { defineStore } from 'pinia';
import { ref, computed } from 'vue';
export const useCounterStore = defineStore('counter', () => {
const count = ref(0);
const doubled = computed(() => count.value * 2);
function increment() {
count.value++;
}
return { count, doubled, increment };
});
const store = useCounterStore().store.$reset() (Options API stores only) to reset state to initial values.Pinia is the official state management library for Vue 3. It replaces Vuex with a simpler, type-safe API. Pinia stores are reactive — components that use store state automatically re-render when it changes. Stores are lazy-loaded on first use.
Trade-offs:
provide/inject or composables may suffice$reset() — you must implement reset logic manuallyWhen NOT to use:
ref() or reactive() in <script setup>provide/injecthttps://patterns.dev/vue/pinia-pattern
npx claudepluginhub intense-visions/harness-engineering --plugin harness-claudeGuides Pinia v3 setup for Vue 3 state management with defineStore, getters, actions, option/setup syntaxes, Nuxt SSR, Vuex migration, hydration, and testing.
Provides Vue 3 expertise on Composition API, Pinia stores, Nuxt 3, Vue Router, custom directives, provide/inject, transitions, and Volar config. Use for building components, state design, routing, and reactivity debugging.
Guides Vue.js 3 Composition API patterns, component architecture, reactivity, Pinia state management, Vue Router, and Nuxt SSR. Activates for Vue, Nuxt, Vite, or Pinia projects.