legend-state
Installation
SKILL.md
Legend-State
Use this skill for Legend-State v3 work across core observables, React or React Native integration, persistence, remote sync, and migrations.
Workflow
- Inspect the project before changing code:
- Read local agent guidance and nearby state conventions.
- Check the exact
@legendapp/stateversion and package manager lockfile. - Identify the runtime: vanilla TypeScript, React web, React Native, Expo, SSR, or a mixed app.
- Map observable ownership and lifetime: module singleton, request scoped, provider scoped, component local, or synced resource.
- Inventory React consumption (
useValue,observer,Memo,$React, control-flow components), persistence plugins, sync plugins, and deprecated APIs.
- Confirm the release channel before using v3 APIs. Version 3 is prerelease in the current snapshot while npm
latestis v2. Start with references/source-map.md, then refresh current docs and package metadata when versions matter. - For observable creation, reads and writes, computed or linked state, reactivity, arrays, events, batching, and helpers, use references/core-observables.md.
- For React, React Compiler compatibility, fine-grained rendering, React Native, hooks, control flow, context, and tracing, use references/react-integration.md.
- For local persistence, remote sync, CRUD, retries, transforms, plugins, sync status, and local-first reliability, use references/persistence-sync.md.
- For v2 migrations, beta drift, architecture, security, performance, SSR, debugging, and tests, use references/production-migration-testing.md.
- Match the installed declarations and existing project style. Do not copy v2 examples into v3 code or assume a v3 beta API remains unchanged.