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 Expertdevelopercoding
- Structured Python Production Code Generatordevelopercoding
- Angular Standalone Directive Generatordevelopercoding
- Pytest Unit Test Suite Generatordevelopercoding
- Unity Architecture Specialistdevelopercoding
- Web Typography CSS Generatordevelopercoding
- VSCode CodeTour File Expertdevelopercoding
- Senior Python Code Reviewerdevelopercoding
- Structured Cross-Language Code Translatordevelopercoding
- Multi-DB SQL Query Optimizer and Builderdevelopercoding
- Base R Programming Reference Guidedevelopercoding
- Flutter Map SDK Layer Bug Fixerdevelopercoding
- Expert Mobile App Builder for iOS Androiddevelopercoding
- Scalable Backend Architect Expertdevelopercoding
- Comprehensive TypeScript Codebase Reviewerdevelopercoding
- Code Improvement and Refactoring Suggesterdevelopercoding
- Vercel SPA Blank Screen Diagnoserdevelopercoding
- CLAUDE.md File Generator for AI Codersdevelopercoding
- App Store Screenshots Gallery Generatordevelopercoding
- Spring Boot SOLID Architect Specialistdevelopercoding
- React SaaS Metrics Dashboard Generatordevelopercoding
- Software Optimization Auditordevelopercoding
- Senior Frontend Task Checklist Architectdevelopercoding
- POSIX Shell Script Developer with Checklistsdevelopercoding
- Astro v6 Strict Architecture Rulesdevelopercoding