Sparround

Android üçün praktiki skill nümunələri

Android layihələrində skill-ə çevrilməyə ən layiq üç iş növü var:

1. Təkrarlanan review checklist-ləri — Compose, coroutine, resurs sızması. Hər PR-da eyni suallar.

2. Çoxaddımlı yaratma prosedurları — yeni modul, yeni ekran, yeni test dəsti. Unudulan addım olur.

3. Buraxılışa hazırlıq — versiya, ProGuard, icazələr, debug qalıqları.

Bu bölmədə hər birindən bir işlək nümunə var. Onları öz layihənizin real qaydalarına uyğunlaşdırın — nümunə olduğu kimi köçürülməməlidir.

markdown
---
description: Reviews coroutine and Flow usage — scope choice, dispatcher, exception handling and collection in Compose. Use when the user asks for a review of coroutines, Flow, suspend functions or async code.
allowed-tools: Read, Grep, Glob
paths:
  - "**/*.kt"
---

# Coroutine / Flow review

!`git diff --name-only main -- '*.kt'`

Read the files above that contain `suspend`, `launch`, `Flow` or
`collect`, and check:

1. **Scope** — is `GlobalScope` used anywhere? It should be
   `viewModelScope` in a ViewModel, and `rememberCoroutineScope`
   or `LaunchedEffect` in a Composable.
2. **Dispatcher** — is IO work on `Dispatchers.IO`?
   Is the dispatcher hardcoded or injected?
   (It should be injected, for testability.)
3. **Exceptions** — is an exception thrown inside `launch` caught?
   Is there a `try/catch` or a `CoroutineExceptionHandler`?
4. **Collection in Compose** — is `collectAsStateWithLifecycle`
   used, or plain `collectAsState`?
5. **Cancellation** — do long loops check `ensureActive()` or
   `isActive`?

Output: `file:line` plus a short explanation and a suggestion for
each finding. Do not modify files.

Coroutine review skill-i. `paths` sayəsində yalnız Kotlin faylları ilə işləyəndə avtomatik yüklənir.

markdown
---
description: Writes a UI test for an existing Composable — createComposeRule, semantics finders and assertions. Use when the user wants a test written for Compose.
argument-hint: [name of the Composable]
arguments: composable
---

# Compose UI test: $composable

## Existing test examples

!`find . -path '*/androidTest/*' -name '*Test.kt' | head -3`

## Steps

1. Find the `$composable` function and read its parameters.
2. Read one of the existing tests above and follow the project's
   test style (naming, setup, fakes).
3. Write the test under `androidTest`:
   - `createComposeRule()` when no Activity is needed
   - `createAndroidComposeRule<T>()` when one is
4. Cover: the initial state, a user action, the result, and the
   empty/error state if there is one.
5. Run `./gradlew :app:compileDebugAndroidTestKotlin`.

Note: finding by text (`onNodeWithText`) breaks when localisation
changes. Prefer `testTag`, adding `Modifier.testTag(...)` to the
Composable where needed.

Test yazma skill-i. Mövcud testi nümunə kimi oxutdurmaq — agentin layihə üslubuna uyğun yazmasının ən etibarlı yoludur.

Nümunələrdə təkrarlanan bir pattern var: agentə mövcud faylı nümunə kimi oxutdurmaq. Bu, layihə konvensiyalarını skill-ə yazmaqdan daha etibarlıdır — çünki kod dəyişəndə skill avtomatik uyğunlaşır, sənədləşmə isə köhnəlir.

📚 Mənbələr və sənədlər