mobile-toolchain-unifier
Skill68 starsChanged 7 months agoMITView on GitHub
Audits, unifies, and optimizes mobile development environments and toolchains across a drive (Android, Flutter, iOS). Consolidates fragmented NDKs, SDK platforms, Gradle distributions, Flutter SDKs (FVM), and Java/JVM daemon versions to the latest stable releases, verifies project builds, reclaims tens of gigabytes of disk space, aggressively trims emulator bloatware using avdslim while preserving Play Store, and creates instant-boot Golden Snapshots. Use whenever the user asks to clean, unify, upgrade, or optimize Android SDKs, NDKs, Gradle wrappers, Java/JVM daemons, iOS simulator runtimes, or mobile emulator environments.
- Deletes or force-pushes
In this repository2 other files it gives its agents.
The file
We split this skill into the rules it gives an agent
8 rules. About 0 are common, 4 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 20
Verify Builds: Test compilation across all projects to ensure zero breaking changes.
- Distinctive: line 21
Purge Obsolete Assets: Remove older toolchain copies, Gradle caches, and legacy simulator runtimes, saving 20–80+ GB of disk space.
- Very specific: line 74
Ensure projects without explicit ndkVersion declare it to prevent Android Gradle Plugin from auto-downloading legacy fallbacks.
- Very specific: line 106
Update all .fvmrc files to point to the latest installed Flutter release (e.g.
- Very specific: line 107
Update pubspec.yaml environment constraints:
- Very specific: line 113
Update local.properties in Flutter Android modules:
- Distinctive: line 122
Never delete or finalize before verifying that all projects build cleanly:
- Distinctive: line 168
Create a lightning-fast, ultra-low-RAM single emulator instance:
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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.
Files
Mobile Toolchain Unifier
A comprehensive skill for auditing, unifying, and reclaiming disk space across multi-project mobile development workspaces (Flutter, Android native, and iOS).
Overview
Over time, active mobile development machines accumulate duplicate SDKs, conflicting Gradle versions, multiple Java daemons, redundant NDKs, bloated system images, and gigabytes of orphaned simulator runtimes.
This skill provides an automated, non-destructive workflow to:
- Audit & Discover: Find all mobile projects across the drive and inventory their toolchain versions.
- Unify & Pin: Align all projects onto the latest stable common denominators (Gradle wrapper, AGP, Java LTS, NDK, SDK platforms, Flutter FVM).
- Verify Builds: Test compilation across all projects to ensure zero breaking changes.
- Purge Obsolete Assets: Remove older toolchain copies, Gradle caches, and legacy simulator runtimes, saving 20–80+ GB of disk space.
- Optimize Emulators: Build ultra-lightweight Android emulators with
avdslim, uninstall bloatware while keeping Google Play Services & Play Store, and bake<1.5sGolden Snapshots.
Reference Guides
| Domain | Reference file |
| AGP, Gradle, Java, NDK & compileSdk Matrix | references/android_toolchain_matrix.md |
Bloatware Removal, Play Store & avdslim Guide | references/emulator_slimming_guide.md |
Apple Simulator Slimming & simslim Guide | references/simslim_optimization_guide.md |
6-Phase Workflow
Phase 1: Audit & Discovery
Scan the drive for all active mobile projects and toolchains.
1. Discover Projects
# Locate Gradle and Flutter configurations across Developer directories
find ~/Developer -maxdepth 5 \( -name "build.gradle" -o -name "build.gradle.kts" -o -name ".fvmrc" \) -not -path "*/build/*" -not -path "*/.gradle/*"2. Inventory Installed Toolchains
# Android SDK components
sdkmanager --list_installed
# Flutter FVM versions
ls -lh ~/fvm/versions/
# Java runtimes and daemon JVMs
java -version
/usr/libexec/java_home -V
cat ~/.gradle/gradle.properties
# iOS CoreSimulator runtimes and disk images
xcrun simctl runtime listPhase 2: Toolchain Unification
Consolidate all discovered projects onto unified versions:
1. Android NDK
- Inspect pinned
ndkVersionin everybuild.gradle.kts/build.gradle. - Pin to the latest installed stable release (e.g.
30.0.16248370/ NDK r30). - Ensure projects without explicit
ndkVersiondeclare it to prevent Android Gradle Plugin from auto-downloading legacy fallbacks.
2. Gradle Wrapper & Android Gradle Plugin (AGP)
- Upgrade
gradle/wrapper/gradle-wrapper.propertiesin all projects to the latest stable release (e.g.gradle-9.8.2-bin.zip). - Align AGP in
settings.gradle.kts/ rootbuild.gradle(e.g. AGP9.4.x/9.5.x) to ensure compatibility with Gradle 9.6+. - Align Kotlin Gradle Plugin (
org.jetbrains.kotlin.android) to2.4.xto match AGP 9.
3. Java / JVM Daemon Alignment
Prevent Gradle from spawning multiple incompatible daemon JVMs:
- In
~/.zshrc, pointJAVA_HOMEandPATHto the latest LTS JDK (e.g. Java 21 LTS):export JAVA_HOME="$HOME/.gradle/jdks/eclipse_adoptium-21-aarch64-os_x.2/jdk-21.0.7+6/Contents/Home" export PATH="$JAVA_HOME/bin:$PATH" - In
~/.gradle/gradle.properties, set matching daemon JVM:org.gradle.java.home=/path/to/jdk-21/Contents/Home - In each project's
build.gradle.kts, standardize compatibility:compileOptions { sourceCompatibility = JavaVersion.VERSION_21 targetCompatibility = JavaVersion.VERSION_21 } tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach { compilerOptions { jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_21) } }
4. Flutter SDK (FVM)
- Update all
.fvmrcfiles to point to the latest installed Flutter release (e.g.3.47.8). - Update
pubspec.yamlenvironment constraints:environment: sdk: 3.13.7 flutter: 3.47.8 - Update
local.propertiesin Flutter Android modules:flutter.sdk=/Users/<user>/fvm/versions/3.47.8
Phase 3: Build Verification
Never delete or finalize before verifying that all projects build cleanly:
# 1. Flutter dependencies
cd <project> && fvm flutter pub get
# 2. Native Android compilation
cd <project>/android && ./gradlew assembleDebug
# 3. Verify Daemon JVM reuse
./gradlew --statusLook for: Launcher JVM: 21.x and Daemon JVM: 21.x matching across every run.
Phase 4: Disk Reclamation & Pruning
Once builds are verified, safely eliminate redundant older assets:
# 1. Remove older NDK directories
rm -rf ~/Library/Android/sdk/ndk/<older-version>
# 2. Remove older SDK platforms and system images
rm -rf ~/Library/Android/sdk/platforms/android-{34,35,36}
rm -rf ~/Library/Android/sdk/system-images/android-{34,35,36}
# 3. Clean older Gradle wrapper distributions (frees 1-3 GB)
rm -rf ~/.gradle/wrapper/dists/gradle-{8.*,9.0.*,9.3.*,9.6.*}
# 4. Clean obsolete Gradle version caches (frees 10-25+ GB)
rm -rf ~/.gradle/caches/{9.0.0,9.3.1,9.6.0}
# 5. Remove older Flutter FVM SDKs (frees ~2.2 GB per version)
rm -rf ~/fvm/versions/<older-version>
# 6. Clean unneeded simulator runtimes (frees 20-60+ GB)
xcrun simctl runtime delete <runtime-uuid>
xcrun simctl delete unavailablePhase 5: Android Emulator Optimization (avdslim)
Create a lightning-fast, ultra-low-RAM single emulator instance:
- Delete All Existing AVDs:
avdmanager delete avd -n <old_avd> - Select Google APIs Image (4 KB page size):
- Prefer
system-images;android-<latest>;google_apis;arm64-v8a. - Avoid Google Play production images (blocks
adb rootand runs heavy background security scanners). - Avoid 16 KB page size images (forces QEMU to allocate $\ge$ 4096 MB RAM).
- Prefer
- Create Pre-Tuned AVD:
avdslim create Slim_Pixel --api=<latest> --ram=1536 - Uninstall Bloatware While Preserving Play Store:
- Boot the emulator headlessly with low-memory host flags:
emulator -avd Slim_Pixel -memory 1536 -gpu host -no-audio -camera-back none -camera-front none -no-boot-anim -lowram -no-window - Elevate ADB daemon to root:
adb root - Enable Google Play Store (
com.android.vending):adb shell pm enable com.android.vending - Completely uninstall all bloatware for user 0 (see list in
references/emulator_slimming_guide.md):adb shell "for pkg in \$(pm list packages -d | sed 's/package://'); do if [ \"\$pkg\" != 'com.android.vending' ]; then pm uninstall --user 0 \"\$pkg\"; fi; done"
- Boot the emulator headlessly with low-memory host flags:
- Capture Golden Snapshot & Install Shim:
# Snapshot live state (<1.5s restore) avdslim snap # Gracefully shut down avdslim stop # Install Android Studio wrapper shim avdslim install-shim
Phase 6: iOS & Apple Simulator Optimization (simslim)
Prune runtimes and slim remaining simulators to reduce disk and idle RAM consumption:
- Prune Outdated Runtimes:
# List installed runtime disk images xcrun simctl runtime list # Delete outdated runtimes (frees 10-60+ GB) xcrun simctl runtime delete <UUID> - Consolidate Device Fleet:
- Prune devices down to 2 primary target devices (e.g. 1 modern iPhone and 1 iPad Pro) and delete all other device UUIDs:
xcrun simctl delete <UUID> xcrun simctl delete unavailable - Slim Simulators with
simslim:- Configure persistent launchd disable overrides for 168 non-essential background daemons:
simslim on <UDID> --preserve-boot-state - Reclaim Disk Space (
disk-clean):- Purge accumulated caches, diagnostic logs, and temporary files:
Drops individual simulator storage down to ~56 MB.simslim disk-clean <UDID> --categories caches,logs,temporary,linguistic-data --confirm - Verify and Monitor:
# Measure allocated disk size simslim size <UDID> # Live fleet memory and CPU monitor simslim top
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
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.

