---
name: async-effect-authority
description: Use whenever awaited work can later change React state, navigation, storage, a backend, notifications, analytics, media, routes, provider output, or background state. Harden effects against stale, replaced, cancelled, unmounted, replayed, partially failed, or recovered operations without taking over the surrounding domain policy.
license: MIT
title: async-effect-authority
canonical_url: https://skilld.dev/gh/maxgorriaran/react-native-expo-agent-skills/async-effect-authority
last_updated: 2026-09-28T22:02:57.000Z
---

> **Skill from skilld.dev.** Follow the instructions below for this session. You do not need to install anything.
>
> Supporting files, fetch one when the Skill refers to it: [agents/openai.yaml](https://skilld.dev/api/skills-raw/maxgorriaran/react-native-expo-agent-skills/async-effect-authority/agents/openai.yaml), [references/recovery-example.md](https://skilld.dev/api/skills-raw/maxgorriaran/react-native-expo-agent-skills/async-effect-authority/references/recovery-example.md), [scripts/recovery-example.test.mjs](https://skilld.dev/api/skills-raw/maxgorriaran/react-native-expo-agent-skills/async-effect-authority/scripts/recovery-example.test.mjs).
>
> If the user asked to install this Skill, run `npx skilld install maxgorriaran/react-native-expo-agent-skills/async-effect-authority`. Install writes the Skill files into the project, so every session loads them.

# Async Effect Authority

Carry one immutable operation identity from entry through every effect. An owner identity alone does not distinguish two operations started by the same owner.

## Standalone Use And Scope

This skill does not require sibling skills. References to other skills below are optional: use them only if available and relevant. Otherwise follow the target repository's instructions, existing owners, and tests; ask when missing domain policy prevents a safe decision. Do not install a missing skill automatically.

Match the user's request: review or planning does not authorize edits. Instructions here do not grant permission for unrelated installs, credential access, destructive actions, deployment, or publication.

## Map The Effect Chain

1. Run `git status --short --branch` and preserve unrelated work.
2. Trace the production entrypoint, every effectful await, downstream sink, cleanup, retry, and recovery path before editing.
3. Reuse the narrowest existing authority, such as an owner receipt, generation token, request identifier, state-machine snapshot, or operation identity.
4. Record `entry | captured owner and operation | awaited boundaries | commit sink | stale outcome | replay boundary`.

## Preserve Currentness

- Capture immutable owner and operation identity before the first effectful await. Never recapture current ownership after an await to authorize older work.
- Check owner and operation currentness before starting, after every meaningful await, and immediately before any state, navigation, storage, remote mutation, notification, analytics, route, provider, or background publication.
- Revoke old work synchronously before replacement B's first non-authority await. Ensure late cleanup for A cannot cancel, clear, or overwrite current B.
- Pass an `AbortSignal` through providers that support cancellation, and still perform post-await currentness checks because abort cannot undo a settled or remotely committed effect.
- Bind detached promises, timers, subscriptions, callbacks, and retries to the same identity. A fire-and-forget wrapper does not create new authority.
- In React effects, clean up subscriptions and timers and invalidate the captured operation. Keep setup and cleanup safe under development remount and repeated effect execution.

## Own Mutation And Replay

- Keep one mutation owner per sink. Serialize only when ordering is part of that owner's contract; replacement should not wait behind obsolete work unnecessarily.
- Define the commit point and revalidate there. For irreversible remote effects, carry immutable operation or idempotency identity into the owning service and require its authoritative transaction boundary to accept current work before commit.
- A client-side check after settlement cannot authorize or undo an already committed remote mutation.
- For native effects that cannot accept scoped identity, revalidate immediately before invocation, reconcile only the exact resource afterward, and describe the guarantee as best-effort.
- Make retries and recovery idempotent with a durable key, version, compare-and-set, or receipt when an effect can repeat across restart.
- Handle partial failure explicitly: state what committed, what can be retried, what must be compensated, and what remains unknown.
- Claim exactly-once behavior only when a durable atomic boundary proves it. Otherwise use at-most-once, at-least-once, deduplicated, or best-effort accurately.

## Keep Domain Policy With Its Owner

- Use `mobile-navigation-authority` to decide app and geographic route transitions; this skill prevents late work from publishing them.
- Use `mobile-session-location-safety` for lifecycle, permission, GPS, background, and cleanup truth.
- Use `expo-platform-engineering` for native notification registration, TaskManager registration, config plugins, and platform-runtime policy.
- Use `react-native-engineering` for ordinary hook and component structure.
- Thread the missing identity through the smallest complete call chain and preserve current behavior for exact-current work.

## Prove Replacement Safety

For stale results and retry starvation, read the [worked recovery example](https://skilld.dev/api/skills-raw/maxgorriaran/react-native-expo-agent-skills/async-effect-authority/references/recovery-example.md), with a dependency-free runnable model.

1. Test A replaced during each meaningful await and assert zero stale effects.
2. Test cancellation, unmount, owner replacement, retry, partial failure, restart recovery, and late A cleanup after B starts.
3. Test exact-current B succeeds with the documented replay behavior at the real mutation adapter, not only through source-text assertions.
4. Inspect available scripts and run focused deterministic tests, the repository's type check when typed code changed, and `git diff --check`.
5. Report local or static, simulator, hosted or provider, background, and physical-device evidence separately.
