skill/SKILL.md
Manage git worktrees for parallel React Native / Expo development. Covers creating worktrees (excluding native dirs), registering them with react-native-worktree, switching the device between Metro servers, and coordinating runtime access via per-platform mutex locks.
npx skillsauth add aleqsio/react-native-worktree react-native-worktreeInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
You are an AI agent working on a React Native / Expo project alongside other agents. Each agent works in its own git worktree with its own Metro server. Only one agent can use the device/simulator at a time per platform. react-native-worktree handles port switching and runtime coordination.
Git worktrees share the .git object store, so they're cheap — but you should still exclude heavy generated directories that each worktree can regenerate on its own.
If ios/ and android/ are in .gitignore (standard for CNG projects), worktrees are already lightweight — those dirs won't be copied. Just create normally:
git worktree add ../my-feature -b my-feature
If ios/ and android/ are tracked in git, use sparse checkout to skip them:
# Create worktree without checking out files
git worktree add --no-checkout ../my-feature -b my-feature
# Configure sparse checkout to exclude native dirs
cd ../my-feature
git sparse-checkout set --no-cone '/*' '!ios/' '!android/'
git checkout
This saves significant disk space and creation time. The agent can run npx expo prebuild later if it specifically needs native files.
node_modules/ is gitignored and never copied by worktrees. Each worktree needs its own install:
cd ../my-feature
npm install # or: yarn / bun install
On first run, add auto-detects the bundle ID and platforms from app.json / app.config.js and creates the config automatically. No separate init step needed.
react-native-worktree add my-feature --path /path/to/my-feature
# Output: Added 'my-feature' on port 8083 (app: com.myapp)
# Output: Start Metro: cd /path/to/my-feature && npx expo start --port 8083
The port is auto-assigned. If a previously registered worktree's Metro is dead, its port is reclaimed and the stale worktree entry is removed from config.
IMPORTANT: Start Metro immediately after add, before registering any other worktrees. Port reclamation detects dead Metro servers — if you register multiple worktrees without starting Metro, they may all get the same port. Always do add then start sequentially for each worktree:
react-native-worktree add my-feature --path /path/to/my-feature
cd /path/to/my-feature
npx expo start --port 8083 # start BEFORE adding the next worktree
If Metro reports "port busy", re-run add with the same worktree name — it will reassign a new available port:
react-native-worktree add my-feature --path /path/to/my-feature
# got port 8082, but Metro says it's busy:
# Error: port 8082 already in use
react-native-worktree add my-feature --path /path/to/my-feature # re-add → gets port 8083
npx expo start --port 8083
If you have multiple apps configured, specify which one:
react-native-worktree add my-feature --app com.myapp --path /path/to/my-feature
If only one app is configured, --app is auto-detected.
react-native-worktree switch my-feature # uses first configured platform
react-native-worktree switch my-feature --platform ios # explicit platform
react-native-worktree switch my-feature --platform android # independent Android lock
This does three things atomically:
iOS and Android locks are independent — one agent can hold the iOS lock while another holds Android. If another agent holds the lock for your platform, the command blocks and prints Waiting for 'other-agent' to release... until the lock is freed or goes stale.
The --timeout flag controls the inactivity threshold — how long a lock can sit without a heartbeat before another agent can reclaim it. It does NOT limit how long the waiting agent will poll.
While you are actively using the device, periodically call switch again:
react-native-worktree switch my-feature --platform ios # refreshes timestamp, no app restart
This updates the lock timestamp so other agents know you're still active. If you stop calling, the lock goes stale after 60s and another agent can take over.
When done testing:
react-native-worktree release --platform ios
react-native-worktree release --platform android
Always release when you're finished so other agents don't have to wait for the stale timeout. Each platform is released independently.
react-native-worktree status # all platform locks
react-native-worktree status --platform ios # just iOS
react-native-worktree list # all apps and worktrees
react-native-worktree list --app com.myapp # filter by app
# 1. Create worktree, register, and start Metro (do these sequentially — don't add another worktree until Metro is running)
git worktree add ../feat-auth -b feat-auth
cd ../feat-auth
npm install
react-native-worktree add feat-auth --path $(pwd)
# note the assigned port from output
npx expo start --port <assigned-port> # start Metro IMMEDIATELY after add
# 2. When you need the device to preview your work
react-native-worktree switch feat-auth --platform ios
# device restarts connected to your Metro
# 4. Keep the lock alive while user is testing
react-native-worktree switch feat-auth --platform ios # heartbeat every ~20s
# 5. Release when done
react-native-worktree release --platform ios
# 6. Clean up when branch is merged
cd /path/to/main
git worktree remove ../feat-auth
You MUST call react-native-worktree switch <name> --platform <platform> and hold the lock BEFORE any operation that touches the simulator or emulator. This includes:
xcrun simctl commandsadb commands against the deviceIf you do not hold the lock, another agent may switch the device out from under you at any moment, causing your operation to hit the wrong app state or fail entirely. Always acquire first, then interact with the device.
RCT_jsLocation switching or custom native modules. Only use Expo Go if the user explicitly asks for it.npx expo run:ios (builds with the correct bundle ID and installs on the simulator)npx expo run:android (builds with the correct package name and installs on the emulator)xcrun simctl, adb, screenshot, or log read requires you to hold the lock for that platform. No exceptions.react-native-worktree switch warns if Metro isn't running on your port, but it still acquires the lock.switch again periodically to avoid the inactivity timeout (default 60s).--timeout is the inactivity threshold, not a wait limit. It controls how long a lock survives without heartbeats. The waiting agent polls forever until the lock is free.--port, dead Metro ports are reclaimed. You don't need to manage port numbers manually.development
Maintainer-only workflow for handling GitHub Secret Scanning alerts on OpenClaw. Use when Codex needs to triage, redact, clean up, and resolve secret leakage found in issue comments, issue bodies, PR comments, or other GitHub content.
development
Maintainer workflow for OpenClaw releases, prereleases, changelog release notes, and publish validation. Use when Codex needs to prepare or verify stable or beta release steps, align version naming, assemble release notes, check release auth requirements, or validate publish-time commands and artifacts.
development
Run, watch, debug, and extend OpenClaw QA testing with qa-lab and qa-channel. Use when Codex needs to execute the repo-backed QA suite, inspect live QA artifacts, debug failing scenarios, add new QA scenarios, or explain the OpenClaw QA workflow. Prefer the live OpenAI lane with regular openai/gpt-5.4 in fast mode; do not use gpt-5.4-pro or gpt-5.4-mini unless the user explicitly overrides that policy.
development
End-to-end Parallels smoke, upgrade, and rerun workflow for OpenClaw across macOS, Windows, and Linux guests. Use when Codex needs to run, rerun, debug, or interpret VM-based install, onboarding, gateway smoke tests, latest-release-to-main upgrade checks, fresh snapshot retests, or optional Discord roundtrip verification under Parallels.