Reatom Async
Developmentreatom-asyncReatom Async is an Agent Skill for development published in the reatom/reatom repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.
Masters Reatom v1001 async flows. Use when implementing, documenting, or reviewing Reatom async queries, mutations, wrap usage, withAsync, withAsyncData, withAbort, abortVar, sampling, take, onEvent, race, framePromise, Suspense, retry, caching, or race-prone UI workflows.
QUICK START
How to use this skill
Bring this guide into your coding agent with a prompt tailored to the tool you use.
- Open your project in Codex.
- Copy and paste the prompt below.
- Review files and risks before approving any action.
Prompt to paste
Inspect the Agent Skill at https://github.com/reatom/reatom/blob/HEAD/skills/reatom-async/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/reatom-async, but wait for my approval before writing files or running scripts.
Copying this prompt does not install or run the skill. Review third-party files before use.
Reatom Async
Use this skill when the task is mainly about Reatom async behavior. Treat REFERENCE.md as the bundled async source of truth.
How to Use
- Read only the REFERENCE.md sections that match the task.
- Prefer Reatom async patterns over debounce libraries, mount-time fetches, refs, local component promise state, or manual AbortController bookkeeping.
- For general Reatom modeling, use the
reatomskill. For@reatom/jsxDOM JSX specifics, usereatom-jsx. For reviews, combine this skill withreatom-review. - If docs, source, and tests disagree, prefer source and tests, then fix the doc/example that is stale.
Section Map
- Queries and mutations:
Choosing the Primitive,withAsyncData,withAsync - Context after
await:wrap Rules - Cancellation:
withAbort,abortVar and Fetch Signals - Debounce, throttle, waits, races:
Sampling and Procedural Async - Redux-saga migration:
Redux-Saga Mapping - Loading UI and retry:
Status, Retry, Reset - Suspense:
Suspense Boundaries - Code review:
Common Mistakes,Tested Edge Cases
Implementation Defaults
- Query/read data:
computed(async () => ...).extend(withAsyncData({ initState })). - Command/mutation:
action(async () => ...).extend(withAsync(...)); addwithAbort(...)when stale calls must stop. - Every async boundary that leaves a Reatom frame uses
await wrap(promise). - External callbacks that call Reatom state/actions are passed as
wrap(fn)or wired withonEvent. - Abortable fetches use
signal: abortVar.require().signalor a scopedabortVar.subscribe(). - Debounce and throttle follow the sampling docs:
await wrap(sleep(ms))inside the flow pluswithAbort()strategies, not split debounce helpers. - Route/page data belongs in route loaders or async computeds, not component effects.
- Form submit is an async mutation: put it in
reatomForm({ onSubmit })and use fieldvalidatefor async/dependent checks (debounce withawait wrap(sleep(ms))), instead of hand-rolled submit actions or debounced validators. - Suspense is for global one-shot initialization, not dynamic page data.
Review Defaults
- Flag unwrapped awaits before atom/action calls.
- Flag
withAsyncused for query data wherewithAsyncDatashould own.data. - Flag
withAsyncwithoutwithAbortwhen stale command calls can update state. - Flag
.status()without{ status: true }. - Flag action
.retry()without{ cacheParams: true }. - Flag
withCache()beforewithAsync()/withAsyncData(). - Flag aborts displayed as business errors.
- Flag raw
Promise.racewhen loser cleanup is needed.