agentleFS
DobroslavRadosavljevicDobroslavRadosavljevic/cabrakan/.agents/skills/legend-state/SKILL.md

legend-state

Skill1 starsChanged 3 months agoMITView on GitHub

Build, review, debug, migrate, or plan Legend-State v3 applications with current docs. Use for @legendapp/state v3 beta, observable, useValue, observer, Memo, $React, useObservable, computed or linked observables, observe, when, batch, fine-grained React rendering, React Native, local persistence, syncObservable, synced, syncedCrud, syncedFetch, syncedQuery, Supabase, Firebase, Keel, offline-first sync, transforms, syncState, testing, performance, and v2-to-v3 migrations.

The file

We split this skill into the rules it gives an agent

10 rules. About 0 are common, 4 are distinctive, and 6 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 6

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use this skill for Legend-State v3 work across core observables, React or React Native integration, persistence, remote sync, and …

    line 8
  2. Distinctive:

    Read local agent guidance and nearby state conventions.

    line 13
  3. Very specific:

    Check the exact @legendapp/state version and package manager lockfile.

    line 14
  4. Very specific:

    Prefer useValue(observableOrSelector) for React reads.

    line 27
  5. Very specific:

    Use observer as an optional hook-count optimization for components with many or conditional useValue calls, not as the primary subscription …

    line 28
  6. Very specific:

    Use peek() only for deliberately untracked reads.

    line 30
  7. Very specific:

    Keep computed, linked, and synced getters pure except for the documented data-loading behavior of async or synced getters.

    line 31
  8. Very specific:

    Prefer narrow observable nodes and selectors.

    line 32
  9. Distinctive:

    Treat persistence as a cache and retry queue, not as authorization or secure secret storage.

    line 35
  10. Distinctive:

    Use the repository's existing checks.

    line 41

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
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

  1. Inspect the project before changing code:
    • Read local agent guidance and nearby state conventions.
    • Check the exact @legendapp/state version 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.
  2. Confirm the release channel before using v3 APIs. Version 3 is prerelease in the current snapshot while npm latest is v2. Start with references/source-map.md, then refresh current docs and package metadata when versions matter.
  3. For observable creation, reads and writes, computed or linked state, reactivity, arrays, events, batching, and helpers, use references/core-observables.md.
  4. For React, React Compiler compatibility, fine-grained rendering, React Native, hooks, control flow, context, and tracing, use references/react-integration.md.
  5. For local persistence, remote sync, CRUD, retries, transforms, plugins, sync status, and local-first reliability, use references/persistence-sync.md.
  6. For v2 migrations, beta drift, architecture, security, performance, SSR, debugging, and tests, use references/production-migration-testing.md.
  7. Match the installed declarations and existing project style. Do not copy v2 examples into v3 code or assume a v3 beta API remains unchanged.

Implementation Judgment

  • Prefer useValue(observableOrSelector) for React reads. Treat useSelector and use$ as migration aliases, and do not rely on direct .get() calls inside observer; that pattern conflicts with React Compiler guidance.
  • Use observer as an optional hook-count optimization for components with many or conditional useValue calls, not as the primary subscription API.
  • Mutate through observable APIs such as set, assign, delete, array methods, and Map or Set methods. Never mutate raw data returned by get() or peek() and expect notifications.
  • Use peek() only for deliberately untracked reads. Use get(true) for shallow key or collection tracking when that is the actual dependency.
  • Keep computed, linked, and synced getters pure except for the documented data-loading behavior of async or synced getters. Put side effects in actions, observe, onChange, or explicit application services.
  • Prefer narrow observable nodes and selectors. Use Memo, $React, For, Show, or Switch only when moving updates to a smaller React boundary materially helps.
  • Batch related writes. This matters for listener churn, React renders, and persistence write amplification.
  • Choose synced(...) when lazy activation on first read is desired; choose syncObservable(...) when an existing observable should begin syncing immediately.
  • Treat persistence as a cache and retry queue, not as authorization or secure secret storage. Keep server authorization, row-level access, validation, and conflict policy explicit.
  • For async persistence, gate reads that require hydrated data on syncState(state$).isPersistLoaded. For remote readiness, use isLoaded, error, and pending-change state rather than guessing from data shape.
  • Model logout, tenant changes, and auth gates explicitly. A live useValue or other observer can reactivate a lazy synced observable after reset unless the selector or sync configuration is gated.

Verification

Use the repository's existing checks. For meaningful Legend-State work, include the relevant subset:

  • Typecheck against the installed v3 beta declarations and exact subpath imports.
  • Unit tests for observable writes, computed dependencies, linked setters, batching, cleanup, Map or Set behavior, and raw-data mutation mistakes.
  • React tests for render boundaries, useValue, observer, Memo, For, Show, Strict Mode cleanup, Suspense, and React Compiler-sensitive patterns.
  • Persistence tests for hydration order, transforms, migrations, retry metadata, out-of-order saves, resets, and storage failures.
  • Sync tests for create, update, delete, paging, realtime subscriptions, retries, conflict or last-write rules, auth gating, and pending changes across restart.
  • Browser or device smoke tests for offline edits, reload, reconnect, failed writes, logout, tenant switching, and storage upgrades.
  • Migration scans for v2 persistence APIs, old computed or proxy helpers, useSelector or use$, direct .get() in render paths, legacy reactive component imports, and renamed return or callback behavior.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.