Zustand 5 state management patterns. An agent skill from Gentleman-Programming/Gentleman-Skills.

Apache-2.0Auto-check passedFrontend & Design

Install Zustand 5

skills CLI
$ npx skills add Gentleman-Programming/Gentleman-Skills --skill zustand-5 -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install Gentleman-Programming/Gentleman-Skills zustand-5 --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/Gentleman-Programming/Gentleman-Skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/curated/zustand-5 .claude/skills/zustand-5 && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
zustand-5
GitHub stars
657
Token cost
~1.2k tokens
SKILL.md length
24 words
Files
1
Skills in repo
23
Repo updated
First seen
Licence
Apache-2.0

At a glance

Zustand 5 state management patterns. An agent skill from Gentleman-Programming/Gentleman-Skills.

  • Tasks that involve State management
  • SKILL.md covers Basic Store, Persist Middleware, Selectors (Zustand 5) and Async Actions, plus 5 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Zustand 5 is an agent skill from Gentleman-Programming/Gentleman-Skills. Zustand 5 state management patterns. Trigger: When managing React state with Zustand.

Its SKILL.md is about 1.2k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Frontend & Design, covering State management. It works with Zustand. The repository describes itself as: Community-driven AI agent skills for Claude Code, OpenCode, and other AI assistants. Curated patterns and community contributions. The licence is Apache-2.0.

When your agent uses it

  • Tasks that involve State management

Example prompts

  • “/zustand-5”

What it can do on your machine

Read from SKILL.md and the folder at commit c8036a3. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are typescript).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Zustand 5 loads about 1.2k tokens when it runs. Until then it costs about 24 tokens; SKILL.md has 24 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~24
When it runs · the whole SKILL.md, loaded when a task matches
~1.2k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from Gentleman-Programming/Gentleman-Skills at commit c8036a3, republished under its Apache-2.0 licence (© Gentleman-Programming). 24 words, ~1,187 tokens.

