Skip to content

Device Control

The device control skill provides comprehensive reference for controlling simulators and emulators, capturing screenshots, reading UI state, managing permissions, and handling Expo/EAS builds.

Activates when Claude encounters tasks involving simulator/emulator interaction: taking screenshots, booting devices, installing apps, reading UI hierarchy, opening deep links, granting permissions, streaming native logs, or managing device settings.

Commands for boot/shutdown, app install/launch/terminate, deep links, screenshots, native log streaming, and permissions. Key recommendations:

  • Prefer JPEG screenshots (80ms, 200KB) over PNG (150ms, 800KB)
  • Use processImagePath ENDSWITH "/BinaryName" for precise native log filtering
  • Use xcrun simctl privacy for permission grants/revokes

Commands for device management, deep links, screenshots, UI hierarchy extraction, animation control, native logs, permissions, and locale. Key recommendations:

  • Use adb exec-out screencap -p for direct-pipe screenshots (skips device storage round-trip)
  • uiautomator dump --compressed provides full structured accessibility tree
  • Disable animations before test runs (window, transition, animator scales to 0)

Cross-platform unified device interaction that eliminates platform-specific branching:

TaskTool
List devicesdevice_list
Screenshotdevice_screenshot
UI element treedevice_snapshot (returns @refs)
Tap by textdevice_find text="Sign In" action=click
Tap by refdevice_press ref=@e3
Fill inputdevice_fill ref=@e5 text="hello"
Scroll/swipedevice_swipe direction=up
System backdevice_back

scripts/snapshot_state.sh captures screenshot + UI hierarchy simultaneously, cutting state-check time by ~40%.

OperationTimeSize
iOS screenshot (JPEG)80ms200KB
iOS screenshot (PNG)150ms800KB
Android screenshot (exec-out)300ms800KB
Android UI hierarchy (raw)300-500ms15-30KB XML
Android UI hierarchy (parsed)350-550ms2-3KB JSON

Decision table for build workflows:

SituationAction
App running + Metro connectedSkip, proceed to testing
Metro not running, app missingexpo_ensure_running.sh ios or android
Test a specific EAS buildeas_resolve_artifact.sh then expo_ensure_running.sh --artifact
SymptomFix
Simulator not bootingxcrun simctl shutdown all && xcrun simctl erase all
adb shows “unauthorized”Revoke USB debugging, reconnect, tap Allow
Screenshot hangsWait for home screen, verify boot completed
uiautomator dump failsWake screen with keyevent WAKEUP