zustand-state

zustand-state is a skill for Claude Code, Codex from existential-birds/beagle. It costs 61 tokens per session (1,084 once invoked), scanned A, original, Apache-2.0.

A state-management skill for Zustand, a small library for storing and sharing application data in React or plain JavaScript. It covers stores, selectors, persistence, developer tools, and middleware such as Immer.

In plain words
What is it for?
Use it to create stores, update flat or nested state, persist state in browser storage, connect developer tools, and manage global state in React applications.
Why use it?
It helps keep shared application state organized without the provider setup and extra structure often associated with larger state libraries. Selector guidance also helps components subscribe only to the data they use.

Skill for Claude CodeCodex

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

Good fit Use it to create stores, update flat or nested state, persist state in browser storage, connect developer tools, and manage global state in React applications.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/existential-birds/beagle/zustand-state
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 existential-birds/beagle --skill zustand-state
Clone the repo
git clone --depth 1 https://github.com/existential-birds/beagle

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

README.md
[![agentmods](https://agentmods.dev/badge/skills/existential-birds/beagle/zustand-state/github.svg)](https://agentmods.dev/skills/existential-birds/beagle/zustand-state)
Your own site
<a href="https://agentmods.dev/skills/existential-birds/beagle/zustand-state"><img src="https://agentmods.dev/badge/skills/existential-birds/beagle/zustand-state/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for zustand-state

Your own site · 80×15
<a href="https://agentmods.dev/skills/existential-birds/beagle/zustand-state"><img src="https://agentmods.dev/badge/skills/existential-birds/beagle/zustand-state.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 61 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,084 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.00061 $0.01084
Opus 5.5 $0.00024 $0.00434
Sonnet 5.5 $0.00012 $0.00217
Haiku 4.5 $0.00006 $0.00108

Measured 4d ago against content hash 1528334e99d9, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

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

skills/zustand-state/SKILL.md · 121 lines

How it starts

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

Zustand State Management (v5)

Minimal state management — named exports only (v5 removed default exports), React 18/19 compatible, and no global providers required.

Quick Reference

import { create } from 'zustand'

interface BearState {
  bears: number
  increase: (by: number) => void
}

const useBearStore = create<BearState>()((set) => ({
  bears: 0,
  increase: (by) => set((state) => ({ bears: state.bears + by })),
}))

// In component - select only what you need
const bears = useBearStore((state) => state.bears)
const increase = useBearStore((state) => state.increase)

State Updates

// Flat updates (auto-merged at one level)
set({ bears: 5 })
set((state) => ({ bears: state.bears + 1 }))

// Nested objects (manual spread required without immer)
set((state) => ({
  nested: { ...state.nested, count: state.nested.count + 1 }
}))

// Replace entire state (no merge)
set({ bears: 0 }, true)

Selectors & Performance (v5 useShallow)

In Zustand v5, base create no longer accepts a custom equality function as a 2nd argument. Returning a fresh object or array literal from a selector without useShallow causes infinite re-renders (Maximum update depth exceeded):

import { useShallow } from 'zustand/react/shallow'

// Good - subscribes only to bears
const bears = useBearStore((state) => state.bears)

// Bad - rerenders on any state change
const state = useBearStore()

// Bad in v5 - new object every render triggers infinite loop!
// const { bears, fish } = useBearStore((s) => ({ bears: s.bears, fish: s.fish }))

// Good - multiple values with useShallow
const { bears, fish } = useBearStore(
  useShallow((state) => ({ bears: state.bears, fish: state.fish }))
)

// Array destructuring with useShallow
const [bearsVal, fishVal] = useBearStore(
  useShallow((state) => [state.bears, state.fish])
)

If you need createWithEqualityFn, import it from 'zustand/traditional' (requires use-sync-external-store as a peer dependency in v5).

Read the full file on GitHub · 121 lines

Files

What ships with it

3 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 Changed · +2 lines · -4 tokens per session 1528334e99d9
  2. 2mo ago First seen · 119 lines · 65 tokens per session scan A bb1ea5fdc406

Subscribe to this mod's changes

zustand-state is a skill published in the GitHub repository existential-birds/beagle (91 stars, last pushed 4d ago), licensed Apache-2.0. It adds 61 tokens to every session and 1,084 once invoked, about $0.0002 per session on Opus 5.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-16.

Related

zustand-state compared with skills from other repositories

zustand-state next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
zustand-stateexistential-birds/beagleSkill914d agoApache-2.0A61Claude Code, Codex
isolating-product-facade-contractsPostHog/posthogSkill41ktodaynoneA76Claude Code, Codex
qa-frontendPostHog/posthogSkill41ktodaynoneA216Claude Code
reviewing-personhog-protocolPostHog/posthogSkill41ktodaynoneA111Claude Code, Codex
splitting-oversized-modulesPostHog/posthogSkill41ktodaynoneA197Claude Code, Codex
establishing-code-ownershipPostHog/posthogSkill41ktodaynoneA94Claude Code, Codex
writing-code-commentsPostHog/posthogSkill41ktodaynoneA173Claude Code, Codex