Agent skill

React State Management

by involvex in involvex/youtube-music-cli

Master modern React state management with Redux Toolkit, Zustand, Jotai, and React Query.

MITAuto-check passedFrontend & Design

Install React State Management

skills CLI
$ npx skills add involvex/youtube-music-cli --skill react-state-management -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install involvex/youtube-music-cli react-state-management --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/involvex/youtube-music-cli.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/react-state-management .claude/skills/react-state-management && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
react-state-management
GitHub stars
456
Used in
13 other repos
Token cost
~3k tokens
SKILL.md length
312 words
Files
1
Skills in repo
6
Repo updated
First seen
Licence
MIT

At a glance

Master modern React state management with Redux Toolkit, Zustand, Jotai, and React Query.

  • Works in 2 steps: State Categories → Selection Criteria
  • Setting up global state
  • SKILL.md covers Do not use this skill when, Instructions, Use this skill when and Core Concepts, plus 5 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

React State Management is an agent skill from involvex/youtube-music-cli. Master modern React state management with Redux Toolkit, Zustand, Jotai, and React Query. Use when setting up global state, managing server state, or choosing between state management solutions.

Its SKILL.md is about 3k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Frontend & Design, covering State management. It works with Redux, Zustand, TanStack and YouTube. The repository describes itself as: A powerful Terminal User Interface (TUI) music player for YouTube Music. The licence is MIT.

When your agent uses it

  • Setting up global state
  • Managing server state
  • Choosing between state management solutions

Example prompts

  • “/react-state-management”

Workflow steps

2 steps, taken from the step headings in SKILL.md.

  1. State Categories
  2. Selection Criteria

What it can do on your machine

Read from SKILL.md and the folder at commit d4c5809. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are typescript).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • redux-toolkit.js.org
    • github.com
    • jotai.org
    • tanstack.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

React State Management loads about 3k tokens when it runs. Until then it costs about 54 tokens; SKILL.md has 312 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~54
When it runs · the whole SKILL.md, loaded when a task matches
~3k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from involvex/youtube-music-cli at commit d4c5809, republished under its MIT licence (© involvex). 312 words, ~2,977 tokens.

