@causyne/agent 1.20.23 → 1.20.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -512,6 +512,362 @@ export const COMPILED_SKILLS = {
512
512
  }
513
513
  },
514
514
  "android": {
515
+ "agp-9-upgrade": {
516
+ name: "agp-9-upgrade",
517
+ description: [
518
+ "Upgrade and configure Android Gradle Plugin 9.x and modern build toolchains",
519
+ ". Use when modernizing build scripts, fixing deprecated AGP APIs, or updati",
520
+ "ng Java/Kotlin compatibility."
521
+ ].join(''),
522
+ content: [
523
+ "---\n",
524
+ "name: agp-9-upgrade\n",
525
+ "description: Upgrade and configure Android Gradle Plugin 9.x and modern bui",
526
+ "ld toolchains. Use when modernizing build scripts, fixing deprecated AGP AP",
527
+ "Is, or updating Java/Kotlin compatibility.\n",
528
+ "---\n",
529
+ "\n",
530
+ "# Android Gradle Plugin Modernization\n",
531
+ "\n",
532
+ "Migrate Android builds to modern Android Gradle Plugin (AGP) standards, Kot",
533
+ "lin DSL, Java 17/21 toolchains, and Declarative Gradle configurations.\n",
534
+ "\n",
535
+ "## Workflow\n",
536
+ "\n",
537
+ "1. Update AGP and Gradle wrapper versions.\n",
538
+ " - Run `./gradlew wrapper --gradle-version=<target> --distribution-type=b",
539
+ "in` to align Gradle with the required AGP compatibility matrix.\n",
540
+ " - Update `com.android.application` and `com.android.library` plugin vers",
541
+ "ions in `gradle/libs.versions.toml`.\n",
542
+ " - **Done when:** `./gradlew --version` reports the target Gradle and JVM",
543
+ " versions.\n",
544
+ "\n",
545
+ "2. Migrate build scripts to Kotlin DSL and modern DSL blocks.\n",
546
+ " - Replace deprecated `compileSdkVersion` with `compileSdk = <version>`.\n",
547
+ " - Replace deprecated `targetSdkVersion` with `targetSdk = <version>`.\n",
548
+ " - Configure JVM toolchain: `kotlin { jvmToolchain(17) }` or `java { tool",
549
+ "chain { languageVersion = JavaLanguageVersion.of(17) } }`.\n",
550
+ " - **Done when:** module `build.gradle.kts` files use modern AGP DSL synt",
551
+ "ax with zero deprecation warnings.\n",
552
+ "\n",
553
+ "3. Adapt to AGP Artifact and Variant API changes.\n",
554
+ " - Replace legacy `applicationVariants.all` mutations with modern `androi",
555
+ "dComponents { onVariants { ... } }` hooks.\n",
556
+ " - Use artifact transformations and `ScopedArtifacts` when injecting byte",
557
+ "code or inspecting compiled classes.\n",
558
+ " - **Done when:** custom Gradle tasks hook into AGP build phases through ",
559
+ "modern variant APIs.\n",
560
+ "\n",
561
+ "4. Verify build performance and cache compatibility.\n",
562
+ " - Enable configuration cache in `gradle.properties`: `org.gradle.configu",
563
+ "ration-cache=true`.\n",
564
+ " - Run `./gradlew assembleDebug --configuration-cache` to ensure all cust",
565
+ "om tasks declare inputs and outputs properly.\n",
566
+ " - **Done when:** consecutive builds report configuration cache re-used w",
567
+ "ith sub-second initialization.\n",
568
+ "\n",
569
+ "## Verification\n",
570
+ "\n",
571
+ "- Clean build executes and succeeds with `./gradlew assembleDebug`.\n",
572
+ "- Configuration cache stores and reloads cache entries on incremental build",
573
+ "s.\n",
574
+ "- App installs and launches on connected emulators with modern runtime comp",
575
+ "atibility.\n"
576
+ ].join('')
577
+ },
578
+ "android-cli": {
579
+ name: "android-cli",
580
+ description: [
581
+ "Use the official Google Android CLI to inspect layouts, capture screens, ma",
582
+ "nage emulators, install APKs, and query Android documentation. Use when deb",
583
+ "ugging app UI or controlling devices."
584
+ ].join(''),
585
+ content: [
586
+ "---\n",
587
+ "name: android-cli\n",
588
+ "description: Use the official Google Android CLI to inspect layouts, captur",
589
+ "e screens, manage emulators, install APKs, and query Android documentation.",
590
+ " Use when debugging app UI or controlling devices.\n",
591
+ "---\n",
592
+ "\n",
593
+ "# Android CLI Specialist\n",
594
+ "\n",
595
+ "Use the official Google `android` command-line tool for device interaction,",
596
+ " UI layout inspection, screenshot capture, emulator control, and rapid delt",
597
+ "a APK installations.\n",
598
+ "\n",
599
+ "## Workflow\n",
600
+ "\n",
601
+ "1. Verify environment and device connectivity.\n",
602
+ " - Run `android info` to verify Android SDK location, detected tools, and",
603
+ " attached physical or virtual devices.\n",
604
+ " - If `android` is not present, ensure `~/.local/bin` and `$ANDROID_HOME/",
605
+ "platform-tools` are loaded in `PATH`.\n",
606
+ " - **Done when:** `android info` returns valid SDK paths and lists connec",
607
+ "ted devices or running emulators.\n",
608
+ "\n",
609
+ "2. Inspect UI layouts and element hierarchies.\n",
610
+ " - Run `android layout` to dump a structured JSON representation of all o",
611
+ "n-screen UI elements (resource IDs, bounds, accessibility labels, and inter",
612
+ "action flags).\n",
613
+ " - Use `android layout --diff` after triggering an action to output only ",
614
+ "the UI elements that changed since the last inspection, keeping context com",
615
+ "pact.\n",
616
+ " - If an element is marked `\"off-screen\": true`, perform scrolling before",
617
+ " attempting interactions.\n",
618
+ " - **Done when:** target UI components and their coordinate bounds are pa",
619
+ "rsed from the layout output.\n",
620
+ "\n",
621
+ "3. Capture and resolve visual coordinates from screen captures.\n",
622
+ " - Run `android screen capture -o /tmp/screen.png` to inspect complex Can",
623
+ "vas or WebView screens visually.\n",
624
+ " - Run `android screen capture --annotate -o /tmp/annotated.png` and `and",
625
+ "roid screen resolve --screen /tmp/annotated.png --string \"#N\"` to convert v",
626
+ "isual numeric labels into exact center `(X, Y)` tap coordinates.\n",
627
+ " - **Done when:** visual inspection confirms screen state and element cen",
628
+ "ters are converted to tap coordinates.\n",
629
+ "\n",
630
+ "4. Install and execute APK packages with delta acceleration.\n",
631
+ " - Run `android run --apks=<path-to-apk> --activity=<MainActivity>` to bu",
632
+ "ild, deploy, and launch an app with fast delta-install.\n",
633
+ " - When managing multiple devices, pass `--device=<serial>` explicitly to",
634
+ " avoid multi-device targeting collisions.\n",
635
+ " - **Done when:** the APK is installed and the activity is launched in th",
636
+ "e foreground.\n",
637
+ "\n",
638
+ "5. Query official Android documentation and developer guidance.\n",
639
+ " - Run `android docs <query>` to retrieve authoritative guidance, API ref",
640
+ "erences, and sample patterns directly from Google's Android Knowledge Base.",
641
+ "\n",
642
+ " - **Done when:** authoritative documentation confirms API usage and migr",
643
+ "ation constraints.\n",
644
+ "\n",
645
+ "## Verification\n",
646
+ "\n",
647
+ "- `android layout` returns the expected Activity layout hierarchy and eleme",
648
+ "nt bounds.\n",
649
+ "- UI tap or input events correctly navigate the application to the target s",
650
+ "tate.\n",
651
+ "- Screen capture visually confirms the application is rendered properly wit",
652
+ "hout crash dialogs.\n"
653
+ ].join('')
654
+ },
655
+ "android-debugging-and-testing": {
656
+ name: "android-debugging-and-testing",
657
+ description: [
658
+ "Diagnose, debug, install, and verify Android applications and emulators via",
659
+ " ADB. Use when deploying APKs, handling multiple emulators, resolving exit ",
660
+ "codes, or analyzing app crashes."
661
+ ].join(''),
662
+ content: [
663
+ "---\n",
664
+ "name: android-debugging-and-testing\n",
665
+ "description: Diagnose, debug, install, and verify Android applications and ",
666
+ "emulators via ADB. Use when deploying APKs, handling multiple emulators, re",
667
+ "solving exit codes, or analyzing app crashes.\n",
668
+ "---\n",
669
+ "\n",
670
+ "# Android Debugging and Device Testing\n",
671
+ "\n",
672
+ "Diagnose runtime issues, stream-install APKs, launch activities, and captur",
673
+ "e crash forensics on connected Android devices and emulators.\n",
674
+ "\n",
675
+ "## Workflow\n",
676
+ "\n",
677
+ "1. Query attached devices and lock the target serial.\n",
678
+ " - Run `adb devices -l` before executing device commands.\n",
679
+ " - When more than one device or emulator is present (for example `emulato",
680
+ "r-5554` and `emulator-5556`), always set `export ANDROID_SERIAL=<serial>` o",
681
+ "r include `-s <serial>` in every `adb` command to prevent `adb: more than o",
682
+ "ne device/emulator` errors.\n",
683
+ " - **Done when:** `adb -s <serial> get-state` returns `device`.\n",
684
+ "\n",
685
+ "2. Perform streamed package installation.\n",
686
+ " - Run `adb -s <serial> install -r -d -t <path/to/app-debug.apk>`.\n",
687
+ " - Flags: `-r` replaces existing application while preserving data, `-d` ",
688
+ "allows version code downgrade, `-t` allows test APKs.\n",
689
+ " - Check standard output for `Success`. If `INSTALL_FAILED_ALREADY_EXISTS",
690
+ "` occurs, use `-r` or uninstall first via `adb -s <serial> uninstall <packa",
691
+ "ge>`.\n",
692
+ " - **Done when:** `adb install` output explicitly returns `Performing Str",
693
+ "eamed Install` and `Success`.\n",
694
+ "\n",
695
+ "3. Launch and verify foreground Activity lifecycle.\n",
696
+ " - Run `adb -s <serial> shell am start -W -n <package>/<activity>`. The `",
697
+ "-W` flag forces the ActivityManager to wait until launch and foreground res",
698
+ "ume are complete before returning, eliminating timing race conditions.\n",
699
+ " - Do not rely on chaining `sleep && pidof` in compound expressions, as t",
700
+ "iming differences cause exit code 1. Instead, query the activity manager di",
701
+ "rectly:\n",
702
+ " `adb -s <serial> shell dumpsys activity activities | grep -E \"mResumed",
703
+ "Activity|topResumedActivity\"`\n",
704
+ " - Confirm the target activity matches the resumed activity record.\n",
705
+ " - **Done when:** `dumpsys activity` confirms the target Activity is topR",
706
+ "esumedActivity in the foreground.\n",
707
+ "\n",
708
+ "4. Capture logcat crash traces and ANR logs.\n",
709
+ " - Run `adb -s <serial> logcat -b crash -d` to inspect recent uncaught ex",
710
+ "ceptions and native aborts.\n",
711
+ " - Run `adb -s <serial> logcat -d --pid=$(adb -s <serial> shell pidof <pa",
712
+ "ckage>)` to inspect logs scoped to the app process.\n",
713
+ " - Check `/data/anr/traces.txt` via `adb -s <serial> shell \"ls -t /data/a",
714
+ "nr/ 2>/dev/null\"` if the application encounters an Application Not Respondi",
715
+ "ng freeze.\n",
716
+ " - **Done when:** stack traces and FATAL EXCEPTION logs are extracted wit",
717
+ "h offending file names and line numbers.\n",
718
+ "\n",
719
+ "5. Configure port forwarding and network proxying when required.\n",
720
+ " - Use `adb -s <serial> reverse tcp:<port> tcp:<port>` so the emulator ca",
721
+ "n access local host development servers running on `localhost:<port>`.\n",
722
+ " - **Done when:** `adb reverse --list` confirms port mapping between emul",
723
+ "ator and host.\n",
724
+ "\n",
725
+ "## Verification\n",
726
+ "\n",
727
+ "- `adb devices` confirms the target device is online and responsive.\n",
728
+ "- The APK installs with `Success` without signature or manifest errors.\n",
729
+ "- `dumpsys activity` confirms the app is running in the foreground.\n",
730
+ "- `adb logcat -b crash -d` outputs zero unhandled exceptions.\n"
731
+ ].join('')
732
+ },
733
+ "android-profiler": {
734
+ name: "android-profiler",
735
+ description: [
736
+ "Profile Android application CPU, memory allocations, thread contention, and",
737
+ " memory leaks. Use when an app experiences frame drops, jank, high memory f",
738
+ "ootprint, or slow startup."
739
+ ].join(''),
740
+ content: [
741
+ "---\n",
742
+ "name: android-profiler\n",
743
+ "description: Profile Android application CPU, memory allocations, thread co",
744
+ "ntention, and memory leaks. Use when an app experiences frame drops, jank, ",
745
+ "high memory footprint, or slow startup.\n",
746
+ "---\n",
747
+ "\n",
748
+ "# Android Application Profiling and Performance\n",
749
+ "\n",
750
+ "Profile Android CPU cycles, memory allocations, garbage collection pauses, ",
751
+ "and frame rendering bottlenecks using Android profiling tools.\n",
752
+ "\n",
753
+ "## Workflow\n",
754
+ "\n",
755
+ "1. Configure profiling instrumentation and build variants.\n",
756
+ " - Build a debuggable or profileable release APK using `android:profileab",
757
+ "le` in `AndroidManifest.xml` so production-representative optimizations rem",
758
+ "ain active.\n",
759
+ " - Run `./gradlew assembleDebug` or `./gradlew assembleRelease`.\n",
760
+ " - **Done when:** the target APK is packaged with profileable or debuggab",
761
+ "le flags enabled.\n",
762
+ "\n",
763
+ "2. Record CPU traces and detect UI thread stalls.\n",
764
+ " - Trace method execution and thread contention using `adb shell am profi",
765
+ "le start --sampling <interval> <package> /data/local/tmp/cpu.trace`.\n",
766
+ " - Perform the target user interactions, then stop profiling with `adb sh",
767
+ "ell am profile stop <package>`.\n",
768
+ " - Pull the trace file with `adb pull /data/local/tmp/cpu.trace` and insp",
769
+ "ect with Perfetto or Android Profiler.\n",
770
+ " - **Done when:** CPU call trees identify methods spending excessive time",
771
+ " on the main UI thread.\n",
772
+ "\n",
773
+ "3. Inspect memory heaps and diagnose object leaks.\n",
774
+ " - Trigger garbage collection and dump heap with `adb shell am dumpheap <",
775
+ "package> /data/local/tmp/heap.hprof`.\n",
776
+ " - Pull and convert the heap dump: `hprof-conv /data/local/tmp/heap.hprof",
777
+ " heap_converted.hprof`.\n",
778
+ " - Analyze retained size and identify destroyed Activities or Composables",
779
+ " retained by static references, singletons, or uncancelled Coroutines.\n",
780
+ " - **Done when:** leaking instances and their strong reference paths to G",
781
+ "C roots are identified.\n",
782
+ "\n",
783
+ "4. Measure frame rendering latency and jank statistics.\n",
784
+ " - Run `adb shell dumpsys gfxinfo <package> framestats` to capture frame ",
785
+ "render times.\n",
786
+ " - Check the 90th and 99th percentile frame times; ensure frames complete",
787
+ " within 16.6ms (60 FPS) or 8.3ms (120 FPS).\n",
788
+ " - **Done when:** `gfxinfo` confirms 0% janky frames during smooth scroll",
789
+ "ing interactions.\n",
790
+ "\n",
791
+ "## Verification\n",
792
+ "\n",
793
+ "- CPU profiling trace identifies hotspots and verifies offloading to backgr",
794
+ "ound threads.\n",
795
+ "- Heap dump analysis confirms no retained Activity or ViewModel leaks after",
796
+ " configuration change.\n",
797
+ "- `dumpsys gfxinfo` reports frame render times within target refresh rate b",
798
+ "udgets.\n"
799
+ ].join('')
800
+ },
801
+ "anr-audit-and-fix": {
802
+ name: "anr-audit-and-fix",
803
+ description: [
804
+ "Investigate and resolve Android Application Not Responding (ANR) freezes. U",
805
+ "se when an app triggers an ANR dialog, blocks the main UI thread, or deadlo",
806
+ "cks on background operations."
807
+ ].join(''),
808
+ content: [
809
+ "---\n",
810
+ "name: anr-audit-and-fix\n",
811
+ "description: Investigate and resolve Android Application Not Responding (AN",
812
+ "R) freezes. Use when an app triggers an ANR dialog, blocks the main UI thre",
813
+ "ad, or deadlocks on background operations.\n",
814
+ "---\n",
815
+ "\n",
816
+ "# Android ANR Audit and Remediation\n",
817
+ "\n",
818
+ "Diagnose, reproduce, and resolve Application Not Responding (ANR) occurrenc",
819
+ "es caused by main thread contention, long-running disk/network I/O, lock de",
820
+ "adlocks, or slow BroadcastReceivers.\n",
821
+ "\n",
822
+ "## Workflow\n",
823
+ "\n",
824
+ "1. Extract and inspect ANR trace dumps.\n",
825
+ " - Run `adb bugreport bugreport.zip` or pull `/data/anr/traces.txt` using",
826
+ ":\n",
827
+ " `adb shell \"cat /data/anr/anr_* 2>/dev/null || cat /data/anr/traces.tx",
828
+ "t 2>/dev/null\" > /tmp/anr_trace.txt`.\n",
829
+ " - Locate the `\"main\"` thread section in the dump and inspect its state (",
830
+ "`SUSPENDED`, `BLOCKED`, `MONITOR`, or `TIMED_WAIT`).\n",
831
+ " - Identify the stack trace at the exact moment of the ANR trigger.\n",
832
+ " - **Done when:** the blocking call or synchronized lock in the main thre",
833
+ "ad stack trace is identified.\n",
834
+ "\n",
835
+ "2. Audit main-thread disk, database, and network operations.\n",
836
+ " - Configure `StrictMode` in debug builds:\n",
837
+ " `StrictMode.setThreadPolicy(StrictMode.ThreadPolicy.Builder().detectDi",
838
+ "skReads().detectDiskWrites().detectNetwork().penaltyLog().build())`.\n",
839
+ " - Wrap Room database transactions, Datastore accesses, and JSON serializ",
840
+ "ation calls with `withContext(Dispatchers.IO)`.\n",
841
+ " - **Done when:** all blocking file, network, and database operations run",
842
+ " on background dispatcher threads.\n",
843
+ "\n",
844
+ "3. Resolve synchronization deadlocks and contention.\n",
845
+ " - Replace blocking `runBlocking { ... }` calls on the main thread with p",
846
+ "roper Coroutine lifecycle scopes (`viewModelScope.launch` or `lifecycleScop",
847
+ "e.launch`).\n",
848
+ " - Prevent worker threads holding locks required by the main UI thread du",
849
+ "ring state updates.\n",
850
+ " - **Done when:** `runBlocking` is eliminated from UI components and mute",
851
+ "x locks are released promptly.\n",
852
+ "\n",
853
+ "4. Enforce BroadcastReceiver time budgets.\n",
854
+ " - Limit `onReceive()` execution to under 5 seconds by delegating heavy t",
855
+ "asks to Android Jetpack `WorkManager`.\n",
856
+ " - Use `goAsync()` if asynchronous handling is strictly required within t",
857
+ "he receiver lifecycle.\n",
858
+ " - **Done when:** `onReceive()` returns immediately after scheduling back",
859
+ "ground work.\n",
860
+ "\n",
861
+ "## Verification\n",
862
+ "\n",
863
+ "- ANR traces in `/data/anr/` show zero recent occurrences for the applicati",
864
+ "on package.\n",
865
+ "- `StrictMode` logs in `adb logcat` verify zero main-thread disk or network",
866
+ " violations.\n",
867
+ "- UI remains responsive and fluid during intensive data synchronization ope",
868
+ "rations.\n"
869
+ ].join('')
870
+ },
515
871
  "app-performance-profiling": {
516
872
  name: "app-performance-profiling",
517
873
  description: [
@@ -949,6 +1305,79 @@ export const COMPILED_SKILLS = {
949
1305
  "- A test crash appears deobfuscated in the console.\n"
950
1306
  ].join('')
951
1307
  },
1308
+ "r8-analyzer": {
1309
+ name: "r8-analyzer",
1310
+ description: [
1311
+ "Analyze, configure, and troubleshoot R8 minification and ProGuard keep rule",
1312
+ "s. Use when a release build crashes with ClassNotFoundException, NoSuchMeth",
1313
+ "odError, or reflection failures."
1314
+ ].join(''),
1315
+ content: [
1316
+ "---\n",
1317
+ "name: r8-analyzer\n",
1318
+ "description: Analyze, configure, and troubleshoot R8 minification and ProGu",
1319
+ "ard keep rules. Use when a release build crashes with ClassNotFoundExceptio",
1320
+ "n, NoSuchMethodError, or reflection failures.\n",
1321
+ "---\n",
1322
+ "\n",
1323
+ "# Android R8 and ProGuard Minification Rules\n",
1324
+ "\n",
1325
+ "Configure R8 shrinking, obfuscation, and resource optimization while preser",
1326
+ "ving reflection-based libraries, serialization schemas, and native JNI bind",
1327
+ "ings.\n",
1328
+ "\n",
1329
+ "## Workflow\n",
1330
+ "\n",
1331
+ "1. Enable shrinking and configure rule files.\n",
1332
+ " - In `app/build.gradle.kts`, enable `isMinifyEnabled = true` and `isShri",
1333
+ "nkResources = true` in the `release` build type.\n",
1334
+ " - Reference standard Android default rules and project rules:\n",
1335
+ " `proguardFiles(getDefaultProguardFile(\"proguard-android-optimize.txt\")",
1336
+ ", \"proguard-rules.pro\")`.\n",
1337
+ " - **Done when:** release build compiles with R8 shrinking active.\n",
1338
+ "\n",
1339
+ "2. Preserve data classes and serialization schemas.\n",
1340
+ " - Add keep rules for classes serialized via Gson, Moshi, or Kotlinx Seri",
1341
+ "alization:\n",
1342
+ " `-keepclassmembers class * { @com.google.gson.annotations.SerializedNa",
1343
+ "me <fields>; }`\n",
1344
+ " `-keep,allowobfuscation,allowshrinking class com.example.models.** { *",
1345
+ "; }`.\n",
1346
+ " - Keep enum values and Serializable classes from being stripped or renam",
1347
+ "ed improperly.\n",
1348
+ " - **Done when:** JSON serialization and deserialization function identic",
1349
+ "ally between debug and release variants.\n",
1350
+ "\n",
1351
+ "3. Preserve native JNI bindings and reflection entrypoints.\n",
1352
+ " - Keep classes and methods called via JNI from C/C++ code:\n",
1353
+ " `-keepclasseswithmembernames class * { native <methods>; }`.\n",
1354
+ " - Keep custom View constructors invoked by XML layout inflation:\n",
1355
+ " `-keep public class * extends android.view.View { public <init>(androi",
1356
+ "d.content.Context); public <init>(android.content.Context, android.util.Att",
1357
+ "ributeSet); }`.\n",
1358
+ " - **Done when:** custom views inflate properly and JNI native calls link",
1359
+ " without UnsatisfiedLinkError.\n",
1360
+ "\n",
1361
+ "4. Inspect R8 mapping and usage artifacts.\n",
1362
+ " - Inspect `app/build/outputs/mapping/release/usage.txt` to verify which ",
1363
+ "classes and methods were removed.\n",
1364
+ " - Inspect `app/build/outputs/mapping/release/mapping.txt` to deobfuscate",
1365
+ " crash traces reported in production.\n",
1366
+ " - Use `./gradlew checkReleaseDuplicateClasses` to detect dependency clas",
1367
+ "hes.\n",
1368
+ " - **Done when:** `usage.txt` confirms expected removals and `mapping.txt",
1369
+ "` is retained for crash deobfuscation.\n",
1370
+ "\n",
1371
+ "## Verification\n",
1372
+ "\n",
1373
+ "- The release APK builds successfully and is significantly smaller than the",
1374
+ " unminified debug APK.\n",
1375
+ "- Launching the release APK on a device triggers no `ClassNotFoundException",
1376
+ "` or `NoSuchMethodError`.\n",
1377
+ "- Crash traces can be remapped to original line numbers using `retrace` and",
1378
+ " `mapping.txt`.\n"
1379
+ ].join('')
1380
+ },
952
1381
  "room-and-persistence": {
953
1382
  name: "room-and-persistence",
954
1383
  description: [
@@ -1015,6 +1444,73 @@ export const COMPILED_SKILLS = {
1015
1444
  "- Strict mode reports no disk access on the main thread.\n",
1016
1445
  "- A list screen with ten thousand rows scrolls smoothly.\n"
1017
1446
  ].join('')
1447
+ },
1448
+ "testing-setup": {
1449
+ name: "testing-setup",
1450
+ description: [
1451
+ "Configure and execute automated Android unit and instrumentation tests. Use",
1452
+ " when setting up ComposeTestRule, Espresso, Robolectric, or verifying UI jo",
1453
+ "urneys on an emulator."
1454
+ ].join(''),
1455
+ content: [
1456
+ "---\n",
1457
+ "name: testing-setup\n",
1458
+ "description: Configure and execute automated Android unit and instrumentati",
1459
+ "on tests. Use when setting up ComposeTestRule, Espresso, Robolectric, or ve",
1460
+ "rifying UI journeys on an emulator.\n",
1461
+ "---\n",
1462
+ "\n",
1463
+ "# Android Automated Testing and Verification\n",
1464
+ "\n",
1465
+ "Configure test harnesses, author Jetpack Compose UI tests, and execute loca",
1466
+ "l unit tests and on-device instrumentation tests through Gradle.\n",
1467
+ "\n",
1468
+ "## Workflow\n",
1469
+ "\n",
1470
+ "1. Configure test dependencies in Gradle version catalog.\n",
1471
+ " - Declare dependencies in `gradle/libs.versions.toml`:\n",
1472
+ " `androidx-compose-ui-test-junit4`, `androidx-compose-ui-test-manifest`",
1473
+ ", `androidx-test-ext-junit`, `androidx-test-espresso-core`, `robolectric`, ",
1474
+ "and `kotlinx-coroutines-test`.\n",
1475
+ " - In `app/build.gradle.kts`, configure `testImplementation` and `android",
1476
+ "TestImplementation`.\n",
1477
+ " - **Done when:** Gradle dependencies resolve cleanly without version con",
1478
+ "flicts.\n",
1479
+ "\n",
1480
+ "2. Structure Jetpack Compose UI tests.\n",
1481
+ " - Use `createAndroidComposeRule<MainActivity>()` or `createComposeRule()",
1482
+ "` in `androidTest`.\n",
1483
+ " - Find elements by semantics or test tags: `composeTestRule.onNodeWithTe",
1484
+ "xt(\"...\").performClick()`.\n",
1485
+ " - Assert element states: `composeTestRule.onNodeWithTag(\"submit_button\")",
1486
+ ".assertIsEnabled()`.\n",
1487
+ " - **Done when:** Compose test cases exercise user interactions and asser",
1488
+ "t resulting UI states.\n",
1489
+ "\n",
1490
+ "3. Run local JVM unit tests.\n",
1491
+ " - Execute `./gradlew testDebugUnitTest` for fast headless verification.\n",
1492
+ " - Use Robolectric or mock Android framework classes when unit tests refe",
1493
+ "rence Android Context or resources.\n",
1494
+ " - **Done when:** `./gradlew testDebugUnitTest` finishes with `BUILD SUCC",
1495
+ "ESSFUL` and 100% test pass rate.\n",
1496
+ "\n",
1497
+ "4. Execute on-device instrumentation tests.\n",
1498
+ " - Ensure an active emulator or connected physical device is online via `",
1499
+ "adb devices`.\n",
1500
+ " - Run `./gradlew connectedDebugAndroidTest` to execute tests inside the ",
1501
+ "Android runtime.\n",
1502
+ " - Inspect XML test results in `app/build/reports/androidTests/connected/",
1503
+ "`.\n",
1504
+ " - **Done when:** all connected on-device tests pass and generate green H",
1505
+ "TML/XML test reports.\n",
1506
+ "\n",
1507
+ "## Verification\n",
1508
+ "\n",
1509
+ "- `./gradlew testDebugUnitTest` passes with zero assertion errors.\n",
1510
+ "- `./gradlew connectedDebugAndroidTest` passes on the connected emulator wi",
1511
+ "thout timeouts.\n",
1512
+ "- Test coverage reports confirm critical user journeys are validated.\n"
1513
+ ].join('')
1018
1514
  }
1019
1515
  },
1020
1516
  "backend": {
@@ -120,6 +120,27 @@ export function detectWorkspaceDomains(workspaceRoot) {
120
120
  }
121
121
  }
122
122
 
123
+ // Shallow check of immediate subdirectories for Android projects located in subfolders
124
+ if (!detectedDomains.includes('android')) {
125
+ try {
126
+ const entries = fs.readdirSync(workspaceRoot, { withFileTypes: true });
127
+ for (const entry of entries) {
128
+ if (entry.isDirectory() && !entry.name.startsWith('.') && entry.name !== 'node_modules' && entry.name !== 'Library') {
129
+ const subDir = path.join(workspaceRoot, entry.name);
130
+ if (fs.existsSync(path.join(subDir, 'build.gradle')) ||
131
+ fs.existsSync(path.join(subDir, 'build.gradle.kts')) ||
132
+ fs.existsSync(path.join(subDir, 'gradlew')) ||
133
+ fs.existsSync(path.join(subDir, 'app/build.gradle')) ||
134
+ fs.existsSync(path.join(subDir, 'app/build.gradle.kts')) ||
135
+ fs.existsSync(path.join(subDir, 'app/src/main/AndroidManifest.xml'))) {
136
+ detectedDomains.push('android');
137
+ break;
138
+ }
139
+ }
140
+ }
141
+ } catch (e) { /* unreadable directory is simply skipped */ }
142
+ }
143
+
123
144
  for (const domain of UNIVERSAL_DOMAINS) {
124
145
  if (!detectedDomains.includes(domain)) detectedDomains.push(domain);
125
146
  }