aleqsio/react-native-worktree/skill
Claude Code and agent skill by aleqsio/react-native-worktree
- community
Checking that the SKILL.md file is still in the repository.
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.
Install
npx vskill@latest install aleqsio/react-native-worktree/skillSKILL.md
react-native-worktree — Multi-Agent Worktree Guide
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.
Creating a Worktree (Lightweight)
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.
Expo projects with Continuous Native Generation (CNG)
If ios/ and android/ are in .gitignore (standard for CNG projects), worktrees are already lightweight — those dirs won't be copied. Just create normally:
Projects with tracked native directories
If ios/ and android/ are tracked in git, use sparse checkout to skip them:
This saves significant disk space and creation time. The agent can run npx expo prebuild later if it specifically needs native files.
Always exclude node_modules
node_modules/ is gitignored and never copied by worktrees. Each worktree needs its own install:
Registering and Using react-native-worktree
Registering your worktree
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.
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:
If Metro reports "port busy", re-run add with the same worktree name — it will reassign a new available port:
Multi-app projects
If you have multiple apps configured, specify which one:
If only one app is configured, --app is auto-detected.
Switching the device to your worktree
This does three things atomically:
- Acquires the mutex lock for that platform (waits if another agent holds it)
- Reconfigures the device to connect to your Metro port
- Kills and relaunches the app
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.
Heartbeat — keeping the lock alive
While you are actively using the device, periodically call switch again:
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.
Releasing the device
When done testing:
Always release when you're finished so other agents don't have to wait for the stale timeout. Each platform is released independently.
Checking status
Typical Agent Workflow
CRITICAL: Lock Before Any Device Operation
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:
- Taking screenshots of the app
- Reading simulator/emulator logs
- Running
xcrun simctlcommands - Running
adbcommands against the device - Any UI testing or visual inspection
- Launching or restarting the app
If 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.
Important Rules
- Never use Expo Go. Always build and use the actual development client with the correct bundle ID. Expo Go does not support
RCT_jsLocationswitching or custom native modules. Only use Expo Go if the user explicitly asks for it. - Build and install the app if needed. If the app is not already installed on the simulator/emulator, build and install it first:
- iOS:
npx expo run:ios(builds with the correct bundle ID and installs on the simulator) - Android:
npx expo run:android(builds with the correct package name and installs on the emulator) - Only one worktree needs to build — the binary is shared across all worktrees since only the Metro port changes.
- Lock before touching the device. Every
xcrun simctl,adb, screenshot, or log read requires you to hold the lock for that platform. No exceptions. - Always release the lock when you're done with the device. Don't hog it.
- Start Metro before switching.
react-native-worktree switchwarns if Metro isn't running on your port, but it still acquires the lock. - Don't force-take the lock. If another agent holds it, wait. The mutex exists to prevent app thrashing.
- Heartbeat if holding long. If you hold the lock for more than a few seconds, call
switchagain periodically to avoid the inactivity timeout (default 60s). - One port per worktree. Don't change ports after registration. Other agents rely on the mapping.
- `--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.
- iOS and Android are independent. You can hold both platform locks simultaneously if needed, and two different agents can hold different platform locks at the same time.
- Port reuse is automatic. When adding a worktree without
--port, dead Metro ports are reclaimed. You don't need to manage port numbers manually.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskill/SKILL.md
Popularity
- Repository stars
- 39
- Repository npm downloads, 7 days
- 4
- 7-day trend score
- 29
Stars and forks are for the whole GitHub repository, not this skill alone. Downloads are for the repository's npm package. Refreshed 17 Mar 2026, 7 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/aleqsio/react-native-worktree/skill)