agentleFS
arndvsarndvs/ctrlshft/skills/mobile-dev/SKILL.md

mobile-dev

Skill0 starsChanged 6 months agoMITView on GitHub

Expo mobile development workflow — clean state reset, startup sequence, native rebuild decisions, and Android emulator/QEMU troubleshooting for Launch Core and its forks (Foreword, Scorpion, Aligned, Cast).

  • Reads credentials
  • Deletes or force-pushes
  • Installs packages

We split this skill into the rules it gives an agent

9 rules. About 0 are common, 7 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈7

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    If running interactively (human present), output "Read Mobile Dev skill." to acknowledge.

    line 9
  2. Distinctive:

    Use this skill when:

    line 11
  3. Distinctive:

    Before touching the app, load the Expo Mobile instructions:

    line 22
  4. Distinctive:

    Always start from a known-clean state to avoid residual Metro/emulator confusion.

    line 34
  5. Very specific:

    If VS Code shows a wall of Cannot find module ...

    line 70
  6. Distinctive:

    If the CLI passes, treat the editor errors as stale TypeScript server state: reload VS Code, use the workspace TypeScript SDK, and restart …

    line 77
  7. Distinctive:

    Only needed for auth, payments, uploads, AI, or push feature work:

    line 150
  8. Distinctive:

    When the app won't load or shows a redbox, run this checklist:

    line 165
  9. Distinctive:

    When ending a mobile dev session, capture state in a note so the next session starts clean:

    line 204

≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Mobile Dev Skill

If running interactively (human present), output "Read Mobile Dev skill." to acknowledge. If running with --dangerously-skip-permissions (AFK/unattended), skip acknowledgement and proceed directly.

Use this skill when:

  • Starting a new mobile dev session
  • Debugging a Metro or emulator issue
  • Deciding whether a native rebuild is needed
  • Setting up a fresh fork of Launch Core
  • Troubleshooting "Using Expo Go" or redbox errors

Phase 0 — Read Context First

Before touching the app, load the Expo Mobile instructions:

~/dotfiles/instructions/expo-mobile.instructions.md

This file contains the stack reference, native module list, correct startup sequence, and all troubleshooting commands. Do not skip it.


Phase 1 — Clean State Reset

Always start from a known-clean state to avoid residual Metro/emulator confusion.

# 1. Force-stop the app on emulator (swallows errors if not running)
adb shell am force-stop com.launchhq.mobile 2>/dev/null || true

# 2. Remove ADB reverse mappings
adb reverse --remove-all 2>/dev/null || true

# 3. Check current state
adb devices -l
lsof -nP -iTCP:8081 -sTCP:LISTEN 2>/dev/null || ss -ltn 2>/dev/null | grep ':8081' || true
git status --short --branch

Expected clean state:

  • adb devices shows emulator-5554 device (or no devices if emulator not running)
  • Nothing listening on 8081
  • Branch is what you expect

Phase 2 — Dependency Health Check

# Check for corrupted node_modules (common after better-auth/expo installs)
ls node_modules/@better-auth/ 2>/dev/null | grep tmp || echo "no tmp files"

# If corrupted, clean install
rm -rf node_modules apps/*/node_modules packages/*/node_modules
pnpm install

# Verify mobile deps are aligned with Expo SDK
pnpm --filter mobile exec expo doctor

If VS Code shows a wall of Cannot find module ... or cascading implicit-any diagnostics after dependency repair, verify the CLI first:

pnpm typecheck

If the CLI passes, treat the editor errors as stale TypeScript server state: reload VS Code, use the workspace TypeScript SDK, and restart the TypeScript server before changing application code.


Phase 3 — Decide: Rebuild Native or Just Start Metro?

Answer these questions in order:

QuestionYes →No →
Did you add/remove a native module?RebuildNext
Did you change plugins in app.config.ts?RebuildNext
Did you change bundle ID, package name, or newArchEnabled?RebuildNext
Did you change googleServicesFile or entitlements?RebuildNext
Did you only change TS/JS/CSS?Just Metro—

Rebuild command:

pnpm mobile:android   # Android
pnpm mobile:ios       # iOS

Metro-only command:

pnpm mobile:start     # Must show "Using development build"

Phase 4 — Start the Emulator (if not running)

# Boot the verified AVD
emulator -avd Medium_Phone_API_36.0

# Wait for boot, then verify
adb devices -l
# Must show: emulator-5554  device  (not offline)

# If offline: restart ADB
adb kill-server && adb start-server && adb devices -l

# Set up port reverse so emulator can reach host API/Metro
adb reverse tcp:3001 tcp:3001
adb reverse tcp:8081 tcp:8081

Phase 5 — Start Metro

pnpm mobile:start

Watch for:

  • ✅ Using development build — correct
  • ❌ Using Expo Go — wrong runtime, stop and restart with --dev-client

Open the dev client:

  • Press a in the Metro terminal for Android
  • Or launch via ADB intent if Expo CLI doesn't open it:
adb shell am start -W -a android.intent.action.VIEW \
  -d "launch://expo-development-client/?url=http%3A%2F%2F10.0.2.2%3A8081"

Phase 6 — Start Backend (API-dependent work only)

Only needed for auth, payments, uploads, AI, or push feature work:

pnpm docker:up     # Postgres + Redis
pnpm db:migrate    # Run pending Drizzle migrations
pnpm api:dev       # Koa API on :3001

# Health check
curl http://localhost:3001/health

Diagnostic Checklist

When the app won't load or shows a redbox, run this checklist:

# 1. Is Metro running?
lsof -nP -iTCP:8081 -sTCP:LISTEN 2>/dev/null || ss -ltn 2>/dev/null | grep ':8081'

# 2. Is the emulator connected?
adb devices -l

# 3. Can the emulator reach the host?
adb shell curl http://10.0.2.2:8081/status 2>/dev/null || echo "unreachable"

# 4. Is the dev client build current?
adb shell pm list packages | grep launchhq

# 5. Is the correct runtime in use?
# Check Metro terminal output for "Using development build"

# 6. Are env vars set?
cat apps/mobile/.env | grep EXPO_PUBLIC_API_URL

Quick Reference: Port Map

PortServiceWho uses it
8081Metro bundlerDev client on emulator
3001Koa APIApp and Metro
5434Postgres (Docker)API
6379Redis (Docker)API

Android emulator maps host localhost to 10.0.2.2. Always use 10.0.2.2 (not localhost) in EXPO_PUBLIC_API_URL for emulator testing.


Session Handoff Note

When ending a mobile dev session, capture state in a note so the next session starts clean:

  • Current branch and any uncommitted changes
  • Whether native rebuild was done
  • Whether emulator has a current dev client build
  • Last known working state of Metro + API

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

Reviews can't be read right now.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.