npx skills add ...
npx skills add morphet81/cheat-sheets --skill adb
Use ADB to interact with an Android device or emulator. Takes a screenshot, understands the screen, performs actions (tap, swipe, type, navigate), and loops until the mission is complete.
npx skills add morphet81/cheat-sheets --skill adb
Use ADB commands to interact with an Android device or emulator to complete a user-defined mission. Operates in a screenshot-act-verify loop until the mission is accomplished.
Usage:
/adb <mission> — Describe what you want done on the device (e.g., "open Settings and enable Dark Mode")Prerequisites:
adb must be in PATHInstructions:
Verify ADB connectivity:
adb devices and confirm at least one device is listed (not "unauthorized")AskUserQuestion to ask which device to target, then pass -s <serial> to all subsequent adb commandsUnderstand the mission:
$ARGUMENTS as the mission description$ARGUMENTS is empty, use AskUserQuestion to ask what the user wants to accomplish on the deviceEnter the screenshot-act-verify loop:
Repeat the following cycle until the mission is complete or you determine it cannot be completed:
a) Take a screenshot:
Read tool to understand the current screen stateb) Analyze the screen:
.tmp/ui.xml to get element bounds, text, and resource IDs for precise tap coordinates.c) Decide and execute the next action:
Use one or more of these ADB commands:
| Action | Command |
|---|---|
| Tap at coordinates | adb shell input tap <x> <y> |
| Swipe | adb shell input swipe <x1> <y1> <x2> <y2> [duration_ms] |
| Type text | adb shell input text "<text>" |
| Press Back | adb shell input keyevent 4 |
| Press Home | adb shell input keyevent 3 |
| Press Enter | adb shell input keyevent 66 |
| Press Recent Apps | adb shell input keyevent 187 |
| Launch an app | adb shell am start -n <package>/<activity> |
| Open a URL | adb shell am start -a android.intent.action.VIEW -d "<url>" |
| Long press | adb shell input swipe <x> <y> <x> <y> 1000 |
Coordinate tips:
bounds attribute from the UI dump (e.g., bounds [0,200][1080,350] → tap at 540,275)adb shell input swipe 540 1500 540 500 300)d) Wait and verify:
sleep 1)Handle common situations:
keyevent 4) to dismiss the keyboard before taking a verification screenshotadb shell input swipe 540 1800 540 800) to unlock. If a PIN/password is needed, ask the userCheck logcat when things go wrong:
Mission complete:
Cleanup:
adb is not found in PATH, display setup instructions and STOPadb devices to check — if disconnected, inform the user and STOPadb shell wm size