legend-state-best-practices

legend-state-best-practices is a skill for Codex from LegendApp/legend-skills. It costs 23 tokens per session (1,552 once invoked), scanned A, original, MIT.

A set of practices for using Legend-State, a library that stores changing application data and updates only the parts of a React app that need it.

In plain words
What is it for?
Use it to build or review Legend-State stores, React subscriptions, effects, saved data, synchronization, and migrations from older APIs.
Why use it?
It helps keep updates narrow and avoids unnecessary screen work, while separating data that affects the display from data used only by commands or background tasks.

Skill for Codex

Written for Codex: agents/openai.yaml present.

Good fit Use it to build or review Legend-State stores, React subscriptions, effects, saved data, synchronization, and migrations from older APIs.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/legendapp/legend-skills/legend-state-best-practices
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add LegendApp/legend-skills --skill legend-state-best-practices
Clone the repo
git clone --depth 1 https://github.com/LegendApp/legend-skills

Made for: Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for legend-state-best-practices

README.md
[![agentmods](https://agentmods.dev/badge/skills/legendapp/legend-skills/legend-state-best-practices/github.svg)](https://agentmods.dev/skills/legendapp/legend-skills/legend-state-best-practices)
Your own site
<a href="https://agentmods.dev/skills/legendapp/legend-skills/legend-state-best-practices"><img src="https://agentmods.dev/badge/skills/legendapp/legend-skills/legend-state-best-practices/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for legend-state-best-practices

Your own site · 80×15
<a href="https://agentmods.dev/skills/legendapp/legend-skills/legend-state-best-practices"><img src="https://agentmods.dev/badge/skills/legendapp/legend-skills/legend-state-best-practices.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 23 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,552 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • Socket pass 3 Oct 2026
  • Snyk warn 3 Oct 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00023 $0.01552
Opus 5.5 $0.00009 $0.00621
Sonnet 5.5 $0.00005 $0.00310
Haiku 4.5 $0.00002 $0.00155

Measured 1mo ago against content hash e7b456e25aab, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

legend-state-best-practices scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

legend-state-best-practices/SKILL.md · 92 lines

How it starts

The opening of the file, as written. The whole thing — 92 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Legend State Best Practices

Use Legend State to put reactive ownership at the smallest useful boundary.

Verify The Surface

Before changing code:

  • Check the installed @legendapp/state version, imports, nearby store helpers, persistence setup, and tests.
  • Consult the current docs for exact signatures and version-specific migration guidance:
  • Search for existing store factories, typed field hooks, reactive components, and naming conventions before adding a new abstraction.
  • Identify values that must update rendered UI separately from values read only by commands, callbacks, native bridges, or async work.

This skill is policy, not an API reference. Prefer the installed version's source and types when docs and code differ.

Choose The Mode

  • Build: choose observable ownership, render subscriptions, effects, persistence or sync boundaries, and validation before writing code.
  • Audit: inspect ownership, subscription breadth, non-reactive reads, React-to-observable mirrors, effects, persistence, and hot paths; report only concrete findings, ranked by impact and confidence.
  • Fix: inspect the relevant ownership and subscription path, then implement and verify within the scope already authorized by the conversation. Ask only for an unresolved product decision, materially larger scope, or an unauthorized external action.

For audits, trace each finding from the mutation source through the tracked read to the component or effect that updates. Do not label an observable read broad or expensive without identifying the subscribers it wakes and the rendered value they consume.

Ownership

  • Use observables for shared UI, session, settings, document, selection, and command state with many narrow consumers.
  • Use useObservable for component-lifetime state when nested UI needs field-level reactivity or handlers need a stable observable handle.
  • Keep one-off local UI state in React when it has no broader ownership, imperative-read, or render-fanout need.
  • Store canonical data once. Derive display values with a selector, computed observable, or local render calculation.
  • Reuse existing observable references. Do not pass an observable to observable or useObservable, or place it inside another observable merely for ownership, stability, or context. Nest one only when intentionally creating a link whose reads and writes forward to the source.
  • Keep one canonical owner; do not mirror between React and observable state. If downstream code needs observable state, replace the originating React state. Bridge only at a true external integration such as native APIs, storage, or measurement.
  • Keep routing, file picking, native calls, and other app-specific work outside generic observable stores.

Read the full file on GitHub · 92 lines

Files

What ships with it

2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago Changed e7b456e25aab
  2. 2mo ago Changed · -8 lines · -52 tokens per session b39783ccaf28
  3. 3mo ago First seen · 100 lines · 75 tokens per session scan A 2487697c3f57

Subscribe to this mod's changes

legend-state-best-practices is a skill published in the GitHub repository LegendApp/legend-skills (40 stars, last pushed 1mo ago), licensed MIT. It adds 23 tokens to every session and 1,552 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

legend-state-best-practices compared with skills from other repositories

legend-state-best-practices next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
legend-state-best-practicesLegendApp/legend-skillsSkill401mo agoMITA23Codex
custom-featuresTanStack/tableSkill29kyesterdayMITA35Claude Code, Codex
fast-typescript-checkinternet-development/www-sacredSkill1.6k16d agoMITA84Claude Code, Codex
port-sacred-terminal-ui-to-typescript-cliinternet-development/www-sacredSkill1.6k16d agoMITA0Claude Code, Codex
weapp-vite-react-best-practicesweapp-vite/weapp-viteSkill532todayMITA103Codex
senior-frontendroedyrustam/vibes-plugSkill132todayMITA52Cursor
react-generate-skilljiushiwon/wg-skillsSkill1549d agoApache-2.0A145Claude Code, Codex