android-bug-hunting-coroutine-and-flow-defects

Analyze Kotlin coroutine and Flow code for Android bugs.

Updated Jan 2, 2024
One-click install
npx skills add https://github.com/Mithrandir21/game-deals-android-app --skill android-bug-hunting-coroutine-and-flow-defects
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: android-bug-hunting-coroutine-and-flow-defects
Source: https://github.com/Mithrandir21/game-deals-android-app/tree/main/.claude/skills/android-bug-hunting-coroutine-and-flow-defects
Command: npx skills add https://github.com/Mithrandir21/game-deals-android-app --skill android-bug-hunting-coroutine-and-flow-defects

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

Developers face subtle bugs in Kotlin coroutine and Flow usage that can lead to crashes, memory leaks, or UI glitches in Android applications.

Core Features & Use Cases

  • Detects common coroutine scope misuses like GlobalScope and runBlocking on the main thread.
  • Highlights improper Flow collection practices, such as not using repeatOnLifecycle.
  • Finds issues with StateFlow and SharedFlow for event handling and state representation.
  • Assists in identifying unsafe coroutine dispatching, blocking calls, and cancellation problems in Kotlin code across Android projects.
  • Applicable during code reviews or static code analysis to improve app stability and correctness.

Quick Start

Scan the Kotlin source files in your project to find coroutine and Flow-related anti-patterns and safety issues.

Frequently Asked Questions about android-bug-hunting-coroutine-and-flow-defects

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I find Kotlin coroutine and Flow bugs causing memory leaks in Android apps?

To find Kotlin coroutine and Flow bugs in Android apps, scan your source code to detect scope misuses like GlobalScope, improper collection without repeatOnLifecycle, and unsafe dispatchers that cause memory leaks.

What are common Kotlin Flow collection anti-patterns I should look for during code review?

Common Kotlin Flow collection anti-patterns to look for during code review include missing repeatOnLifecycle usage, improper StateFlow and SharedFlow event handling, and unsafe blocking calls on the main thread.

How do I check for unsafe coroutine dispatching and blocking calls in my Android project?

To check for unsafe coroutine dispatching and blocking calls in Android, analyze your Kotlin code for improper dispatcher usage, runBlocking on the main thread, and incomplete cancellation handling.

Can this tool detect improper StateFlow and SharedFlow usage for state representation?

Yes, this tool detects improper StateFlow and SharedFlow usage for state representation and event handling, highlighting collection patterns that lead to inconsistent UI behavior or crashes.

What is the best way to prevent crashes from GlobalScope and runBlocking on the main thread?

The best way to prevent crashes from GlobalScope and runBlocking on the main thread is to systematically analyze Kotlin code for these exact coroutine scope misuses and enforce safe asynchronous programming practices.

Does static code analysis for Android coroutines cover cancellation handling and lifecycle scopes?

Yes, static code analysis for Android coroutines covers cancellation handling and lifecycle scopes by identifying improper collection practices and enforcing robust coroutine practices to ensure app stability.