Download SKILL.mdSave it as .claude/skills/react-state-management/SKILL.md (or your agent's skills folder).
name
react-state-management
description
Master modern React state management with Redux Toolkit, Zustand, Jotai, and React Query. Use when setting up global state, managing server state, or choosing between state management solutions.
risk
unknown
source
community
date_added
2026-02-27

React State Management

Comprehensive guide to modern React state management patterns, from local component state to global stores and server state synchronization.

Do not use this skill when

  • The task is unrelated to react state management
  • You need a different domain or tool outside this scope

Instructions

  • Clarify goals, constraints, and required inputs.
  • Apply relevant best practices and validate outcomes.
  • Provide actionable steps and verification.
  • If detailed examples are required, open resources/implementation-playbook.md.

Use this skill when

  • Setting up global state management in a React app
  • Choosing between Redux Toolkit, Zustand, or Jotai
  • Managing server state with React Query or SWR
  • Implementing optimistic updates
  • Debugging state-related issues
  • Migrating from legacy Redux to modern patterns

Core Concepts

1. State Categories
TypeDescriptionSolutions
Local StateComponent-specific, UI stateuseState, useReducer
Global StateShared across componentsRedux Toolkit, Zustand, Jotai
Server StateRemote data, cachingReact Query, SWR, RTK Query
URL StateRoute parameters, searchReact Router, nuqs
Form StateInput values, validationReact Hook Form, Formik
2. Selection Criteria
Small app, simple state → Zustand or Jotai
Large app, complex state → Redux Toolkit
Heavy server interaction → React Query + light client state
Atomic/granular updates → Jotai

Quick Start

Zustand (Simplest)
typescript
// store/useStore.ts
import { create } from 'zustand'
import { devtools, persist } from 'zustand/middleware'

interface AppState {
  user: User | null
  theme: 'light' | 'dark'
  setUser: (user: User | null) => void
  toggleTheme: () => void
}

export const useStore = create<AppState>()(
  devtools(
    persist(
      (set) => ({
        user: null,
        theme: 'light',
        setUser: (user) => set({ user }),
        toggleTheme: () => set((state) => ({
          theme: state.theme === 'light' ? 'dark' : 'light'
        })),
      }),
      { name: 'app-storage' }
    )
  )
)

// Usage in component
function Header() {
  const { user, theme, toggleTheme } = useStore()
  return (
    <header className={theme}>
      {user?.name}
      <button onClick={toggleTheme}>Toggle Theme</button>
    </header>
  )
}

Patterns

Pattern 1: Redux Toolkit with TypeScript
typescript
// store/index.ts
import { configureStore } from '@reduxjs/toolkit'
import { TypedUseSelectorHook, useDispatch, useSelector } from 'react-redux'
import userReducer from './slices/userSlice'
import cartReducer from './slices/cartSlice'

export const store = configureStore({
  reducer: {
    user: userReducer,
    cart: cartReducer,
  },
  middleware: (getDefaultMiddleware) =>
    getDefaultMiddleware({
      serializableCheck: {
        ignoredActions: ['persist/PERSIST'],
      },
    }),
})

export type RootState = ReturnType<typeof store.getState>
export type AppDispatch = typeof store.dispatch

// Typed hooks
export const useAppDispatch: () => AppDispatch = useDispatch
export const useAppSelector: TypedUseSelectorHook<RootState> = useSelector
typescript
// store/slices/userSlice.ts
import { createSlice, createAsyncThunk, PayloadAction } from '@reduxjs/toolkit'

interface User {
  id: string
  email: string
  name: string
}

interface UserState {
  current: User | null
  status: 'idle' | 'loading' | 'succeeded' | 'failed'
  error: string | null
}

const initialState: UserState = {
  current: null,
  status: 'idle',
  error: null,
}

export const fetchUser = createAsyncThunk(
  'user/fetchUser',
  async (userId: string, { rejectWithValue }) => {
    try {
      const response = await fetch(`/api/users/${userId}`)
      if (!response.ok) throw new Error('Failed to fetch user')
      return await response.json()
    } catch (error) {
      return rejectWithValue((error as Error).message)
    }
  }
)

const userSlice = createSlice({
  name: 'user',
  initialState,
  reducers: {
    setUser: (state, action: PayloadAction<User>) => {
      state.current = action.payload
      state.status = 'succeeded'
    },
    clearUser: (state) => {
      state.current = null
      state.status = 'idle'
    },
  },
  extraReducers: (builder) => {
    builder
      .addCase(fetchUser.pending, (state) => {
        state.status = 'loading'
        state.error = null
      })
      .addCase(fetchUser.fulfilled, (state, action) => {
        state.status = 'succeeded'
        state.current = action.payload
      })
      .addCase(fetchUser.rejected, (state, action) => {
        state.status = 'failed'
        state.error = action.payload as string
      })
  },
})

export const { setUser, clearUser } = userSlice.actions
export default userSlice.reducer
Pattern 2: Zustand with Slices (Scalable)
typescript
// store/slices/createUserSlice.ts
import { StateCreator } from 'zustand'

export interface UserSlice {
  user: User | null
  isAuthenticated: boolean
  login: (credentials: Credentials) => Promise<void>
  logout: () => void
}

export const createUserSlice: StateCreator<
  UserSlice & CartSlice, // Combined store type
  [],
  [],
  UserSlice
> = (set, get) => ({
  user: null,
  isAuthenticated: false,
  login: async (credentials) => {
    const user = await authApi.login(credentials)
    set({ user, isAuthenticated: true })
  },
  logout: () => {
    set({ user: null, isAuthenticated: false })
    // Can access other slices
    // get().clearCart()
  },
})

// store/index.ts
import { create } from 'zustand'
import { createUserSlice, UserSlice } from './slices/createUserSlice'
import { createCartSlice, CartSlice } from './slices/createCartSlice'

type StoreState = UserSlice & CartSlice

export const useStore = create<StoreState>()((...args) => ({
  ...createUserSlice(...args),
  ...createCartSlice(...args),
}))

// Selective subscriptions (prevents unnecessary re-renders)
export const useUser = () => useStore((state) => state.user)
export const useCart = () => useStore((state) => state.cart)
Pattern 3: Jotai for Atomic State
typescript
// atoms/userAtoms.ts
import { atom } from 'jotai'
import { atomWithStorage } from 'jotai/utils'

// Basic atom
export const userAtom = atom<User | null>(null)

// Derived atom (computed)
export const isAuthenticatedAtom = atom((get) => get(userAtom) !== null)

// Atom with localStorage persistence
export const themeAtom = atomWithStorage<'light' | 'dark'>('theme', 'light')

// Async atom
export const userProfileAtom = atom(async (get) => {
  const user = get(userAtom)
  if (!user) return null
  const response = await fetch(`/api/users/${user.id}/profile`)
  return response.json()
})

// Write-only atom (action)
export const logoutAtom = atom(null, (get, set) => {
  set(userAtom, null)
  set(cartAtom, [])
  localStorage.removeItem('token')
})

// Usage
function Profile() {
  const [user] = useAtom(userAtom)
  const [, logout] = useAtom(logoutAtom)
  const [profile] = useAtom(userProfileAtom) // Suspense-enabled

  return (
    <Suspense fallback={<Skeleton />}>
      <ProfileContent profile={profile} onLogout={logout} />
    </Suspense>
  )
}
Pattern 4: React Query for Server State
typescript
// hooks/useUsers.ts
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'

// Query keys factory
export const userKeys = {
  all: ['users'] as const,
  lists: () => [...userKeys.all, 'list'] as const,
  list: (filters: UserFilters) => [...userKeys.lists(), filters] as const,
  details: () => [...userKeys.all, 'detail'] as const,
  detail: (id: string) => [...userKeys.details(), id] as const,
}

// Fetch hook
export function useUsers(filters: UserFilters) {
  return useQuery({
    queryKey: userKeys.list(filters),
    queryFn: () => fetchUsers(filters),
    staleTime: 5 * 60 * 1000, // 5 minutes
    gcTime: 30 * 60 * 1000, // 30 minutes (formerly cacheTime)
  })
}

// Single user hook
export function useUser(id: string) {
  return useQuery({
    queryKey: userKeys.detail(id),
    queryFn: () => fetchUser(id),
    enabled: !!id, // Don't fetch if no id
  })
}

// Mutation with optimistic update
export function useUpdateUser() {
  const queryClient = useQueryClient()

  return useMutation({
    mutationFn: updateUser,
    onMutate: async (newUser) => {
      // Cancel outgoing refetches
      await queryClient.cancelQueries({ queryKey: userKeys.detail(newUser.id) })

      // Snapshot previous value
      const previousUser = queryClient.getQueryData(userKeys.detail(newUser.id))

      // Optimistically update
      queryClient.setQueryData(userKeys.detail(newUser.id), newUser)

      return { previousUser }
    },
    onError: (err, newUser, context) => {
      // Rollback on error
      queryClient.setQueryData(
        userKeys.detail(newUser.id),
        context?.previousUser
      )
    },
    onSettled: (data, error, variables) => {
      // Refetch after mutation
      queryClient.invalidateQueries({ queryKey: userKeys.detail(variables.id) })
    },
  })
}
Pattern 5: Combining Client + Server State
typescript
// Zustand for client state
const useUIStore = create<UIState>((set) => ({
  sidebarOpen: true,
  modal: null,
  toggleSidebar: () => set((s) => ({ sidebarOpen: !s.sidebarOpen })),
  openModal: (modal) => set({ modal }),
  closeModal: () => set({ modal: null }),
}))

// React Query for server state
function Dashboard() {
  const { sidebarOpen, toggleSidebar } = useUIStore()
  const { data: users, isLoading } = useUsers({ active: true })
  const { data: stats } = useStats()

  if (isLoading) return <DashboardSkeleton />

  return (
    <div className={sidebarOpen ? 'with-sidebar' : ''}>
      <Sidebar open={sidebarOpen} onToggle={toggleSidebar} />
      <main>
        <StatsCards stats={stats} />
        <UserTable users={users} />
      </main>
    </div>
  )
}

Best Practices

Do's
  • Colocate state - Keep state as close to where it's used as possible
  • Use selectors - Prevent unnecessary re-renders with selective subscriptions
  • Normalize data - Flatten nested structures for easier updates
  • Type everything - Full TypeScript coverage prevents runtime errors
  • Separate concerns - Server state (React Query) vs client state (Zustand)
Don'ts
  • Don't over-globalize - Not everything needs to be in global state
  • Don't duplicate server state - Let React Query manage it
  • Don't mutate directly - Always use immutable updates
  • Don't store derived data - Compute it instead
  • Don't mix paradigms - Pick one primary solution per category

Migration Guides

From Legacy Redux to RTK
typescript
// Before (legacy Redux)
const ADD_TODO = 'ADD_TODO'
const addTodo = (text) => ({ type: ADD_TODO, payload: text })
function todosReducer(state = [], action) {
  switch (action.type) {
    case ADD_TODO:
      return [...state, { text: action.payload, completed: false }]
    default:
      return state
  }
}

// After (Redux Toolkit)
const todosSlice = createSlice({
  name: 'todos',
  initialState: [],
  reducers: {
    addTodo: (state, action: PayloadAction<string>) => {
      // Immer allows "mutations"
      state.push({ text: action.payload, completed: false })
    },
  },
})

Resources

© involvex, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .agents/skills/react-state-management of involvex/youtube-music-cli.

Open the folder on GitHubat commit d4c5809

Used in 13 other repositories

We found 26 copies of this SKILL.md (exact, near-identical or edited) in other folders, from 13 other GitHub owners. This page covers the copy in involvex/youtube-music-cli, which our catalogue first saw on October 7, 2026.

Compare with similar skills

React State Management next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

React State Management compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
React State Management this skillinvolvex/youtube-music-cli45613 repos~3kAutomated safety check: PassMIT
React ExpertJeffallan/claude-skills12k—~1.4kAutomated safety check: PassMIT
Frontend Review Statemizchi/skills356—~1.4kAutomated safety check: PassNone
npm Package Comparatortinyfish-io/tinyfish-cookbook2.2k—~2kAutomated safety check: PassMIT
Zustand Patternsyonatangross/orchestkit289—~1.6kAutomated safety check: PassMIT
State Managementcohen-liel/hivemind110—~1.9kAutomated safety check: PassApache-2.0

Similar skills

  • React Expert

    Jeffallan/claude-skills

    Builds React 19 components in TypeScript with Server Components, useActionState forms, custom hooks and state libraries, checked with tsc and React Testing Library.

    12k GitHub stars~1.4k tokensUpdated 4 days ago
    Frontend & DesignAuto-check passed
  • A skill your agent uses when reviewing state management architecture — classifying state types (server/URL/form/UI), checking for over-globalization, Jotai/Zustand/Redux patterns, derived state, and…

    356 GitHub stars~1.4k tokensUpdated 6 days ago
    Frontend & DesignAuto-check passed
  • npm Package Comparator

    tinyfish-io/tinyfish-cookbook

    Compare two or more npm packages side by side using live data — downloads, bundle size, GitHub stars, last update, known vulnerabilities, and community sentiment.

    2.2k GitHub stars~2k tokensUpdated 6 days ago
    Frontend & DesignAuto-check passed
  • Zustand Patterns

    yonatangross/orchestkit

    Reference for Zustand 5.x state management including slices, middleware, Immer, useShallow, persistence, selectors, and devtools integration.

    289 GitHub stars~1.6k tokensUpdated today
    Frontend & DesignAuto-check passed
  • State Management

    cohen-liel/hivemind

    Frontend state management patterns for React apps. An agent skill from cohen-liel/hivemind.

    110 GitHub stars~1.9k tokensUpdated 5 mo ago
    Frontend & DesignAuto-check passed
  • React State Management

    HoangNguyen0403/agent-skills-standard

    Select and implement local, global, and server state patterns in React.

    571 GitHub stars~821 tokensUpdated today
    Frontend & DesignAuto-check passed

More from involvex/youtube-music-cli

  • Bun Win32

    involvex/youtube-music-cli

    Win32 FFI binding lifecycle for @bun-win32/ packages (Win32 DLL bindings via bun:ffi on Windows).

    456 GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Bun Build

    involvex/youtube-music-cli

    Create optimized production bundles with Bun's native bundler.

    456 GitHub stars~2.1k tokensUpdated today
    Auto-check: notes
  • Bun Dev Server

    involvex/youtube-music-cli

    Set up high-performance development servers with Hot Module Replacement.

    456 GitHub stars~2.9k tokensUpdated today
    Auto-check: notes
  • Bun Test

    involvex/youtube-music-cli

    Configure Bun's built-in test runner with Jest-compatible APIs.

    456 GitHub stars~2.3k tokensUpdated today
    Auto-check: notes
  • Bun Init

    involvex/youtube-music-cli

    Initialize a new Bun project with TypeScript and optimal configuration.

    456 GitHub stars~2.1k tokensUpdated today
    Auto-check: notes

Questions about React State Management

What does React State Management do?

Master modern React state management with Redux Toolkit, Zustand, Jotai, and React Query. React State Management is an agent skill from involvex/youtube-music-cli. Master modern React state management with Redux Toolkit, Zustand, Jotai, and React Query.

When should I use React State Management?

React State Management fits situations like: setting up global state; managing server state; choosing between state management solutions.

How do I install React State Management in Claude Code?

Run `npx skills add involvex/youtube-music-cli --skill react-state-management -a claude-code`. Or copy the skill folder (.agents/skills/react-state-management in involvex/youtube-music-cli) into .claude/skills/react-state-management in your project. Claude Code loads it when a task matches its description.

How do I install React State Management in Codex?

Run `npx skills add involvex/youtube-music-cli --skill react-state-management -a codex`. Or copy the skill folder (.agents/skills/react-state-management in involvex/youtube-music-cli) into .agents/skills/react-state-management in your project. Codex loads it when a task matches its description.

Can I use React State Management in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add involvex/youtube-music-cli --skill react-state-management -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/react-state-management, .gemini/skills/react-state-management, .github/skills/react-state-management and .opencode/skills/react-state-management in your project.

What does React State Management need to run?

SKILL.md names no scripts, command-line tools or credentials: React State Management is instructions for the agent only.

Does React State Management access the network?

SKILL.md names 4 domains. As links in the text: redux-toolkit.js.org, github.com, jotai.org and tanstack.com. This is read from the text; nothing was executed.

Is React State Management safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does React State Management use?

React State Management is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does React State Management use?

About 3k tokens (SKILL.md is roughly 12k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to React State Management?

Skills that share tags, products or a category with React State Management: React Expert (Jeffallan/claude-skills, 12k stars), Frontend Review State (mizchi/skills, 356 stars), npm Package Comparator (tinyfish-io/tinyfish-cookbook, 2.2k stars) and Zustand Patterns (yonatangross/orchestkit, 289 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains React State Management?

involvex (a GitHub user) maintains it in involvex/youtube-music-cli, which has 456 GitHub stars. The repository holds 6 skills in this directory. The repository was last updated on October 8, 2026.

Source: involvex/youtube-music-cli on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.