state-management

state-management is a skill for Claude Code, Codex from bdiasti/maestro-bundle-cli. It costs 47 tokens per session (1,660 once invoked), scanned A, original, MIT.

Guidance for managing information in React applications, including local screen state, shared interface state, data from APIs, live WebSocket updates, and forms.

In plain words
What is it for?
Use it to choose between useState, Zustand, React Query, and React Hook Form; build shared stores, cache API data, connect live updates, and manage complex forms.
Why use it?
It helps keep different kinds of state in the right place instead of mixing server data, interface settings, and form values together.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/bdiasti/maestro-bundle-cli/state-management
Any agent
npx skills add bdiasti/maestro-bundle-cli --skill state-management
Clone the repo
git clone --depth 1 https://github.com/bdiasti/maestro-bundle-cli

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for state-management

README.md
[![agentmods](https://agentmods.dev/badge/skills/bdiasti/maestro-bundle-cli/state-management.svg)](https://agentmods.dev/skills/bdiasti/maestro-bundle-cli/state-management)
Your own site
<a href="https://agentmods.dev/skills/bdiasti/maestro-bundle-cli/state-management"><img src="https://agentmods.dev/badge/skills/bdiasti/maestro-bundle-cli/state-management.svg" alt="Measured on agentmods" height="20"></a>
Per session 47 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,660 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00047 $0.01660
Opus 5 $0.00023 $0.00830
Sonnet 5 $0.00009 $0.00332
Haiku 4.5 $0.00005 $0.00166

Measured 4d ago against content hash ded54e5c950d, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

state-management scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

templates/bundle-frontend-spa/skills/state-management/SKILL.md · 215 lines

How it starts

The opening of the file, as written. The whole thing — 215 lines — stays where its author put it; the contents beside it link to each section on GitHub.

State Management

Choose and implement the right state management solution for each type of state using Zustand, React Query, and React Hook Form.

When to Use

  • User needs to decide between Zustand, React Query, or useState
  • User wants to create a global UI store (sidebar, theme, selections)
  • User needs to set up server state caching with React Query
  • User wants to add real-time WebSocket state
  • User needs to manage complex form state

Available Operations

  1. Set up React Query provider and hooks for server state
  2. Create Zustand stores for global UI state
  3. Build WebSocket-connected stores for real-time data
  4. Configure React Hook Form for form state
  5. Diagnose and fix state management anti-patterns

Multi-Step Workflow

Step 1: Install Dependencies

npm install @tanstack/react-query zustand react-hook-form @hookform/resolvers zod socket.io-client
npm install -D @tanstack/react-query-devtools

Step 2: Understand the State Decision Matrix

State Type Solution Example
Server data (API) React Query List of items, user profiles, search results
Global UI state Zustand Sidebar open/closed, theme, selected item ID
Local UI state useState Modal visibility, input value, toggle
Form state React Hook Form Form inputs, validation, submission
Real-time data Zustand + WebSocket Live agent status, event feed

Step 3: Set Up React Query Provider

// src/main.tsx
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { ReactQueryDevtools } from '@tanstack/react-query-devtools';

const queryClient = new QueryClient({
  defaultOptions: {
    queries: {
      staleTime: 30_000,      // 30 seconds
      retry: 2,
      refetchOnWindowFocus: false,
    },
  },
});

function App() {
  return (
    <QueryClientProvider client={queryClient}>
      <Router />
      <ReactQueryDevtools initialIsOpen={false} />
    </QueryClientProvider>
  );
}

Step 4: Create API Service and Query Hooks

// src/services/itemApi.ts
import { api } from '@/lib/api';

export const itemApi = {
  list: (filters?: ItemFilters) =>
    api.get<PaginatedResponse<Item>>('/api/v1/items', { params: filters }),
  get: (id: string) =>
    api.get<Item>(`/api/v1/items/${id}`),
  create: (data: CreateItemDto) =>
    api.post<Item>('/api/v1/items', data),
};

// src/hooks/useItems.ts
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';

export function useItems(filters?: ItemFilters) {
  return useQuery({
    queryKey: ['items', filters],
    queryFn: () => itemApi.list(filters),
  });
}

export function useCreateItem() {
  const qc = useQueryClient();
  return useMutation({
    mutationFn: itemApi.create,
    onSuccess: () => qc.invalidateQueries({ queryKey: ['items'] }),
  });
}

Read the full file on GitHub · 215 lines

Files

What ships with it

2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 215 lines · 47 tokens per session scan A ded54e5c950d

Subscribe to this mod's changes

state-management is a skill published in the GitHub repository bdiasti/maestro-bundle-cli (21 stars, last pushed 5mo ago), licensed MIT. It adds 47 tokens to every session and 1,660 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.