<< All versions

Skill v1.0.0

currentAutomated scan100/100
kok-o/contextos-agents/state-management
──Details
PublishedNovember 6, 2026 at 06:52 AM
Content Hashsha256:1a87ba7e8855c7e2...
Git SHAa2bec4f24f71
──Files
Files (1 file, 2.5 KB)
SKILL.md2.5 KBactive
SKILL.md · 49 lines · 2.5 KB

name: state-management description: Choose and implement state ownership, synchronization, subscriptions and mutation recovery in frontend applications. metadata: version: "1.0.0"


state-management

Overview

Choose and implement state ownership, synchronization, subscriptions and mutation recovery in frontend applications. Match guidance to the actual task and project; this document does not implement an automatic enforcer.

When to Use

A state ownership, synchronization or update problem is in scope. Respect the existing React state/data stack rather than automatically introducing Zustand or TanStack Query.

Rules & Patterns

Identify authoritative state, derived values, URL state, transient UI state and server data. Keep each source of truth understandable and avoid unnecessary duplicate writable copies.

Use the project's existing data/cache utilities where suitable. Server data can be managed by a framework, query library or another deliberate architecture; it does not universally belong in one package.

Subscribe to the data actually needed and inspect rerender behavior before optimizing. Use selectors/equality APIs compatible with the installed version. A centralized key factory may help larger caches but is not required for every query.

Define invalidation, cancellation and stale-response behavior. When optimistic UI is appropriate, handle failed and overlapping mutations without restoring stale data over a newer successful change.

Scope caches and stores to the right user/request boundary. Shared client or server state must not leak identity or tenant-specific data across sessions.

Code Examples

For a filterable catalog, determine which filters belong in the URL, which state is local and which results come from the server. For optimistic editing, test overlapping updates and failure recovery rather than only a successful click.

See EXAMPLES.md for scoped scenarios and evidence boundaries.

Validation Checklist

  • [ ] Exercise stale responses, relevant concurrency, invalidation and reset/session boundaries.
  • [ ] Verify subscriptions and persisted effects at the appropriate layer.

Common Mistakes

Introducing a global store for a local toggle; forcing a specific library; restoring obsolete optimistic snapshots; using global server request state.

Integration Notes

Optional companion guidance: react, typescript, webapp-testing. Use it only when relevant and available; the skill does not install tools or authorize external actions.

All versions