Skip to content
Skill

Async safety

Stops React Native async code from failing silently, racing or leaking listeners

Async safety is an open-source agent skill for developer tools. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.

Scripts
JavaScript, TypeScript
Platforms
Claude Code, Codex, Cursor
GitHub stars
16
Last commit
License
MIT
Listing updated

Similar skills

About Async safety

This skill sets rules for promises, effects, cancellation, subscriptions and timers in an Expo or React Native app, so async results do not land after they are stale and rejections are not dropped. It covers wrapping promise-returning handlers, typing callbacks as void, cancelling effect work with an AbortController per run, latest-wins handling for overlapping reads, and releasing listeners and timers where they were created.

It bundles three small TypeScript helpers with tests: a latest-request tracker, a delayOrAbort pause and a withTimeout deadline that aborts the abandoned task. It also ships a zero-dependency Node checker that scans the code for the patterns the rules forbid, plus reference notes and example hooks that show the intended shapes.

The guidance expects a codebase using TypeScript, Jest and ESLint, and it defers server-state caching to a TanStack Query setup. Some checks are meant to be confirmed on an iOS simulator or Android emulator, since the cancellation and background behaviour differ on a device from what Jest reports.

When your agent uses it

Prevents silent async bugs: effect races, stale results, lost promises, leaked listeners and timers, AbortSignal gaps. Use when writing useEffect, setTimeout, listeners or cancellation. Not for query caching (networking-and-server-state).

From the skill's SKILL.md. Your agent reads this description to decide when to load the skill.

What it can access

From a static check of its 33 files (386 KB) on GitHub on 5 December 2026. Nothing was run. Read the files before you install a skill: it can tell your agent to run anything its tools allow.

Check another skill before you install it.

Install

This skill ships in the react-native plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):

/plugin marketplace add zakariaf/ReactNative-Skills
/plugin install react-native@react-native-skills

Or copy only this skill to ~/.claude/skills/async-safety:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/zakariaf/ReactNative-Skills.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/async-safety &&
cp -R "$tmp/skills/async-safety" ~/.claude/skills/async-safety &&
rm -rf "$tmp"

For one project only, put the folder in .claude/skills/async-safety inside it instead.

Claude Code docs on skills

Copy the skill folder to ~/.agents/skills/async-safety to use it in every repository:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/zakariaf/ReactNative-Skills.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/async-safety &&
cp -R "$tmp/skills/async-safety" ~/.agents/skills/async-safety &&
rm -rf "$tmp"

For one repository only, put the folder in .agents/skills/async-safety inside it instead.

Codex docs on skills

Copy the skill folder to ~/.cursor/skills/async-safety to use it in every project:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/zakariaf/ReactNative-Skills.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/async-safety &&
cp -R "$tmp/skills/async-safety" ~/.cursor/skills/async-safety &&
rm -rf "$tmp"

For one project only, put the folder in .cursor/skills/async-safety inside it instead.

Cursor docs on skills

Run in a terminal (add --scope workspace to install it for the current workspace only):

gemini skills install https://github.com/zakariaf/ReactNative-Skills.git --path skills/async-safety

Or copy the folder to ~/.gemini/skills/async-safety yourself.

Gemini CLI docs on skills

For GitHub Copilot in VS Code, copy the skill folder to ~/.copilot/skills/async-safety:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/zakariaf/ReactNative-Skills.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/async-safety &&
cp -R "$tmp/skills/async-safety" ~/.copilot/skills/async-safety &&
rm -rf "$tmp"

For one project only, put the folder in .github/skills/async-safety inside it instead.

VS Code docs on skills

Get the folder:

git clone --depth 1 https://github.com/zakariaf/ReactNative-Skills.git

Then copy ReactNative-Skills/skills/async-safety into your agent's skills folder as async-safety. Agents that support SKILL.md read one folder per skill.

The SKILL.md format

What it does

Promise ownership rules
Ensures promise-returning functions are wrapped rather than passed by reference into event props.
Effect cancellation
Aborts in-flight work in effect cleanups and checks signals before each state write.
Latest-wins requests
Lets a newer read abort an older overlapping one while writes are never aborted.
Cancellation without errors
Decides cancellation by checking the abort signal rather than error names.
Listener and timer release
Keeps subscription handles and timer ids so they are removed in the matching cleanup.
Deadlines and retries
Provides a timeout wrapper and abortable delays for bounded retry loops.
Static checker
A dependency-free script that flags the forbidden async patterns in a project.

Good for

  • Fix a search screen where an older query result overwrites a newer one
  • Stop a polling interval from running while a screen is covered
  • Add a timeout to a native SDK call that can hang
  • Remove a listener that leaks after a screen unmounts
  • Replace a retry loop's sleep with one that stops when the screen leaves

Async safety FAQ

Does Async safety handle server data fetching?

No. Server reads are meant to use useQuery from the networking skill; this skill covers async work that is not server state, such as SQLite reads and native SDK or OS calls.

What does the checker script need?

It is a zero-dependency Node script run from the repository root, and it reports FAIL lines and a final RESULT line.

Which clients does Async safety work with?

It follows the shared agent skills format and is not tied to a specific client in its content, so it applies to all supported clients.

How do I install Async safety in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/async-safety to use it in all your projects, or to .claude/skills/async-safety in one project. Or install the react-native plugin, which includes it: /plugin marketplace add zakariaf/ReactNative-Skills, then /plugin install react-native@react-native-skills.

Does Async safety run scripts?

Yes. It runs JavaScript and TypeScript scripts. Its scripts contain network calls. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

Which AI agents can use Async safety?

Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose. Each reads skills in the SKILL.md format from its own folder; the install steps on this page list them.

What are the best alternatives to Async safety?

The closest alternatives to Async safety are Error handling typed results, Accessibility as code, Vercel react native skills, Game session host and Architecture and boundaries.

Where this comes from

  • Description: from the skill's own SKILL.md.

More from zakariaf/ReactNative-Skills

  1. Turns canvas taps, swipes and drags into typed intents hit-tested on the drawn layout

    • Open source
    • 16 GitHub stars
    • Developer tools
  2. Adds a gated debug menu, debug deep link and simulated clock and offline mode to React

    • Open source
    • 16 GitHub stars
    • Developer tools
  3. Checks React Native code for accessibility labels, touch targets, text scaling

    • Open source
    • 16 GitHub stars
    • Developer tools
  4. Sells a one-time Premium unlock through the App Store and Google Play

    • Open source
    • 16 GitHub stars
    • Finance and payments
  5. Walks an Expo app through an SDK, Xcode or Android toolchain upgrade in one commit

    • Open source
    • 16 GitHub stars
    • Developer tools
  6. Builds React Native forms with one valibot schema, catalog-key errors and keyboard-aware

    • Open source
    • 16 GitHub stars
    • Developer tools