Skip to content
Back to skills

Sim

ASecurity

appforge reference for launching, driving and capturing an Expo app on the iOS simulator from an agent that cannot tap the screen (harness, command file, Metro ports, screenshots, videos, Live Activity, Expo Go).

  • 2 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 30, 2026
developmentpythongoshellbashreactnodegit

Works with

  • terminal
  • cli

Security analysis

A92/100
  • mediumInstalls packages at runtime which could introduce malicious dependencies

Pro shows the line behind each finding and how to fix it

Scanned December 6, 2026

npx -y skills add mrasoahaingo/appforge --skill sim --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Sim?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Sim
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/mrasoahaingo-sim/badge)](https://www.skillsdirectory.com/skills/mrasoahaingo-sim)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: sim
description: appforge reference for launching, driving and capturing an Expo app on the iOS simulator from an agent that cannot tap the screen (harness, command file, Metro ports, screenshots, videos, Live Activity, Expo Go).
disable-model-invocation: true
---

# Simulator: see every screen without tapping

An agent cannot tap on the simulator: `axe tap` and `describe-ui` time out, and `simctl openurl` shows an "Open in …?" dialog that cannot be confirmed. Everything therefore goes through a **dev harness**.

## The harness

Every app generated by `new-app.mjs` already has it: `apps/mobile/src/dev/harness.tsx`, with its fixtures in `src/dev/fixtures.ts` (source: `${CLAUDE_PLUGIN_ROOT}/templates/overlay`). It is absent from the production bundle.

- A component, mounted only in development, rereads a locally served JSON twice per second. On each new `seq`, it calls `router.navigate(href)`.
- URL parameters:
  - load a fixture: `?data=empty|one|run9|idle|worst|real`;
  - trigger an action: `?do=start|end|close|badge:<code>`;
  - show a state: `?y=700` (scroll), `?plus=on|off|reset`, `?onb=1`;
  - fill a form as if typed: `sign-in?channel=sms&phone=…&code=424242`.
- Fixtures never replace the real storage.

```bash
mkdir -p /tmp/<slug>-remote && cd /tmp/<slug>-remote && echo '{"seq":0}' > cmd.json
python3 -m http.server 8799 --bind 127.0.0.1        # background task (see below)
EXPO_PUBLIC_DEV_REMOTE=http://localhost:8799/cmd.json pnpm exec expo start --port 8084
echo '{"seq":1,"href":"/?data=run9"}' > cmd.json   # seq changes with every command
xcrun simctl io <udid> screenshot screen.png
```

To send the app to the background: `xcrun simctl launch <udid> com.apple.Preferences`. Locking the screen is not possible.

## Build and launch

- `export LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8` before any `pod install` or `expo run:ios`, otherwise "Unicode Normalization not appropriate for ASCII-8BIT".
- `pnpm exec expo …`: a shell hook may rewrite `npx expo run:ios` and make it fail.
- **Port 8081 is often taken by another project.** Build with the port baked in: `pnpm exec expo run:ios --device <udid> --port 8084`. `RCT_jsLocation` no longer works with RN 0.88. To check: `lsof -a -p <pid> -iTCP`.
- No `CI=1` for a Metro you keep, otherwise it stops watching files.
- If an "Open in …?" dialog stays on screen after `run:ios`: `simctl shutdown`, then `boot`, then launch the app with `simctl launch`.
- A dedicated `<slug>-check` simulator; never touch other projects' simulators (listed in the profile notes).
- **Check both ports before building**: Metro's and the command server's (`lsof -iTCP:<port> -sTCP:LISTEN`, then `lsof -p <pid> | grep cwd` to see whose it is). Grassling, 2026-12-05: 8091 (its baked port) and 8799 were held by other projects; the dev client then loaded **another app's bundle** from the busy port. Build on a free port (`--port 8093`); the command server's port only lives in `EXPO_PUBLIC_DEV_REMOTE`, read by Metro, so changing it needs a Metro restart, not a rebuild.
- **Never answer an Expo prompt unread.** `expo run:ios` may ask "Continue?" (bundle id already registered: yes is fine) and then "Install the updated dependencies?" (no: it rewrites `package.json`). Read the prompt in the terminal first, answer that one only.
- **Run Expo from `apps/mobile`, never from the repo root.** Started at the root, `expo run:ios` creates `ios/` and `app.json` there and adds expo/react/react-native to the root `package.json`. An Orca terminal starts in the worktree root whatever the shell's cwd: put `cd <repo>/apps/mobile &&` inside `--command`. If it happens: interrupt, `git checkout -- package.json`, remove the root `ios/` and `app.json`, `pnpm install --frozen-lockfile --offline`.
- After `expo run:ios` fails to open the app ("Open in …?"), Metro stops with it: start `expo start --port <n> --dev-client` again, then `simctl shutdown`/`boot`/`launch`, and check the app's connection with `lsof -a -p $(pgrep -n <App>) -iTCP`.
- **Harness actions that need Screen Time** (or any capability the simulator refuses: "not authorised for Family Controls") call the store directly, as `do=break` does; the real service would take the change back on the native failure. Keep the service path for the device.
- Language: `EXPO_PUBLIC_LOCALE=fr` when starting Metro.

## Background tasks

Metro, the command server and Supabase are long-running processes.

- **In herdr**:

  ```bash
  hc run --bg --outlive-parent --no-notify --name <slug>-metro --cwd apps/mobile -- …
  hc wait <slug>-metro --output "Waiting on"
  ```

- **In Orca**: `orca terminal create --title <slug>-metro --command "cd <repo>/apps/mobile && …"` (the terminal starts in the worktree root), read with `orca terminal read`, stop with `orca terminal close` when done.
- **Outside herdr**: `run_in_background` with a long `timeout`. In Fastkind, Metro was killed several times at the 30 to 60 minute limit: tell the user when it happens and restart on the same port.

## Checking motion

- Video: `xcrun simctl io <udid> recordVideo x.mov`, stop with `pkill -INT -f recordVideo`, then a contact sheet of the frames that change:

  ```bash
  ffmpeg -i x.mov -vf "select='gt(scene,0.0015)',scale=300:-1,tile=6x3" -frames:v 1 sheet.png
  ```

- Dynamic Island: screenshots do not always show it. Check with:

  ```bash
  xcrun simctl spawn <udid> log show --last 1m --predicate 'subsystem == "com.apple.activitykit"'
  ```

- Measuring an area with sharp: go through `raw().toBuffer()`, because `extract().stats()` measures the whole image.
- After a Fast Refresh, a view with an `entering` animation can keep a zero-width frame: relaunch the app before concluding there is a layout bug.

## On the user's phone

- Expo Go: `pnpm exec expo start --go --port <n>`, then give the address `exp://<local ip>:<n>`, to enter in Expo Go on the same Wi-Fi.
- Not available in Expo Go: widget, Live Activity, native RevenueCat, embedded font. For the font, load it at runtime in Expo Go only (`src/dev/expo-go-fonts.ts`).
- Link to an empty fixture: `exp://<ip>:<n>/--/?data=empty`.

## Store captures and fixed times

- `?data=<fixture>&at=HH:MM` shows a data set at that time of today (the app clock is shifted, `setClockOffset`).
- Every store capture at once: `node ${CLAUDE_PLUGIN_ROOT}/scripts/store-capture.mjs --app apps/mobile` (`store` step 3).
- Taps on the simulator: AXe 1.8 fails with "HID broker socket path is too long" (its socket sits in the macOS per-user temp folder and the path passes 104 characters); use the command file instead, or AXe 2.x once installed.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.