darknecrocities/skillbuilder/state-management
Claude Code and agent skill by darknecrocities/skillbuilder
Trust tier 2
- community
Source check pending
Checking that the SKILL.md file is still in the repository.
Declarative state machines, TanStack Query server-state caching, invalidation, optimistic updates, atomic Zustand slices, and signals.
Install
npx vskill@latest install darknecrocities/skillbuilder/state-managementSKILL.md
Declarative State Machines, Cache & Signals (/state-management)
Philosophy: Server state is an asynchronous remote cache; client state is an ephemeral synchronous state machine. Never store remote data in local UI state. Prohibit boolean explosion. Invalidate with Query Key Factories. Memoize store selectors to eliminate re-render cascades.
This skill establishes production architecture for state management across TanStack Query (React Query), Zustand, Jotai, XState, and Signals.
1. Quick Navigation & Progressive Disclosure
| Resource Type | Document | Description | |
|---|---|---|---|
| Reference | references/tanstack-query-caching-patterns.md | Query key factories, stale time configurations, targeted cache invalidation. | |
| Reference | references/zustand-atomic-slices.md | Slice composition patterns, selector memoization to prevent re-renders. | |
| Utility | scripts/verify_state_hygiene.py | Scans components for boolean flag explosions, un-memoized store selections, and inline query keys. |
2. The Core State Architecture Gates
- Gate 1: Strict Boundary Separation: Server state (remote API data) belongs exclusively in TanStack Query. Ephemeral client state (drawer open/closed, form draft) belongs in local state or Zustand.
- Gate 2: Zero Boolean Explosion: Replace uncoordinated flags (
isLoading,isError,isSuccess) with a single deterministic state machine enum (status: 'idle' | 'loading' | 'success' | 'error'). - Gate 3: Query Key Factories: Centralize query keys into structured, strongly-typed factory objects (
projectKeys.detail(id)) for deterministic cache invalidation. - Gate 4: Granular Store Subscriptions: Always select specific slices (
useStore(state => state.isOpen)). Never subscribe to the root store object. - Gate 5: Optimistic Mutations with Rollbacks: Optimistic UI updates must snapshot previous cache state in
onMutateand roll back ononError.
2. Query Key Factory & TanStack Query (TypeScript)
3. Atomic Zustand Slice with Selector Memoization
4. State Management Verification CLI
Audit your codebase for boolean explosions and un-memoized store subscriptions:
Audited Rules:
STATE-BOOLEAN-EXPLOSION: Flags components using multiple simultaneous boolean status flags.STATE-UNMEMOIZED-STORE-SUBSCRIPTION: Flags consuming an entire Zustand/Redux store without a selector.STATE-RAW-STRING-QUERY-KEY: Flags raw un-namespaced query key strings inuseQuery.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/state-management/SKILL.md
Popularity
- Repository stars
- 13
- Repository forks
- 2
- 7-day trend score
- 0
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/darknecrocities/skillbuilder/state-management)