state-management

Guide frontend state management with TanStack Query, Pinia, and Zustand.

Updated Mar 8, 2026
One-click install
npx skills add https://github.com/messeb/skills --skill state-management-messeb
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: state-management
Source: https://github.com/messeb/skills/tree/main/plugins/frontend-developer/skills/state-management
Command: npx skills add https://github.com/messeb/skills --skill state-management-messeb

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps developers choose and implement the most appropriate state management strategy for their frontend application, preventing common pitfalls like over-fetching, prop drilling, and unnecessary global state.

Core Features & Use Cases

  • State Decision Tree: Guides developers on when to use local state, server state libraries, or global stores.
  • Server State Management: Demonstrates best practices with TanStack Query (Vue Query/React Query) for fetching, caching, and mutating server data.
  • Global Client State: Provides examples for managing global UI or application state using Pinia (Vue) and Zustand (React).
  • Form State Management: Illustrates efficient form handling with libraries like VeeValidate and React Hook Form.
  • Use Case: A developer is unsure whether to use Pinia or TanStack Query for managing user profile data that is fetched from an API. This Skill provides clear guidance and code examples for both scenarios, highlighting the benefits of server state management for API-driven data.

Quick Start

Use the state-management skill to demonstrate how to fetch user data using TanStack Query.

Frequently Asked Questions about state-management

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

FAQPage Schema
When should I use TanStack Query instead of a global state store like Zustand?

Server state management with TanStack Query is ideal for fetching, caching, and mutating API data, while Zustand should be reserved for global client state like UI preferences. Colocating server state in query caches prevents over-fetching and unnecessary global state.

What is the best way to manage form state in React and Vue?

Form state management is best handled by dedicated libraries like React Hook Form and VeeValidate, which isolate input state from global component state to optimize rendering and validation performance.

How do I stop prop drilling and decide between local and global state?

To stop prop drilling, evaluate state colocation first, keeping data local to components when possible. Use a state decision tree to determine if data requires global client state via Pinia or Zustand for broader access.

Can I use Pinia for server state, or should I use Vue Query?

Vue Query is specifically designed for server state management, handling caching and data synchronization automatically. Pinia should be used for global client state, making them complementary rather than interchangeable for API-driven data.

What are common frontend state management anti-patterns I should audit for?

Common anti-patterns include unnecessary global state, over-fetching server data, and prop drilling. An audit checklist helps identify these issues by evaluating state colocation and verifying server state is managed by libraries like TanStack Query.