About adb
An Android Debug Bridge skill for inspecting connected devices, apps, logs, and system health. It distinguishes read-only commands from state-changing operations that require user confirmation, with workflows for common debugging tasks.
Key features
- 01Checks device connectivity first
- 02Inspects device and system details
- 03Reads logs and captures screenshots
- 04Provides app and crash investigation workflows
- 05Requires confirmation for state changes
- 06Documents an IMSI retrieval procedure
Use cases
- 01Investigate an Android app crash
- 02Inspect package and process details
- 03Check device health and storage
- 04Capture and retrieve a screenshot
Install
Copy the command and run it in a terminal.
npx skills add https:/ / github.com/ benwaffle/ skills --skill adbAfter installing, type/adbin Claude Code to confirm it loaded.
Details
From the project READMEADB — Android Debug Bridge Skill
You are an expert Android developer and debugger with deep knowledge of ADB commands.
Safe Commands (Auto-Approved)
The following read-only commands run without user confirmation:
| Category | Commands |
|---|---|
| Device info | adb devices, adb get-state, adb get-serialno, adb version |
| System properties | adb shell getprop |
| Package listing | adb shell pm list packages, adb shell pm list features |
| Process info | adb shell ps, adb shell top -n 1 |
| System services | adb shell dumpsys, adb shell service list |
| Settings (read) | adb shell settings get |
| Filesystem (read) | adb shell ls, adb shell cat, adb shell df, adb shell stat, adb shell find |
| Display info | adb shell wm size, adb shell wm density |
| Logs | adb logcat -d, adb bugreport |
| Screenshots | adb shell screencap |
| Pull files | adb pull |
| Network | adb shell netstat, adb shell ifconfig, adb shell ip |
| Content queries | adb shell content query |
Dangerous Commands (Require User Confirmation)
These commands modify device state and will prompt the user before running:
adb install/adb uninstall— Install or remove appsadb push— Write files to deviceadb reboot— Reboot deviceadb root/adb remount— Elevate privileges or remount partitionsadb shell rm— Delete files on deviceadb shell am force-stop/adb shell am kill— Stop running appsadb shell pm clear— Clear app dataadb shell settings put— Modify system settingsadb shell input— Inject taps, swipes, or key eventsadb shell cmd— Arbitrary command executionadb shell setprop— Modify system propertiesadb shell svc— Control system services (wifi, data, power)adb shell service call— Arbitrary binder transaction. Onlyiphonesubinfo 10(read the IMSI, below) is pre-approved. Never sweep transaction numbers to find a method: numbering shifts between Android releases, and on some interfaces a neighbouring transaction is a setter —iphonesubinfo 7 i32 0 s16 <imei>writes an IMEI on modified ROMs. Look the transaction up in AOSP for the target release instead.
Guidelines
- Always start by checking device connectivity with
adb devicesbefore running other commands. - For logcat, prefer
adb logcat -d(dump and exit) over streamingadb logcatto avoid hanging. Use filters likeadb logcat -d -s TAGoradb logcat -d *:Eto narrow output. - For top, use
adb shell top -n 1(single snapshot) instead of continuous mode. - When targeting a specific device, use
adb -s <serial>if multiple devices are connected. - Before destructive actions, explain what will happen and why, then wait for user confirmation.
Common Workflows
Debug a crash
adb devices— confirm device connectedadb logcat -d *:E— check recent errorsadb logcat -d -s AndroidRuntime— find crash stack tracesadb shell dumpsys activity activities— check activity state
Inspect an app
adb shell pm list packages | grep <name>— find package nameadb shell dumpsys package <pkg>— full package infoadb shell dumpsys meminfo <pkg>— memory usageadb shell ps -A | grep <pkg>— check if running
Check device health
adb shell getprop ro.build.display.id— build infoadb shell df— disk usageadb shell dumpsys battery— battery statusadb shell dumpsys cpuinfo— CPU usageadb shell top -n 1— process snapshot
Capture a screenshot
adb shell screencap /sdcard/screenshot.pngadb pull /sdcard/screenshot.png ./screenshot.png
Read the SIM's IMSI (no root)
SUBID=$(adb shell dumpsys isub | sed -nE 's/.*Logical SIM slot +[0-9]+: *subId=([0-9]+).*/\1/p' | head -1)
adb shell service call iphonesubinfo 10 i32 "$SUBID" s16 com.android.shell s16 com.android.shell \
| sed -nE "s/.*'(.*)'.*/\1/p" | tr -d " .'"
Transaction 10 is getSubscriberIdForSubscriber(int subId, String pkg, String featureId). Verified on a Pixel 9a / Android 16 user build. Three details matter, and every public cheatsheet gets at least one wrong:
- the
intis a subId, not a slot index — read it fromdumpsys isubas above (it also handles multi-SIM: oneLogical SIM slot N: subId=Mline each) - the two
s16package arguments are required. Passing the caller's own package (com.android.shell) satisfies the permission check; without them, transactions8/9(getSubscriberId) returnfffffffc=SecurityException, since they needREAD_PRIVILEGED_PHONE_STATE - transaction numbers shift between releases. The
iphonesubinfo 7andiphonesubinfo 1recipes that circulate (and which assumesu) return an unrelated short string on Android 16
The reply is a Parcel whose ASCII gutter already spells out the digits — UTF-16LE, so each digit is followed by ., and the tr above strips the padding. The second word is the string length, e.g. 0000000f = 15 digits for a full IMSI:
Result: Parcel(
0x00000000: 00000000 0000000f 00300030 00300031 '........0.0.1.0.'
0x00000010: 00300031 00300030 00300030 00300030 '1.0.0.0.0.0.0.0.'
0x00000020: 00300030 00000031 '0.0.1... ')
(IMSI 001010000000001 — a synthetic value in the 001/01 test PLMN.)
What does not work, so you don't retry it: adb shell dumpsys isub prints the IMSI but masks it via pii() (9-digit prefix + [****]) on user builds — useful for ICCID, eUICC card and profile name, not the full IMSI. content://telephony/siminfo refuses non-phone UIDs (SecurityException: Access SIMINFO table from not phone/system UID). adb shell dumpsys iphonesubinfo worked only up to Android 4.4. su is unavailable on production builds.
For a visual cross-check, the radio test menu shows the IMSI on screen: adb shell am start -n com.android.phone/.settings.RadioInfo (this launches an activity, so confirm first).