@takahirom/android-cli-ui-automation-skill
AAutomate UI on a connected Android device or emulator via the Android CLI. Use when asked to launch an app, tap a button, enter text, navigate a URL, or drive any on-screen flow to a goal.
Install
agr install @takahirom/android-cli-ui-automation-skill --target claudeWrites 3 files into .claude/skills/, pinned to git-ce213bed.
- .claude/skills/android-cli-ui-automation-skill/LICENSE
- .claude/skills/android-cli-ui-automation-skill/README.md
- .claude/skills/android-cli-ui-automation-skill/SKILL.md
Document
name: android-cli-ui-automation-skill description: Automate UI on a connected Android device or emulator via the Android CLI. Use when asked to launch an app, tap a button, enter text, navigate a URL, or drive any on-screen flow to a goal.
Drive the device in a tight launch → observe → act → re-observe loop until the goal is reached.
Prefer android layout for structured UI. Use screenshot mode whenever it is faster or more reliable.
If multiple devices are connected, get the serial with adb devices -l. Pass --device=<serial> to android ... and -s <serial> to adb ....
1. Launch
- URL in a browser:
adb -s <serial> shell am start -a android.intent.action.VIEW -d '<url>' - Already-installed app:
adb -s <serial> shell monkey -p <pkg> -c android.intent.category.LAUNCHER 1 - APK file:
android run --apks=<path> --device=<serial> [--activity=<name>]
2. Observe with android layout
android layout --device=<serial> --pretty --output=/tmp/ui.json
Match targets by text, content-desc, or resource-id. Use the node's center as tap coordinates.
Re-observe after each action with the mode you chose. android layout --device=<serial> --diff is useful when you only need to see what changed.
3. Use screenshot mode when visual targeting is easier
Screenshot mode is often the better choice for:
- WebView or browser page content
- Icon-only custom views
- Canvas, map, or game surfaces
- Any screen where
layoutis noisy, incomplete, or slower to interpret than the image
android screen capture --output=/tmp/ui.png --annotate
android screen resolve --screenshot=/tmp/ui.png --string="input tap #N"
Labels are valid only for that screenshot. Capture again after every UI change.
4. Act with adb shell input
adb -s <serial> shell input tap <x> <y>
adb -s <serial> shell input text '<text-with-%s-for-spaces>'
adb -s <serial> shell input swipe <x1> <y1> <x2> <y2> <ms>
adb -s <serial> shell input keyevent <KEYCODE>
Example: adb -s <serial> shell input text 'hello%sworld'
Rules
- Re-observe after every action. Coordinates and screenshot labels go stale immediately.
- Clear blockers first: permission dialogs, onboarding sheets, update prompts.
- Use the observation mode that is clearer:
layoutfor structured UI, screenshot for visual UI.
Notes
- Don't type URLs into the address bar. Open them with
am start -a VIEW -d '<url>'. - If the foreground app is unclear, check it with
adb -s <serial> shell dumpsys window | rg 'mCurrentFocus|mFocusedApp'.
Trustgrade A
- passBody integrity
Whether the stored document is plausibly the kind of file the artifact declares, rather than something fetched by mistake.
- passType matchnot applicable to this artifact type
Whether the artifact is really the kind of thing its metadata claims it is.
- passFreshness
How long since the source repository was last pushed to.
- passPrompt injection
Scans the artifact's own text for instructions aimed at your agent rather than at you.
- passLicense
Whether the source repository declares an SPDX license permissive enough to redistribute.
How the grade is calculated
Each check contributes 0 points when it passes, 1 when it warns, and 2 when it fails. The total maps to a letter:
- Aevery check passed
- Bone warning
- Ctwo warnings
- Dprompt injection or body integrity failed, or three warnings
- Fone of those failed, and something else is wrong
These are automated hygiene checks, not a security audit, and not a dependency or vulnerability scan. A grade of A means nothing was flagged — not that the artifact is safe.
Versions
git-ce213bed78ee2026-07-31