android-dev-playbook

A guide for writing, changing, and debugging Android applications, including Kotlin, Jetpack Compose, Gradle, and Android release settings. Jetpack Compose is Android's toolkit for building screens in code.

In plain words
What is it for?
Use it when adding screens or features, changing build or ProGuard/R8 settings, preparing an app bundle, handling asynchronous work, or investigating release-only crashes and performance issues.
Why use it?
It helps catch problems that may appear only in release builds, such as code shrinking, signing, lifecycle leaks, crashes, frozen interfaces, or uncontrolled background work.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/tienenwu/fables/android
Any agent
npx skills add tienenwu/fables --skill android
Clone the repo
git clone --depth 1 https://github.com/tienenwu/fables

Made for: Claude Code, Codex.

Per session 80 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,239 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00080 $0.01239
Opus 5 $0.00040 $0.00620
Sonnet 5 $0.00016 $0.00248
Haiku 4.5 $0.00008 $0.00124

Measured 2d ago against content hash 87b26ce4f57b, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

android-dev-playbook scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

android/SKILL.md · 55 lines

How it starts

The opening of the file, as written. The whole thing — 55 lines — stays where its author put it; the contents beside it link to each section on GitHub.

🌐 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——沒有例外情境值得討論。

開工分流

情境 路徑 先讀
新增畫面/功能 先定狀態擁有者與資料流,再寫 UI references/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 — 判準測驗集,驗證接手模型是否照走。不給執行中的模型讀。

Read the full file on GitHub · 55 lines

Files

What ships with it

5 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 55 lines · 80 tokens per session scan A 87b26ce4f57b

Subscribe to this mod's changes

android-dev-playbook is a skill published in the GitHub repository tienenwu/fables (4 stars, last pushed 1mo ago), licensed MIT. It adds 80 tokens to every session and 1,239 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.