Exhaustive Android memory leak prevention skill for writing leak-free code across View-based and Jetpack Compose UI systems.
“数据、分析与调研”领域的一个 Skill。已为 Claude Code, Codex, OpenCode 及另外 32 个智能体 准备好命令。
完整描述
Exhaustive Android memory leak prevention skill for writing leak-free code across View-based and Jetpack Compose UI systems. Use this skill whenever writing, reviewing, or auditing Android code that involves: Fragment or Activity lifecycle and ViewBinding (onDestroyView, _binding null), Context usage in singletons or long-lived objects (applicationContext vs Activity context), static fields or companion objects holding Views or Activities, listeners, observers, or BroadcastReceivers without symmetric unregistration, LiveData or Flow collection in Fragments (viewLifecycleOwner, repeatOnLifecycle), ViewModel holding UI references or callbacks, coroutine scopes (GlobalScope, CoroutineScope, viewModelScope, lifecycleScope), resource management (Cursor, InputStream, MediaPlayer, Bitmap, SQLite), custom Views (onDetachedFromWindow, animators, bitmaps), Handler and Runnable with postDelayed, WebView lifecycle, Hilt or DI scope alignment, or any Jetpack Compose memory concerns (remember, DisposableEffect, LaunchedEffect, rememberCoroutineScope, RememberObserver, LocalContext, composable lambdas in ViewModels). Also trigger for detection and tooling questions: LeakCanary setup, Android Studio Memory Profiler, heapprofd, Perfetto heap graphs, ApplicationExitInfo OOM detection. Trigger even for casual phrasings like "why is my app crashing with OOM", "is this a memory leak", "should I use applicationContext here", "how do I clean up in onDestroyView", or "my Activity is leaking". Covers Android API levels 21 through 35+.