# Background tasks

> Background tasks is an open-source agent skill for developer tools. Builds budgeted, idempotent expo-background-task jobs that run on iOS and Android. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf, Goose
- **Website:** https://github.com/zakariaf/ReactNative-Skills/tree/main/skills/background-tasks
- **Repository:** https://github.com/zakariaf/reactnative-skills
- **GitHub stars:** 16
- **License:** MIT
- **Skill name:** background-tasks
- **Collection:** https://github.com/zakariaf/ReactNative-Skills
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-12-04

## About

This skill guides an agent through adding periodic background work to an Expo React Native app with expo-background-task and expo-task-manager. It sets up a single runner that applies a time budget, never throws, and records each run in a durable run log, along with a port that schedules jobs at one explicit interval of at least 15 minutes after startup.

The workflow covers defining tasks at module scope in an entry-imported registry, writing jobs that run without React and avoid running migrations, and giving every job a foreground path through the same runner. The skill also ships a zero-dependency checker script that scans the project for these rules and reports pass or fail, and it includes device-proof steps for forcing runs on an Android emulator and an iOS device.

It expects an Expo project with the config plugin for expo-background-task, and TypeScript and Jest for the templates and tests. Reference files cover platform limits, job design, and testing.

## When your agent uses it

> Builds expo-background-task jobs: idempotent, budgeted runs. Use when adding periodic sync, TaskManager.defineTask, leaving expo-background-fetch, or a background task never runs. Not for reminders (local-notifications).

## What it can access

From a static check of the files on GitHub; nothing was run.

- [Runs JavaScript and TypeScript scripts](https://github.com/zakariaf/ReactNative-Skills/tree/HEAD/skills/background-tasks)
- [Network calls found in its scripts](https://github.com/zakariaf/ReactNative-Skills/tree/HEAD/skills/background-tasks)
- [License: MIT](https://github.com/zakariaf/ReactNative-Skills/tree/HEAD/skills/background-tasks)

## Features

- **Budgeted job runner:** Runs each job under a fixed time limit, stops at step boundaries, and records crashes and timeouts instead of throwing.
- **Module-scope task registry:** Defines every background task at top level in a file the app entry imports, so headless launches can find it.
- **Idempotent job design:** Guides jobs to use idempotency keys, state transitions and one commit per step so repeated or cut runs stay safe.
- **Interval reconciliation:** Schedules jobs after startup with one interval of at least 15 minutes and removes tasks the build no longer defines.
- **Foreground fallback path:** Runs the same jobs on app activity or after writes, kept separate from background records in the run log.
- **Checker script:** Scans the project for the skill's rules and prints a pass or fail result with a line per finding.
- **Device proof steps:** Explains how to force a background run on an Android emulator with adb and on an iOS device, then read the run record.

## Good for

- Add a periodic sync that uploads queued local changes when the phone allows it
- Replace an expo-background-fetch task with expo-background-task
- Define a new background job and register it after app startup
- Debug a background task that never runs on an iOS device or Android emulator
- Write Jest tests that prove a background job is safe to run twice

## Install

### Claude Code

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

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

Or copy only this skill to `~/.claude/skills/background-tasks`:

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

For one project only, put the folder in `.claude/skills/background-tasks` inside it instead.

### Codex

Copy the skill folder to `~/.agents/skills/background-tasks` to use it in every repository:

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

For one repository only, put the folder in `.agents/skills/background-tasks` inside it instead.

### Cursor

Copy the skill folder to `~/.cursor/skills/background-tasks` to use it in every project:

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

For one project only, put the folder in `.cursor/skills/background-tasks` inside it instead.

### Gemini CLI

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

```sh
gemini skills install https://github.com/zakariaf/ReactNative-Skills.git --path skills/background-tasks
```

Or copy the folder to `~/.gemini/skills/background-tasks` yourself.

### VS Code

For GitHub Copilot in VS Code, copy the skill folder to `~/.copilot/skills/background-tasks`:

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

For one project only, put the folder in `.github/skills/background-tasks` inside it instead.

### Other agents

Get the folder:

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

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

## FAQ

### What does Background tasks need from the project?

It expects expo-background-task and expo-task-manager installed with npx expo install, and the expo-background-task config plugin listed in the app config. Templates are written in TypeScript and tested with Jest.

### Does the skill change how often jobs run?

It sets one explicit interval of at least 15 minutes and reconciles registrations after startup. The guide notes that intervals are minimums and iOS often runs tasks in windows, so exact timing is not guaranteed.

### Can background jobs run database migrations?

No. A background run opens the database only at the current schema version and defers the job when the schema is behind, leaving migrations to the foreground start.

### Which checks does the bundled script perform?

The script is a zero-dependency checker run with node that scans the project for the skill's rules, such as task definition placement, job names, budgets and SDK import confinement, and prints PASS or FAIL lines.

### How do I install Background tasks in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/background-tasks to use it in all your projects, or to .claude/skills/background-tasks 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 Background tasks 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 Background tasks?

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 Background tasks?

The closest alternatives to Background tasks are Expo prebuild and config plugins, App startup and bootstrap, Expo overview, Architecture and boundaries and Debug menu and test hooks.

## Where this comes from

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

## Alternatives

- [Expo prebuild and config plugins](https://ai-powered.com/skills/expo-prebuild-and-config-plugins): Expo prebuild and config plugins is an open-source agent skill for developer tools.
- [App startup and bootstrap](https://ai-powered.com/skills/app-startup-and-bootstrap): App startup and bootstrap is an open-source agent skill for developer tools.
- [Expo overview](https://ai-powered.com/skills/expo-overview-scaledockhq): Expo overview is an open-source agent skill for developer tools.
- [Architecture and boundaries](https://ai-powered.com/skills/architecture-and-boundaries): Architecture and boundaries is an open-source agent skill for developer tools.
- [Debug menu and test hooks](https://ai-powered.com/skills/debug-menu-and-test-hooks): Debug menu and test hooks is an open-source agent skill for developer tools.
- [Dates streaks and statistics](https://ai-powered.com/skills/dates-streaks-and-statistics): Dates streaks and statistics is an open-source agent skill for developer tools.
- [React native brownfield migration](https://ai-powered.com/skills/react-native-brownfield-migration): React native brownfield migration is an open-source agent skill for developer tools.
- [Expo SDK upgrade](https://ai-powered.com/skills/expo-sdk-upgrade): Expo SDK upgrade is an open-source agent skill for developer tools.

---
Source: https://ai-powered.com/skills/background-tasks