Download SKILL.mdSave it as .claude/skills/zustand-5/SKILL.md (or your agent's skills folder).
name
zustand-5
description
Zustand 5 state management patterns. Trigger: When managing React state with Zustand.
license
Apache-2.0
metadata.author
gentleman-programming
metadata.version
1.0

Basic Store

typescript
import { create } from "zustand";

interface CounterStore {
  count: number;
  increment: () => void;
  decrement: () => void;
  reset: () => void;
}

const useCounterStore = create<CounterStore>((set) => ({
  count: 0,
  increment: () => set((state) => ({ count: state.count + 1 })),
  decrement: () => set((state) => ({ count: state.count - 1 })),
  reset: () => set({ count: 0 }),
}));

// Usage
function Counter() {
  const { count, increment, decrement } = useCounterStore();
  return (
    <div>
      <span>{count}</span>
      <button onClick={increment}>+</button>
      <button onClick={decrement}>-</button>
    </div>
  );
}

Persist Middleware

typescript
import { create } from "zustand";
import { persist } from "zustand/middleware";

interface SettingsStore {
  theme: "light" | "dark";
  language: string;
  setTheme: (theme: "light" | "dark") => void;
  setLanguage: (language: string) => void;
}

const useSettingsStore = create<SettingsStore>()(
  persist(
    (set) => ({
      theme: "light",
      language: "en",
      setTheme: (theme) => set({ theme }),
      setLanguage: (language) => set({ language }),
    }),
    {
      name: "settings-storage",  // localStorage key
    }
  )
);

Selectors (Zustand 5)

typescript
// ✅ Select specific fields to prevent unnecessary re-renders
function UserName() {
  const name = useUserStore((state) => state.name);
  return <span>{name}</span>;
}

// ✅ For multiple fields, use useShallow
import { useShallow } from "zustand/react/shallow";

function UserInfo() {
  const { name, email } = useUserStore(
    useShallow((state) => ({ name: state.name, email: state.email }))
  );
  return <div>{name} - {email}</div>;
}

// ❌ AVOID: Selecting entire store (causes re-render on any change)
const store = useUserStore();  // Re-renders on ANY state change

Async Actions

typescript
interface UserStore {
  user: User | null;
  loading: boolean;
  error: string | null;
  fetchUser: (id: string) => Promise<void>;
}

const useUserStore = create<UserStore>((set) => ({
  user: null,
  loading: false,
  error: null,

  fetchUser: async (id) => {
    set({ loading: true, error: null });
    try {
      const response = await fetch(`/api/users/${id}`);
      const user = await response.json();
      set({ user, loading: false });
    } catch (error) {
      set({ error: "Failed to fetch user", loading: false });
    }
  },
}));

Slices Pattern

typescript
// userSlice.ts
interface UserSlice {
  user: User | null;
  setUser: (user: User) => void;
  clearUser: () => void;
}

const createUserSlice = (set): UserSlice => ({
  user: null,
  setUser: (user) => set({ user }),
  clearUser: () => set({ user: null }),
});

// cartSlice.ts
interface CartSlice {
  items: CartItem[];
  addItem: (item: CartItem) => void;
  removeItem: (id: string) => void;
}

const createCartSlice = (set): CartSlice => ({
  items: [],
  addItem: (item) => set((state) => ({ items: [...state.items, item] })),
  removeItem: (id) => set((state) => ({
    items: state.items.filter(i => i.id !== id)
  })),
});

// store.ts
type Store = UserSlice & CartSlice;

const useStore = create<Store>()((...args) => ({
  ...createUserSlice(...args),
  ...createCartSlice(...args),
}));

Immer Middleware

typescript
import { create } from "zustand";
import { immer } from "zustand/middleware/immer";

interface TodoStore {
  todos: Todo[];
  addTodo: (text: string) => void;
  toggleTodo: (id: string) => void;
}

const useTodoStore = create<TodoStore>()(
  immer((set) => ({
    todos: [],

    addTodo: (text) => set((state) => {
      // Mutate directly with Immer!
      state.todos.push({ id: crypto.randomUUID(), text, done: false });
    }),

    toggleTodo: (id) => set((state) => {
      const todo = state.todos.find(t => t.id === id);
      if (todo) todo.done = !todo.done;
    }),
  }))
);

DevTools

typescript
import { create } from "zustand";
import { devtools } from "zustand/middleware";

const useStore = create<Store>()(
  devtools(
    (set) => ({
      // store definition
    }),
    { name: "MyStore" }  // Name in Redux DevTools
  )
);

Outside React

typescript
// Access store outside components
const { count, increment } = useCounterStore.getState();
increment();

// Subscribe to changes
const unsubscribe = useCounterStore.subscribe(
  (state) => console.log("Count changed:", state.count)
);

Keywords

zustand, state management, react, store, persist, middleware

© Gentleman-Programming, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in curated/zustand-5 of Gentleman-Programming/Gentleman-Skills.

Open the folder on GitHubat commit c8036a3

Compare with similar skills

Zustand 5 next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Zustand 5 compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Zustand 5 this skillGentleman-Programming/Gentleman-Skills657—~1.2kAutomated safety check: PassApache-2.0
React State Managementinvolvex/youtube-music-cli45613 repos~3kAutomated safety check: PassMIT
LobeHub Data Fetching Layerslobehub/lobehub83k—~1.7kAutomated safety check: PassCustom licence
Create Storeryokun6/ryos1.3k—~2.1kAutomated safety check: PassAGPL-3.0
LobeHub Zustand Store Patternslobehub/lobehub83k—~1.6kAutomated safety check: PassCustom licence
Nextjs15 Initbear2u/my-skills933—~2.4kAutomated safety check: PassNone

Similar skills

  • React State Management

    involvex/youtube-music-cli

    Master modern React state management with Redux Toolkit, Zustand, Jotai, and React Query.

    456 GitHub starsUsed in 13 repos~3k tokens
    Frontend & DesignAuto-check passed
  • Explains how LobeHub client code fetches data through services, SWR store hooks and cache keys, and when to avoid useEffect fetching or duplicated state.

    83k GitHub stars~1.7k tokensUpdated today
    Frontend & DesignAuto-check passed
  • Create Store

    ryokun6/ryos

    Create or modify ryOS Zustand stores following repo conventions — persist middleware, partialize, versioned migrations, the debounced write-behind storage adapter for large slices, and cloud-sync…

    1.3k GitHub stars~2.1k tokensUpdated yesterday
    Frontend & DesignAuto-check passed
  • Conventions for Zustand stores in LobeHub: list and detail state shapes, public, internal and dispatch actions, reducers, optimistic updates and naming rules.

    83k GitHub stars~1.6k tokensUpdated today
    Frontend & DesignAuto-check passed
  • Nextjs15 Init

    bear2u/my-skills

    A skill your agent uses when user wants to create a new Next.js 15 project (Todo/Blog/Dashboard/E-commerce/Custom domain) with App Router, ShadCN, Zustand, Tanstack Query, and modern Next.js stack

    933 GitHub stars~2.4k tokensUpdated 3 mo ago
    Frontend & DesignAuto-check passed
  • Xray UI Dev

    bropines/xray-config-ui-editor

    Development and maintenance of Xray Config UI Editor. An agent skill from bropines/xray-config-ui-editor.

    119 GitHub stars~942 tokensUpdated 6 days ago
    Frontend & DesignAuto-check passed

More from Gentleman-Programming/Gentleman-Skills

All 23 skills in this repo
  • Elixir Antipatterns

    Gentleman-Programming/Gentleman-Skills

    Core catalog of 8 critical Elixir/Phoenix anti-patterns covering error handling, separation of concerns, Ecto queries, and testing.

    657 GitHub stars~2.1k tokensUpdated 6 mo ago
    Auto-check passed
  • Skill Creator

    Gentleman-Programming/Gentleman-Skills

    Creates new AI agent skills following the Agent Skills spec.

    657 GitHub stars~1.1k tokensUpdated 6 mo ago
    Auto-check: notes
  • Angular Architecture

    Gentleman-Programming/Gentleman-Skills

    Angular architecture: Scope Rule, project structure, file naming, style guide.

    657 GitHub stars~823 tokensUpdated 6 mo ago
    Auto-check passed
  • Angular Core

    Gentleman-Programming/Gentleman-Skills

    Angular core patterns: standalone components, signals, inject, control flow, zoneless.

    657 GitHub stars~1.1k tokensUpdated 6 mo ago
    Auto-check passed
  • Angular Forms

    Gentleman-Programming/Gentleman-Skills

    Angular forms: Signal Forms (experimental) and Reactive Forms.

    657 GitHub stars~687 tokensUpdated 6 mo ago
    Auto-check passed
  • Angular Performance

    Gentleman-Programming/Gentleman-Skills

    Angular performance: NgOptimizedImage, @defer, lazy loading, SSR.

    657 GitHub stars~703 tokensUpdated 6 mo ago
    Auto-check passed

Works with

Questions about Zustand 5

What does Zustand 5 do?

Zustand 5 state management patterns. An agent skill from Gentleman-Programming/Gentleman-Skills. Zustand 5 is an agent skill from Gentleman-Programming/Gentleman-Skills. Zustand 5 state management patterns.

When should I use Zustand 5?

Zustand 5 fits situations like: tasks that involve State management.

How do I install Zustand 5 in Claude Code?

Run `npx skills add Gentleman-Programming/Gentleman-Skills --skill zustand-5 -a claude-code`. Or copy the skill folder (curated/zustand-5 in Gentleman-Programming/Gentleman-Skills) into .claude/skills/zustand-5 in your project. Claude Code loads it when a task matches its description.

How do I install Zustand 5 in Codex?

Run `npx skills add Gentleman-Programming/Gentleman-Skills --skill zustand-5 -a codex`. Or copy the skill folder (curated/zustand-5 in Gentleman-Programming/Gentleman-Skills) into .agents/skills/zustand-5 in your project. Codex loads it when a task matches its description.

Can I use Zustand 5 in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add Gentleman-Programming/Gentleman-Skills --skill zustand-5 -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/zustand-5, .gemini/skills/zustand-5, .github/skills/zustand-5 and .opencode/skills/zustand-5 in your project.

What does Zustand 5 need to run?

SKILL.md names no scripts, command-line tools or credentials: Zustand 5 is instructions for the agent only.

Does Zustand 5 access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Zustand 5 safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Zustand 5 use?

Zustand 5 is published under the Apache-2.0 licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Zustand 5 use?

About 1.2k tokens (SKILL.md is roughly 4.7k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Zustand 5?

Skills that share tags, products or a category with Zustand 5: React State Management (involvex/youtube-music-cli, 456 stars), LobeHub Data Fetching Layers (lobehub/lobehub, 83k stars), Create Store (ryokun6/ryos, 1.3k stars) and LobeHub Zustand Store Patterns (lobehub/lobehub, 83k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Zustand 5?

Gentleman-Programming (a GitHub organization) maintains it in Gentleman-Programming/Gentleman-Skills, which has 657 GitHub stars. The repository holds 23 skills in this directory. The repository was last updated on March 28, 2026.

Source: Gentleman-Programming/Gentleman-Skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.