Skip to content
Agentmart
Submit a tool

zustand-store-patterns

Create or modify Zustand v5 stores in the MultimateAi codebase.

Skill by NarihitoM

IndexedMIT★ 9
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/narihitom-zustand-store-patterns

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Create or modify Zustand v5 stores in the MultimateAi codebase. Use when: building a new feature store, adding state to an existing store, understanding the common store shape, or fixing store-related bugs.

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/zustand-store-patterns

What's inside

Skill name
zustand-store-patterns
Description
Create or modify Zustand v5 stores in the MultimateAi codebase. Use when: building a new feature store, adding state to an existing store, understanding the common store shape, or fixing store-related bugs.
License
MIT
Instructions
178 lines in SKILL.md · view on GitHub

Files (1)

  • SKILL.md

SKILL.md (first lines)

# Zustand Store Patterns

## When to Use

- Adding a new feature that needs client state
- Understanding the standard store fields
- Debugging store updates that don't trigger re-renders
- Adding provider/model selector state

## Common Store Shape

Every feature store follows this interface pattern:

```typescript
interface FeatureState {
  // Chat state
  provider: string;
  model: string;
  input: string;
  sending: boolean;
  sessionmessage: any[];
  pendingImages: any[];

  // Loading & pagination
  loadingfetch: boolean;
  loadingerror: boolean;
  nextCursor: string | null;
  hasMore: boolean;

  // Image lightbox
  lightboxOpen: boolean;
  lightboxImage: string | null;

  // UI state
  copiedIndex: number | null;
  pendingApproval: ToolApproval | null;

  // Refs (stored in state for React compat)
  pendingApprovalRef: React.MutableRefObject<any>;
  threadIdRef: React.MutableRefObject<string>;
  topSentinelRef: React.MutableRefObject<HTMLDivElement | null>;
  scrollContainerRef: React.MutableRefObject<HTMLDivElement | null>;
  abortControllerRef: React.MutableRefObject<AbortController | null>;

  // Setters
  setProvider: (provider: string) => void;
  setModel: (model: string) => void;
  setInput: (input: string) => void;
  setSending: (sending: boolean) => void;
  updateSessionMessages: (updater: (prev: any[]) => any[]) => void;
  resetSending: () => void;
  scrollToBottom: () => void;
}
```

## Store Template

```typescript
import { create } from "zustand";

interface FeatureStore {
  // === State ===
  provider: string;
  model: string;
  input: string;
  sending: boolean;
  sessionmessage: any[];
  loadingfetch: boolean;
  loadingerror: boolean;

  // === Setters ===
  setProvider: (provider: string) => void;
  setModel: (model: string) => void;
  setInput: (input: string) => void;
  setSending: (sending: boolean) => void;
  updateSessionMessages: (updater: (prev: any[]) => any[]) => void;
}

export const featurestore = create<FeatureStore>((set) => ({
  // Initial state
  provider: "",
  model: "",
  input: "",
  sending: false,
  sessionmessage: [],
  loadingfetch: false,
  loadingerror: false,

  // Setters
  setProvider: (provider) => set({ provider, model: "" }), // Reset model on provider change
  setModel: (model) => set({ model }),
  setInput: (input) => set({ input }),
  setSending: (sending) => set({ sending }),
  updateSessionMessages: (updater) =>
    set((state) => ({ sessionmessage: updater(state.sessionmessage) })),
}));
```

## Critical Patterns

### 1. `setProvider` Resets the Model

```typescript
setProvider: (provider) => set({ provider, model: "" });
```

When the user switches providers, the selected model **must** reset to empty. This prevents sending a request with a model that doesn't exist on the new provider.

### 2. `updateSessionMessages` Pattern

Never mutate `sessionmessage` directly:

```typescript
// ✅ Correct
store.updateSessionMessages((prev) => [...prev, newMessage]);

// ❌ Wrong — won't trigger re-render
store.sessionmessage.push(newMessage);
```

From NarihitoM/MultimateAi, MIT.

Signals

Stars
9
Forks
1
Open issues
0
Last commit (this folder)
Jul 23, 2026 (3 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from NarihitoM

Cite this page

zustand-store-patterns skill. Agent Mart. https://agentmart.dev/skills/narihitom-zustand-store-patterns (last updated 2026-10-24)