state-management
БесплатноБез исполняемых скриптовНе проверенChoose the smallest viable React/fullstack state owner before comparing libraries. Use when the user needs to classify local UI state, shared subtree/Context…
от akillness★ 63 звезды на GitHubОб этом скилле
State Management
Use this skill when the real question is:
What packet is this state, who should own it, and what tempting wrong owner should we avoid?
Do not start with a library debate. Start by naming one primary packet, then choose the smallest owner that matches its lifecycle.
Read references/ownership-packets-and-route-outs.md before handling a mixed or ambiguous request.
Read references/decision-matrix.md when the packet is clear and you need to compare likely owners.
Read references/handoff-boundaries.md when the request may actually belong to react-best-practices, api-design, debugging, design-system, design-system, or responsive-design.
When to use this skill
- Decide whether a frontend problem is local UI state, shared subtree state, URL/navigation state, form state, server state, or long-lived client workflow state.
- Turn vague requests like “we need state management” into a concrete ownership recommendation.
- Choose between Context, Zustand, Redux Toolkit, Jotai, TanStack Query, or router-native ownership without treating them as interchangeable.
- Stop “one store for everything” proposals before implementation starts.
- Produce a short ownership brief for implementation or review.
When not to use this skill
- The main task is rerender churn, hydration mismatch, waterfalls, or client/server performance behavior → use
react-best-practices. - The main task is mutation shape, backend ownership, or optimistic-write API design → use
api-design. - The main task is debugging stale closures, races, broken optimistic updates, or existing state bugs → use
debugging. - The main task is controlled/uncontrolled component APIs, primitives, slots, or reusable component contracts → use
design-system. - The main task is visual system governance or shared preference policy → use
design-system. - The main task is viewport adaptation or layout collapse → use
responsive-design. - The architecture choice is already made and the user just needs code → implement directly instead of re-running the chooser.
Instructions
Step 1: Pick one primary packet
Choose the main packet before naming any tool:
- local-ui — toggles, open panels, inline edit state, active row, one-feature transient state
- shared-subtree — theme, auth snapshot, locale, feature flags, moderate shell state
- url-navigation — filters, sort order, pagination, selected tab, deep-linkable view state
- form-lifecycle — dirty/touched state, validation, submission lifecycle, async submit errors
- server-state — fetched data, caching, invalidation, revalidation, optimistic server updates
- client-workflow — cross-page drafts, undo, multi-step coordination, offline edits, long-lived workflow state
Optional: list one or two secondary packets, but force a single primary packet.
Quick frame:
Primary packet: server-state
Secondary packets: url-navigation, local-ui
Decision pressure: shareable filters + remote list freshness
Step 2: Choose the smallest owner
Use the narrowest owner that matches the packet:
- local-ui → local state, lifted state, or
useReducer - shared-subtree → Context when one moderate tree needs a shared source of truth
- url-navigation → router/search params when refresh, deep links, and back/forward should work naturally
- form-lifecycle → form-layer ownership, not app-wide global state
- server-state → TanStack Query or router-native data APIs when cache/revalidation rules dominate
- client-workflow → Zustand, Redux Toolkit, Jotai, or explicit state-machine modeling only after the earlier packets are separated
Rule: if the state is really route-shaped or server-shaped, do not hide it in a generic client store just because the store already exists.
Step 3: Run the anti-pattern check
Call out the most likely wrong owner explicitly:
- one universal store for unrelated lifecycles
- mirroring server cache into a client store without an offline/workflow reason
- hiding shareable filters or tabs outside the URL
- pushing form dirty/touched/submit lifecycle into global app state
- treating every slow or buggy UI issue as a state-architecture problem
A good answer names both the chosen owner and the tempting wrong owner.
Step 4: Compare client-store options only if a client-workflow packet remains
After local/shared/URL/form/server packets are separated:
- Context when the real pain is access/distribution across a moderate tree
- Zustand when you need low-ceremony cross-component or cross-page workflow state
- Redux Toolkit when workflows are coupled, event-heavy, or need stronger conventions and auditability
- Jotai when fine-grained atom composition truly matches the app’s mental model
- State machines / explicit workflow modeling when trans
Установить state-management в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadWriteBashGrepGlobВложенные файлы
FAQ
Что делает скилл state-management?
Choose the smallest viable React/fullstack state owner before comparing libraries. Use when the user needs to classify local UI state, shared subtree/Context state, URL or form state, server-state caches, or client workflow stores such as Zustand / Redux Toolkit / Jotai. Triggers on: global state, prop drilling, Context vs Zustand, Redux Toolkit vs Zustand, server state vs client state, React Router state management, optimistic updates, URL state, form state, and too much state in one store.
Как установить скилл state-management?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл state-management запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic