state-management

state-management is a skill for Claude Code, Codex from MadAppGang/claude-code. It costs 41 tokens per session (2,655 once invoked), scanned A, original, MIT.

A guide to managing state in frontend applications, meaning the information an interface needs to remember and share. It compares local component state, shared UI state, server data, global app state, and values stored in the browser URL.

In plain words
What is it for?
Use it when choosing between local state, Zustand, Pinia, TanStack Query, context, or URL parameters in React and Vue applications.
Why use it?
It helps choose an appropriate way to store each kind of data instead of forcing everything into one global store.

Skill for Claude CodeCodex

Part of the dev plugin — 47 skills, 12 commands, 14 agents shipped together

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/madappgang/claude-code/state-management
Any agent
npx skills add MadAppGang/claude-code --skill state-management
Clone the repo
git clone --depth 1 https://github.com/MadAppGang/claude-code

Made for: Claude Code, Codex.

Or install dev, the plugin that ships this one along with the rest of its 47 skills, 12 commands, 14 agents.

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/madappgang/claude-code/state-management.svg)](https://agentmods.dev/skills/madappgang/claude-code/state-management)
Your own site
<a href="https://agentmods.dev/skills/madappgang/claude-code/state-management"><img src="https://agentmods.dev/badge/skills/madappgang/claude-code/state-management.svg" alt="Measured on agentmods" height="20"></a>
Per session 41 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,655 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.00041 $0.02655
Opus 5 $0.00020 $0.01327
Sonnet 5 $0.00008 $0.00531
Haiku 4.5 $0.00004 $0.00265

Measured yesterday against content hash 1e37e43ed148, 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 yesterday.

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.

plugins/dev/skills/frontend/state-management/SKILL.md · 433 lines

How it starts

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

Frontend State Management

Overview

Patterns and best practices for managing state in frontend applications across different frameworks.

State Categories

Local vs Global State

Type Scope Examples Solution
Local UI Single component Form inputs, modals, dropdowns useState, ref
Shared UI Component subtree Theme, sidebar state Context, provide/inject
Server Cached API data Users, products, orders TanStack Query, SWR
Global App Entire app Auth, settings, notifications Zustand, Pinia, Redux
URL Browser URL Filters, pagination, search Router params/query

When to Use What

┌─────────────────────────────────────────────────────────┐
│ Does only this component need it?                       │
│   YES → Local state (useState/ref)                      │
│   NO ↓                                                  │
├─────────────────────────────────────────────────────────┤
│ Is it server data that needs caching/sync?              │
│   YES → Server state library (TanStack Query)           │
│   NO ↓                                                  │
├─────────────────────────────────────────────────────────┤
│ Is it in the URL (shareable state)?                     │
│   YES → URL state (router)                              │
│   NO ↓                                                  │
├─────────────────────────────────────────────────────────┤
│ Is it needed across unrelated components?               │
│   YES → Global store (Zustand/Pinia)                    │
│   NO → Lift state up or Context                         │
└─────────────────────────────────────────────────────────┘

Server State (TanStack Query)

Basic Query Pattern

// Define query
function useUsers(filters: UserFilters) {
  return useQuery({
    queryKey: ['users', filters],
    queryFn: () => api.getUsers(filters),
    staleTime: 5 * 60 * 1000, // 5 minutes
    gcTime: 30 * 60 * 1000,   // 30 minutes
  });
}

// Use in component
function UserList() {
  const [filters, setFilters] = useState<UserFilters>({});
  const { data, isLoading, error } = useUsers(filters);

  if (isLoading) return <Spinner />;
  if (error) return <Error message={error.message} />;
  return <List items={data} />;
}

Read the full file on GitHub · 433 lines

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. yesterday First seen · 433 lines · 41 tokens per session scan A 1e37e43ed148

Subscribe to this mod's changes

state-management is a skill published in the GitHub repository MadAppGang/claude-code (279 stars, last pushed 5mo ago), licensed MIT. It adds 41 tokens to every session and 2,655 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-09-03.

Related

Other skills, from other repositories

nextjs-state-management

Apply best practices for managing URL, server, and client state in Next.js applications. Use when choosing between URL params, SWR/TanStack Query, Zustand, or Context for state, or when fixing hydration mismatches from localStorage.

FilippoDeSilva/skills · 53 tokens

zustand-docs

Zustand — small, fast, scalable state management for React. Store creation, hooks, middleware, TypeScript.

pledgeandgrow/pledge-skills · 29 tokens

react-state-architecture

Activate when structuring state management in React 18/19 and Next.js applications, selecting between Zustand, TanStack Query, and React Server Components, eliminating prop drilling, and handling cache invalidation — trigger phrasings include "how should I manage state in this React app", "setup Zustand store"…

ieeecsopen/mcp-cs · 113 tokens

angular-best-practices-tanstack

TanStack Query best practices for Angular. Covers query/mutation patterns, cache invalidation, and query key factories for server state management. Activates when working with @tanstack/angular-query-experimental. Do not use for NgRx Effects, manual HTTP caching, or RxJS-based server state. Install alongside…

alfredoperez/angular-best-practices · 79 tokens

v3-create-crud

创建增删改查(CRUD)页面,基于 Element Plus 组件库,包含表格、搜索、分页、新增/编辑弹窗、删除确认等功能。当用户提到以下任何场景时都应触发:创建管理页面、创建列表页、创建表格页。即使用户没有明确说 CRUD,只要意图是创建带表格和表单操作的后台页面就应该使用此 Skill。使用时需提供模块名称和字段信息。.

un-pany/v3-admin-vite · 108 tokens

v3-upsert-route

根据用户提供的路由信息,在 src/router/index.ts 中生成或更新路由配置。.

un-pany/v3-admin-vite · 88 tokens