agentsclimarketplace

Android

Skill tienenwu/fables/android

Use when writing, refactoring, or debugging Android app code (Kotlin, Jetpack Compose, Gradle, ProGuard/R8) — before adding a feature, touching build config or proguard-rules, preparing a release/AAB, or when facing release-only crashes, ClassNotFoundException after minify, lifecycle leaks, ANR, or excessive recomposition.From its SKILL.md

Install
npx -y skills add tienenwu/fables --skill android

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 4 stars4 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

4.0 KB, ~1.5k tokens by cl100k_base, as published. Nobody here has run it

🌐 English version · 繁體中文(正本 / canonical)

Android 開發判準手冊

核心原則

  1. Debug build 的綠燈不算數:R8、混淆、簽章、後端環境旗標都只在 release 生效——release 路徑的改動必須用 release 級驗證。
  2. 狀態只往下流、事件只往上傳:UI 層不做業務判斷,Composable 不持有可變業務狀態。
  3. 生命週期是預設敵人:任何持有 Context/View 的長生命週期物件,先假設它會洩漏,再證明不會。
  4. 反射是 R8 的盲區:所有經反射建構的類別(Gson/Moshi/Retrofit model)改動時,keep 規則同步改,否則是 release-only 炸彈。
  5. 主執行緒上不做 IO,協程不用 GlobalScope——沒有例外情境值得討論。

開工分流

情境路徑先讀
新增畫面/功能先定狀態擁有者與資料流,再寫 UIreferences/architecture-state.md
UI 卡頓、recomposition 過多不要先改 UI,先查狀態設計references/compose-ui.md
非同步、Flow、生命週期問題查 collect 位置與 scope 選擇references/coroutines-lifecycle.md
加/改 API model(Gson/Moshi/Retrofit)實作 + keep 規則一起改references/release-checklist.md §R8
出 release / 改 build 設定逐條跑必查清單references/release-checklist.md
release 才爆、debug 正常先假設 minify/混淆/環境旗標,別亂猜references/release-checklist.md

紅線(絕對禁止)

  • 禁止只用 debug build 驗證後宣告 release 相關改動完成——minify、keep 規則、BuildConfig 旗標在 debug 全部不生效。
  • 禁止 GlobalScope.launch——生命週期不受控,畫面銷毀後繼續跑,洩漏加 crash。
  • 禁止在 Composable 函式本體做網路/DB 呼叫——每次 recomposition 重打一次,用 LaunchedEffect 或下放 ViewModel。
  • 禁止 ViewModel 持有 Activity/Fragment/View 的參照——旋轉螢幕即洩漏;要 Context 用 Application 級。
  • 禁止 catch 後只 log 不通知呼叫端——使用者會看到永遠轉圈的 spinner;錯誤要變成 UI state。
  • 禁止改測試斷言讓 CI 變綠——連紅兩次是方向錯誤訊號,退回上一決策點。

失敗訊號(該回頭,不是重試)

徵兆多半是退回
修 recomposition 一處、另一處又卡state 放錯層級,粒度太粗重看狀態擁有者設計
remember / derivedStateOf 越加越多才不閃爍上游把不穩定物件當 state 傳檢查傳入參數的穩定性
release crash 修一個 keep 規則又冒下一個逐類補洞,該整包 keep 該 model 目錄R8 規則層
生命週期 callback 裡的 null check 越寫越多持有了不該持有的參照所有權設計
同一個 ANR 換三種寫法還在主執行緒上有隱藏的同步 IO找出真正阻塞點再動手

references 索引

  • references/architecture-state.md — 分層判準、狀態該放哪一層、UDF 正反例。動架構或新功能前讀。
  • references/compose-ui.md — 何時抽 Composable、穩定性與 recomposition、副作用 API 選擇。寫 UI 前讀。
  • references/coroutines-lifecycle.md — scope/Dispatcher 選擇、Flow collect 位置、洩漏典型。碰非同步就讀。
  • references/release-checklist.md — R8/keep、build variant、簽章、權限、出版前逐條打勾。出 release 必讀。
  • references/test-scenarios.md — 判準測驗集,驗證接手模型是否照走。不給執行中的模型讀。

What ships with it: 5 files

23.1 KB alongside SKILL.md

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.