# zustand

A skill that feeds your coding agent Zustand patterns: domain stores, selector hooks, middleware and persistence.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 353 installs · ★ 643
- Author: pedronauck
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/pedronauck/skills/tree/HEAD/skills/curated/zustand/SKILL.md
- Updated: 2026-10-20
- HTML: https://affpapa.org/en/nevibecode/skills/pedronauck-zustand

## What it does

The skill hands the agent a set of rules for Zustand in your project. Stores stay domain-specific, large ones get split into slices, and selector hooks are exported for each state slice instead of subscribing to the whole store. A template shows the state interface with actions grouped in an `actions` object.

For production stores it recommends stacking middleware in one order: `devtools`, then `persist`, then `immer`. Persistence is narrowed with `partialize` so only the fields you pick end up in storage. The skill also draws a line between client state and server state, pointing the latter at TanStack Query.

The agent can only `Read`, `Grep` and `Glob` — it inspects your code and suggests changes, but never edits files itself. So don't expect it to rewrite your stores on its own. Deeper examples and anti-patterns live in `references/patterns.md`, and the checklist ends with `pnpm run typecheck` and `pnpm run test`.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add pedronauck/skills --skill zustand -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/zustand/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/zustand/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add pedronauck/skills --skill zustand -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/zustand/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add pedronauck/skills --skill zustand -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/zustand/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install pedronauck/skills zustand
```

2. **Manually: put the files in place**
- File: `.github/skills/zustand/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add pedronauck/skills --skill zustand -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/pedronauck/skills --path skills/curated/zustand
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/zustand/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add pedronauck/skills --skill zustand -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/pedronauck/skills/tree/HEAD/skills/curated/zustand/SKILL.md

## When to use it
- split shared client state into domain-specific stores
- wire devtools, persist and immer in the right order
- replace whole-store subscriptions with selector hooks
- persist only selected fields via partialize
- update nested state immer-style without mutating it

## Example prompts
- Create a new cart store following the zustand skill patterns
- Check my stores against the zustand skill rules
- Help me add selector hooks to the auth store

## Similar
- [zustand-patterns](https://affpapa.org/en/nevibecode/skills/zustand-patterns.md) — skill · 1400 installs
- [zustand-state-management](https://affpapa.org/en/nevibecode/skills/zustand-state-management.md) — skill · 959 installs
- [zustand-5](https://affpapa.org/en/nevibecode/skills/zustand-5.md) — skill · 911 installs
- [zustand-store-ts](https://affpapa.org/en/nevibecode/skills/zustand-store-ts.md) — skill · 3 installs
- [state-management](https://affpapa.org/en/nevibecode/skills/state-management.md) — skill · 783 installs
- [frontend-state-management](https://affpapa.org/en/nevibecode/skills/frontend-state-management.md) — skill · 480 installs

## Other versions with the same name
- [zustand · vercel-labs](https://affpapa.org/en/nevibecode/skills/zustand.md) — 1900 installs
- [zustand · pproenca](https://affpapa.org/en/nevibecode/skills/pproenca-zustand.md) — 446 installs
- [zustand · bobmatnyc](https://affpapa.org/en/nevibecode/skills/bobmatnyc-zustand.md) — 485 installs

From the same set: [pedronauck/skills](https://affpapa.org/en/nevibecode/by/pedronauck/skills.md) — 6 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
