developer coding skill risk: low
Zustand TypeScript Store Creator
Instructs creation of Zustand stores using subscribeWithSelector middleware, separate MyState and MyActions interfaces, individual selectors, and external subscriptions, with steps…
SKILL 1 file
SKILL.md
---
name: antigravity-awesome-skills-zustand-store-ts
description: "Create Zustand stores following established patterns with proper TypeScript types and middleware."
---
# Zustand Store
Create Zustand stores following established patterns with proper TypeScript types and middleware.
## Quick Start
Copy the template from assets/template.ts and replace placeholders:
- `{{StoreName}}` → PascalCase store name (e.g., `Project`)
- `{{description}}` → Brief description for JSDoc
## Always Use subscribeWithSelector
```typescript
import { create } from 'zustand';
import { subscribeWithSelector } from 'zustand/middleware';
export const useMyStore = create<MyStore>()(
subscribeWithSelector((set, get) => ({
// state and actions
}))
);
```
## Separate State and Actions
```typescript
export interface MyState {
items: Item[];
isLoading: boolean;
}
export interface MyActions {
addItem: (item: Item) => void;
loadItems: () => Promise<void>;
}
export type MyStore = MyState & MyActions;
```
## Use Individual Selectors
```typescript
// Good - only re-renders when `items` changes
const items = useMyStore((state) => state.items);
// Avoid - re-renders on any state change
const { items, isLoading } = useMyStore();
```
## Subscribe Outside React
```typescript
useMyStore.subscribe(
(state) => state.selectedId,
(selectedId) => console.log('Selected:', selectedId)
);
```
## Integration Steps
1. Create store in `src/frontend/src/store/`
2. Export from `src/frontend/src/store/index.ts`
3. Add tests in `src/frontend/src/store/*.test.ts`
## When to Use
This skill is applicable to execute the workflow or actions described in the overview.
## Limitations
- Use this skill only when the task clearly matches the scope described above.
- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
INPUTS
- {{StoreName}} REQUIRED
-
PascalCase store name
e.g. Project
- {{description}} REQUIRED
-
Brief description for JSDoc
REQUIRED CONTEXT
- store name
- description
ROLES & RULES
- Always Use subscribeWithSelector
- Separate State and Actions
- Use Individual Selectors
- Use this skill only when the task clearly matches the scope described above
- Do not treat the output as a substitute for environment-specific validation, testing, or expert review
- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing
EXPECTED OUTPUT
- Format
- code
- Constraints
-
- use subscribeWithSelector middleware
- separate state and actions interfaces
- use individual selectors
- follow template placeholders for StoreName and description
SUCCESS CRITERIA
- Follow established patterns with proper TypeScript types and middleware
- Copy the template from assets/template.ts and replace placeholders
- Create store in src/frontend/src/store/
- Export from src/frontend/src/store/index.ts
- Add tests in src/frontend/src/store/*.test.ts
EXAMPLES
Includes multiple code snippets demonstrating store creation with middleware, state/action interfaces, selector usage, and external subscriptions.
CAVEATS
- Dependencies
-
- assets/template.ts
- Missing context
-
- Full content of assets/template.ts
- Exact TypeScript version or Zustand version constraints
- Ambiguities
-
- The 'When to Use' section references an 'overview' that is not present in the prompt.
QUALITY
- OVERALL
- 0.76
- CLARITY
- 0.82
- SPECIFICITY
- 0.78
- REUSABILITY
- 0.85
- COMPLETENESS
- 0.68
IMPROVEMENT SUGGESTIONS
- Replace the vague 'When to Use' paragraph with 2-3 concrete task examples.
- Embed the template.ts content directly or provide a complete filled-in example store.
USAGE
Copy the prompt above and paste it into your AI of choice — Claude, ChatGPT, Gemini, or anywhere else you're working. Replace any placeholder sections with your own context, then ask for the output.
MORE FOR DEVELOPER
- Context7 Library Documentation Expert developer coding
- Structured Python Production Code Generator developer coding
- Angular Standalone Directive Generator developer coding
- Pytest Unit Test Suite Generator developer coding
- Unity Architecture Specialist developer coding
- Web Typography CSS Generator developer coding
- VSCode CodeTour File Expert developer coding
- Senior Python Code Reviewer developer coding
- Structured Cross-Language Code Translator developer coding
- Multi-DB SQL Query Optimizer and Builder developer coding
- Base R Programming Reference Guide developer coding
- Flutter Map SDK Layer Bug Fixer developer coding
- Expert Mobile App Builder for iOS Android developer coding
- Scalable Backend Architect Expert developer coding
- Comprehensive TypeScript Codebase Reviewer developer coding
- Code Improvement and Refactoring Suggester developer coding
- Vercel SPA Blank Screen Diagnoser developer coding
- CLAUDE.md File Generator for AI Coders developer coding
- App Store Screenshots Gallery Generator developer coding
- Spring Boot SOLID Architect Specialist developer coding
- React SaaS Metrics Dashboard Generator developer coding
- Software Optimization Auditor developer coding
- Senior Frontend Task Checklist Architect developer coding
- POSIX Shell Script Developer with Checklists developer coding
- Astro v6 Strict Architecture Rules developer coding