SKILL.md
418 lines · 1,694 words
State Management
Purpose
Select and implement the right state management approach for each use case in a web application. This skill provides decision frameworks, implementation patterns, and best practices for every category of application state.
State Category Classification
CATEGORY EXAMPLES RECOMMENDED SOLUTION
---------------------------------------------------------------------------
UI State Modal open/close, accordion, useState / useReducer
(ephemeral) tooltip visible, active tab (component-local)
Shared UI State Sidebar collapsed, theme, Context / Zustand / Jotai
notification queue
Server State API data, user profile, TanStack Query / SWR
(cached) list of items
URL State Current page, filters, URL search params (nuqs)
sort order, pagination
Form State Input values, validation, React Hook Form / Formik
dirty/touched tracking
Auth State Current user, tokens, Zustand / Context
permissions
Complex Workflows Multi-step forms, checkout, XState (state machines)
onboarding flows