vue-state-management

Guide Vue 3 developers in selecting state management approaches for SPAs.

9|1|Updated Jun 16, 2026
One-click install
npx skills add https://github.com/AratKruglik/antigravity-sdlc --skill vue-state-management
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vue-state-management
Source: https://github.com/AratKruglik/antigravity-sdlc/tree/main/plugins/vue-plugin/skills/vue-state-management
Command: npx skills add https://github.com/AratKruglik/antigravity-sdlc --skill vue-state-management

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

State management decision tree for Vue 3 SPAs: ref/reactive locally, composables for shared logic, Pinia for app-wide state, provide/inject for DI, TanStack Query Vue for server state. Vuex pointer for Vue 2 legacy.

Core Features & Use Cases

  • Choose the right state tool based on data shape (local, shared, server, form).
  • Implement a Pinia store with Setup syntax (preferred).
  • Use provide/inject correctly with InjectionKey<T> and patterns.
  • Set up TanStack Query Vue for server state caching and data fetching.
  • Migrate from Vuex with caution when BA asks.

Quick Start

Provide a simple real-world instruction.

Frequently Asked Questions about vue-state-management

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

FAQPage Schema
When should I use Pinia versus composables for Vue 3 state management?

Use Pinia for app-wide shared state across components, and use composables for extracting and reusing shared logic locally. Vue 3 state management scales best when Pinia handles global stores while composables manage isolated feature logic.

How do I manage server state in Vue 3 applications?

Manage server state in Vue 3 using TanStack Query Vue for data caching and fetching. It handles remote data synchronization natively, separating server state from local component state managed by ref or reactive.

What is the best way to migrate from Vuex to Pinia in a Vue 3 SPA?

Migrate from Vuex to Pinia cautiously, typically when business requirements demand it. Pinia uses a Setup syntax that simplifies store definitions, but ensure you map existing Vuex mutations and getters to Pinia's state and computed properties.

Does Vue 3 provide/inject work for sharing state across components?

Provide/inject works for Vue 3 state sharing via dependency injection. Use InjectionKey<T> to ensure type safety when passing data down the component tree, making it ideal for shared state scoped to specific feature branches.

Do I need Pinia for local component state in Vue 3?

You do not need Pinia for local component state in Vue 3. Use the built-in ref and reactive APIs for local data management within a single component, reserving Pinia for complex app-wide state architecture.

How do I structure a Pinia store with the Setup syntax?

Structure a Pinia store using the Setup syntax by defining state as ref or reactive, getters as computed properties, and actions as functions. This approach aligns Pinia with Vue 3 Composition API patterns for maintainable state.