legend-state-best-practices

legend-state-best-practices is a skill for Codex from LegendApp/legend-skills. It costs 75 tokens per session (1,821 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 75 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,821 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 17 Jul 2026
  • Snyk pass 17 Jul 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.00075 $0.01821
Opus 5 $0.00037 $0.00911
Sonnet 5 $0.00015 $0.00364
Haiku 4.5 $0.00007 $0.00182

Measured 11d ago against content hash 2487697c3f57, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, 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 11d 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 · 100 lines

How it starts

The opening of the file, as written. The whole thing — 100 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: run the same audit and state a ranked plan. Before a non-trivial ownership, persistence, or broad render change, wait for explicit approval such as go; after approval, change the proven misuse in reviewable slices and verify the affected subscriptions and behavior. Stop when the correct model requires a product decision or materially larger scope.

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 · 100 lines

Files

What ships with it

1 file 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. 11d 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 (39 stars, last pushed 1mo ago), licensed MIT. It adds 75 tokens to every session and 1,821 once invoked, about $0.0004 per session on Opus 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

Other skills, from other repositories

custom-features

Author a TanStack Table v9 feature plugin across every FeatureMap and API installation surface: state, options, column definitions, table, column, row, cell, header, row-model functions/caches, defaults, prototypes, and table/row/column instance data lifecycles. Load for initTableInstanceData, resetTableInstanceData…

TanStack/table · 93 tokens

frontend-conventions

Coding conventions, architecture patterns, and testing rules for the SkillHub React frontend. Ensures agents follow Feature-Sliced Design and use the generated OpenAPI types.

iflytek/skillhub · 36 tokens

fast-typescript-check

Keep www-sacred's TypeScript fast to type-check and fast to run. Use when touching the ASCII/canvas animation components (the only real per-frame code here), tightening type-check wall-clock, or auditing a change for runtime or compiler regressions. Scoped to this repo — a React 19 / Next.js 16 component library plus…

internet-development/www-sacred · 84 tokens

typescript-react

Apply, review, and explain React conventions from the TypeScript Style Guide. Use automatically for TypeScript and TSX tasks involving prop-derived state, prop typing, component responsibilities, data flow, compound components, or client and server state.

mkosir/typescript-style-guide · 50 tokens

typescript-rules

React/TypeScript frontend development rules including type safety, component design, state management, and error handling. Use when implementing React components, TypeScript code, or frontend features.

shinpr/claude-code-workflows · 39 tokens

coding-standards

A set of general coding standards and practical patterns for TypeScript, JavaScript, React, and Node.js. It covers readable naming, simple designs, avoiding repetition, and delaying unnecessary features.

loulanyue/awesome-claude-notes · 41 tokens