zustand-state-management

zustand-state-management is a skill for Claude Code, Codex from punkadillo/figma-code-composer. It costs 21 tokens per session (530 once invoked), scanned A, original, MIT.

A guide to managing shared application data with Zustand in React and Next.js using TypeScript. It covers store structure, selectors, actions, and ways to connect state to components.

In plain words
What is it for?
Use it when designing or refactoring Zustand stores, choosing selectors, and coordinating client-side state with server data.
Why use it?
It helps avoid scattered state updates, unnecessary component re-renders, and stores that become difficult to maintain.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it when designing or refactoring Zustand stores, choosing selectors, and coordinating client-side state with server data.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/punkadillo/figma-code-composer/zustand-state-management
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.

Any agent
npx skills add punkadillo/figma-code-composer --skill zustand-state-management
Clone the repo
git clone --depth 1 https://github.com/punkadillo/figma-code-composer

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 zustand-state-management

README.md
[![agentmods](https://agentmods.dev/badge/skills/punkadillo/figma-code-composer/zustand-state-management.svg)](https://agentmods.dev/skills/punkadillo/figma-code-composer/zustand-state-management)
Your own site
<a href="https://agentmods.dev/skills/punkadillo/figma-code-composer/zustand-state-management"><img src="https://agentmods.dev/badge/skills/punkadillo/figma-code-composer/zustand-state-management.svg" alt="Measured on agentmods" height="20"></a>
Per session 21 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 530 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00021 $0.00530
Opus 5 $0.00010 $0.00265
Sonnet 5 $0.00004 $0.00106
Haiku 4.5 $0.00002 $0.00053

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

Security

Grade A, and why

zustand-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.

.figma-pipeline/skills/zustand-state-management/SKILL.md · 100 lines

How it starts

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

Zustand State Management

You are an expert in Zustand state management for React and Next.js applications.

Core Principles

  • Use Zustand for lightweight, flexible state management
  • Minimize useEffect and setState; prioritize derived state and memoization
  • Implement functional, declarative patterns avoiding classes
  • Use descriptive variable names with auxiliary verbs like isLoading, hasError

Store Design

Basic Store Structure

import { create } from 'zustand'

interface BearState {
  bears: number
  isLoading: boolean
  hasError: boolean
  increase: () => void
  reset: () => void
}

const useBearStore = create<BearState>((set) => ({
  bears: 0,
  isLoading: false,
  hasError: false,
  increase: () => set((state) => ({ bears: state.bears + 1 })),
  reset: () => set({ bears: 0 }),
}))

Best Practices

  • Keep stores focused and modular
  • Use selectors to prevent unnecessary re-renders
  • Implement middleware for persistence, logging, or devtools
  • Separate actions from state when stores grow complex

Integration with React

  • Use shallow equality for selecting multiple values
  • Combine with TanStack React Query for server state
  • Implement proper TypeScript interfaces for type safety
  • Use zustand/middleware for persistence and devtools

Performance Optimization

  • Select only the state you need in components
  • Use shallow comparison for object selections
  • Avoid selecting the entire store
  • Memoize computed values when necessary

Middleware Usage

Persistence

import { persist } from 'zustand/middleware'

const useStore = create(
  persist(
    (set) => ({
      // state and actions
    }),
    { name: 'store-key' }
  )
)

DevTools

import { devtools } from 'zustand/middleware'

const useStore = create(
  devtools((set) => ({
    // state and actions
  }))
)

Error Handling

  • Handle errors at function start using early returns and guard clauses
  • Implement error states within stores
  • Use try-catch in async actions
  • Provide meaningful error messages

Read the full file on GitHub · 100 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. 4d ago First seen · 100 lines · 21 tokens per session scan A 857f2477df1b

Subscribe to this mod's changes

zustand-state-management is a skill published in the GitHub repository punkadillo/figma-code-composer (3 stars, last pushed 20d ago), licensed MIT. It adds 21 tokens to every session and 530 once invoked, about $0.0001 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

react-dev

This skill should be used when building React components with TypeScript, typing hooks, handling events, or when React TypeScript, React 19, Server Components are mentioned. Covers type-safe patterns for React 18-19 including generic components, proper event typing, and routing integration (TanStack Router, React…

saajunaid/caddis-plugin · 66 tokens

react-best-practices

Modern React development guidelines covering hooks, component patterns, state management, performance optimization, and TypeScript integration.

saajunaid/caddis-plugin · 27 tokens

javascript-typescript

JavaScript and TypeScript development with ES6+, Node.js, React, and modern web frameworks. Use for frontend, backend, or full-stack JavaScript/TypeScript projects.

saajunaid/caddis-plugin · 40 tokens

fast-typescript-check

Keep www-sacred's TypeScript fast to type-check and fast to run. Use when touching the ASCII/canvas animation components (the only real per-frame code here), tightening type-check wall-clock, or auditing a change for runtime or compiler regressions. Scoped to this repo — a React 19 / Next.js 16 component library plus…

internet-development/www-sacred · 84 tokens

onejs-setup-and-overview

Use this skill whenever the user wants to build or set up user interface in a Unity project using OneJS, React, TypeScript, or JSX, e.g. 'add a main menu to my game', 'build a settings screen', 'make a HUD', 'set up OneJS', 'my OneJS panel is blank', 'the UI is not hot reloading'. Covers confirming OneJS is installed…

Singtaa/OneJS · 199 tokens

coding-standards

A set of general coding standards and practical patterns for TypeScript, JavaScript, React, and Node.js. It covers readable naming, simple designs, avoiding repetition, and delaying unnecessary features.

loulanyue/awesome-claude-notes · 41 tokens