mobile-ai-agents 1.0.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +228 -0
- package/CLAUDE.md +236 -0
- package/LICENSE +21 -0
- package/README.md +652 -0
- package/agents/android/android-crash-analyzer/README.md +134 -0
- package/agents/android/android-crash-analyzer/agent.md +206 -0
- package/agents/android/android-crash-analyzer/example-input.md +138 -0
- package/agents/android/android-crash-analyzer/example-output.md +225 -0
- package/agents/android/anr-investigation/README.md +78 -0
- package/agents/android/anr-investigation/agent.md +117 -0
- package/agents/android/anr-investigation/example-input.md +62 -0
- package/agents/android/anr-investigation/example-output.md +103 -0
- package/agents/android/axiom/agent.md +197 -0
- package/agents/android/code-reviewer/README.md +108 -0
- package/agents/android/code-reviewer/agent.md +210 -0
- package/agents/android/code-reviewer/example-input.md +116 -0
- package/agents/android/code-reviewer/example-output.md +115 -0
- package/agents/android/compose-navigation/README.md +76 -0
- package/agents/android/compose-navigation/agent.md +121 -0
- package/agents/android/compose-navigation/example-input.md +49 -0
- package/agents/android/compose-navigation/example-output.md +325 -0
- package/agents/android/compose-screen-builder/README.md +95 -0
- package/agents/android/compose-screen-builder/agent.md +170 -0
- package/agents/android/compose-screen-builder/example-input.md +40 -0
- package/agents/android/compose-screen-builder/example-output.md +568 -0
- package/agents/android/compose-ui-reviewer/README.md +73 -0
- package/agents/android/compose-ui-reviewer/agent.md +253 -0
- package/agents/android/compose-ui-reviewer/example-input.md +84 -0
- package/agents/android/compose-ui-reviewer/example-output.md +102 -0
- package/agents/android/crash-analyzer/README.md +53 -0
- package/agents/android/crash-analyzer/agent.md +295 -0
- package/agents/android/memory-leak-analyzer/README.md +79 -0
- package/agents/android/memory-leak-analyzer/agent.md +116 -0
- package/agents/android/memory-leak-analyzer/example-input.md +78 -0
- package/agents/android/memory-leak-analyzer/example-output.md +128 -0
- package/agents/cross-platform/accessibility-auditor/README.md +47 -0
- package/agents/cross-platform/accessibility-auditor/agent.md +268 -0
- package/agents/cross-platform/accessibility-auditor/example-input.md +84 -0
- package/agents/cross-platform/accessibility-auditor/example-output.md +132 -0
- package/agents/cross-platform/appforge/agent.md +303 -0
- package/agents/cross-platform/ci-cd-generator/README.md +65 -0
- package/agents/cross-platform/ci-cd-generator/agent.md +422 -0
- package/agents/cross-platform/ci-cd-generator/example-input.md +69 -0
- package/agents/cross-platform/ci-cd-generator/example-output.md +261 -0
- package/agents/cross-platform/crasher/agent.md +221 -0
- package/agents/cross-platform/figma/agent.md +247 -0
- package/agents/cross-platform/launchpad/agent.md +330 -0
- package/agents/cross-platform/mobile-harness/agent.md +422 -0
- package/agents/cross-platform/mobile-memory/agent.md +429 -0
- package/agents/cross-platform/perf/agent.md +261 -0
- package/agents/cross-platform/pipeline/agent.md +288 -0
- package/agents/cross-platform/release-notes-generator/README.md +63 -0
- package/agents/cross-platform/release-notes-generator/agent.md +218 -0
- package/agents/cross-platform/release-notes-generator/example-input.md +71 -0
- package/agents/cross-platform/release-notes-generator/example-output.md +96 -0
- package/agents/cross-platform/scribe/agent.md +180 -0
- package/agents/cross-platform/security-scanner/README.md +61 -0
- package/agents/cross-platform/security-scanner/agent.md +287 -0
- package/agents/cross-platform/security-scanner/example-input.md +77 -0
- package/agents/cross-platform/security-scanner/example-output.md +141 -0
- package/agents/cross-platform/sentinel/agent.md +217 -0
- package/agents/cross-platform/store-listing-writer/README.md +58 -0
- package/agents/cross-platform/store-listing-writer/agent.md +380 -0
- package/agents/cross-platform/store-listing-writer/example-input.md +67 -0
- package/agents/cross-platform/store-listing-writer/example-output.md +131 -0
- package/agents/flutter/bloc-feature-builder/README.md +101 -0
- package/agents/flutter/bloc-feature-builder/agent.md +225 -0
- package/agents/flutter/bloc-feature-builder/example-input.md +47 -0
- package/agents/flutter/bloc-feature-builder/example-output.md +838 -0
- package/agents/flutter/dart/agent.md +223 -0
- package/agents/flutter/widget-generator/README.md +66 -0
- package/agents/flutter/widget-generator/agent.md +264 -0
- package/agents/flutter/widget-generator/example-input.md +71 -0
- package/agents/flutter/widget-generator/example-output.md +163 -0
- package/agents/gaming/forge/agent.md +197 -0
- package/agents/gaming/unreal/agent.md +200 -0
- package/agents/ios/crash-analyzer/README.md +69 -0
- package/agents/ios/crash-analyzer/agent.md +300 -0
- package/agents/ios/crash-analyzer/example-input.md +83 -0
- package/agents/ios/crash-analyzer/example-output.md +126 -0
- package/agents/ios/swift/agent.md +206 -0
- package/agents/ios/swift-reviewer/README.md +68 -0
- package/agents/ios/swift-reviewer/agent.md +231 -0
- package/agents/ios/swift-reviewer/example-input.md +100 -0
- package/agents/ios/swift-reviewer/example-output.md +127 -0
- package/agents/react-native/bridge/agent.md +212 -0
- package/agents/react-native/performance-optimizer/README.md +81 -0
- package/agents/react-native/performance-optimizer/agent.md +284 -0
- package/agents/react-native/performance-optimizer/example-input.md +104 -0
- package/agents/react-native/performance-optimizer/example-output.md +132 -0
- package/agents/unity/shader-generator/README.md +77 -0
- package/agents/unity/shader-generator/agent.md +270 -0
- package/agents/unity/shader-generator/example-input.md +70 -0
- package/agents/unity/shader-generator/example-output.md +160 -0
- package/agents/unreal/blueprint-advisor/README.md +71 -0
- package/agents/unreal/blueprint-advisor/agent.md +311 -0
- package/agents/unreal/blueprint-advisor/example-input.md +73 -0
- package/agents/unreal/blueprint-advisor/example-output.md +217 -0
- package/cli/index.js +1091 -0
- package/docs/agent-guide.md +138 -0
- package/docs/chatgpt-integration.md +219 -0
- package/docs/core-loops.md +143 -0
- package/docs/cursor-integration.md +143 -0
- package/docs/getting-started.md +132 -0
- package/docs/index.html +711 -0
- package/docs/installation.md +271 -0
- package/docs/mobile-harness.md +160 -0
- package/docs/mobile-mcp.md +172 -0
- package/docs/mobile-memory.md +349 -0
- package/docs/release-process.md +85 -0
- package/docs/releases/release-v1.0.0.md +165 -0
- package/docs/roadmap/github-issues.md +239 -0
- package/docs/skill-categories.md +125 -0
- package/docs/vscode-copilot-integration.md +104 -0
- package/docs/wiki.md +615 -0
- package/install.sh +507 -0
- package/mobile-karpathy.md +79 -0
- package/package.json +57 -0
- package/skills/android/README.md +31 -0
- package/skills/android/android-tdd.md +89 -0
- package/skills/android/anr-investigation.md +251 -0
- package/skills/android/code-review.md +98 -0
- package/skills/android/compose-migration.md +48 -0
- package/skills/android/compose-review.md +78 -0
- package/skills/android/kotlin-modernize.md +51 -0
- package/skills/android/memory-leak-investigation.md +256 -0
- package/skills/android/proguard-rules.md +48 -0
- package/skills/cross-platform/accessibility-audit.md +63 -0
- package/skills/cross-platform/api-versioning.md +59 -0
- package/skills/cross-platform/clean-code-audit.md +239 -0
- package/skills/cross-platform/crash-triage.md +53 -0
- package/skills/cross-platform/deeplink-debug.md +57 -0
- package/skills/cross-platform/feature-slice.md +48 -0
- package/skills/cross-platform/grill-mobile.md +64 -0
- package/skills/cross-platform/mobile-mcp-qa.md +193 -0
- package/skills/cross-platform/mobile-memory-graph.md +179 -0
- package/skills/cross-platform/mobile-memory-save.md +210 -0
- package/skills/cross-platform/mobile-memory-search.md +154 -0
- package/skills/cross-platform/perf-audit.md +61 -0
- package/skills/cross-platform/prd-verification.md +324 -0
- package/skills/cross-platform/release-prep.md +64 -0
- package/skills/cross-platform/security-audit.md +281 -0
- package/skills/cross-platform/store-listing.md +75 -0
- package/skills/flutter/README.md +32 -0
- package/skills/flutter/dart-modernize.md +47 -0
- package/skills/flutter/flutter-review.md +59 -0
- package/skills/flutter/flutter-tdd.md +73 -0
- package/skills/flutter/widget-extract.md +41 -0
- package/skills/flutter/widget-gen.md +131 -0
- package/skills/gaming/blueprint-to-cpp.md +51 -0
- package/skills/gaming/game-perf.md +54 -0
- package/skills/gaming/shader-gen.md +44 -0
- package/skills/gaming/unity-tdd.md +85 -0
- package/skills/ios/README.md +45 -0
- package/skills/ios/data-persistence.md +151 -0
- package/skills/ios/ios-tdd.md +90 -0
- package/skills/ios/networking.md +139 -0
- package/skills/ios/performance.md +122 -0
- package/skills/ios/swift-concurrency.md +57 -0
- package/skills/ios/swift-review.md +124 -0
- package/skills/ios/swiftui-review.md +49 -0
- package/skills/ios/swiftui-state.md +122 -0
- package/skills/ios/unit-testing.md +144 -0
- package/skills/ios/xcode-warnings.md +37 -0
- package/skills/react-native/README.md +42 -0
- package/skills/react-native/bridge-audit.md +104 -0
- package/skills/react-native/expo-optimize.md +55 -0
- package/skills/react-native/new-arch-migrate.md +53 -0
- package/skills/react-native/performance.md +124 -0
- package/skills/react-native/rn-review.md +53 -0
- package/skills/react-native/rn-tdd.md +76 -0
- package/skills/shared/README.md +46 -0
- package/skills/shared/accessibility-audit.md +132 -0
- package/skills/shared/crash-analysis.md +110 -0
- package/skills/shared/security-scan.md +149 -0
- package/skills/unity/README.md +31 -0
- package/skills/unity/shader-review.md +110 -0
- package/templates/agent-template.md +88 -0
- package/templates/prompt-template.md +50 -0
- package/templates/skill-template.md +64 -0
- package/templates/workflow-template.md +48 -0
- package/workflows/app-launch.md +66 -0
- package/workflows/appforge-workflow.md +232 -0
- package/workflows/ci-setup.md +77 -0
- package/workflows/crash-to-fix.md +71 -0
- package/workflows/feature-ship.md +61 -0
- package/workflows/game-level.md +72 -0
- package/workflows/mobile-harness.md +319 -0
- package/workflows/mobile-mcp-qa.md +228 -0
- package/workflows/mobile-memory-workflow.md +243 -0
- package/workflows/new-project-setup.md +93 -0
- package/workflows/new-screen.md +68 -0
- package/workflows/perf-sprint.md +78 -0
- package/workflows/release-cycle.md +71 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# Android Compose Screen Builder Agent
|
|
2
|
+
|
|
3
|
+
> Describe a screen. Get a complete, production-ready Jetpack Compose implementation — ViewModel, StateFlow, Navigation, Material 3, Clean Architecture wiring, and all.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## What This Agent Does
|
|
8
|
+
|
|
9
|
+
Takes a plain-English screen description and returns a full, compilable Kotlin implementation including:
|
|
10
|
+
|
|
11
|
+
- `@Composable` screen function with Material 3 components
|
|
12
|
+
- `ViewModel` with `StateFlow`-based UI state
|
|
13
|
+
- Sealed `UiState` class with `Loading`, `Success`, and `Error` states
|
|
14
|
+
- `collectAsStateWithLifecycle()` for lifecycle-safe collection
|
|
15
|
+
- `NavController` integration with typed navigation arguments
|
|
16
|
+
- Accessibility semantics and dark-mode theming
|
|
17
|
+
- `@Preview` annotations (light + dark)
|
|
18
|
+
- Hilt `@HiltViewModel` dependency injection setup
|
|
19
|
+
- Clean Architecture layer boundaries respected
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## When to Use
|
|
24
|
+
|
|
25
|
+
- Starting a new screen from scratch
|
|
26
|
+
- Converting a design mockup or Figma spec into Compose code
|
|
27
|
+
- Generating boilerplate so you can focus on business logic
|
|
28
|
+
- Onboarding a developer to your Compose + Clean Architecture patterns
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Files
|
|
33
|
+
|
|
34
|
+
| File | Purpose |
|
|
35
|
+
|---|---|
|
|
36
|
+
| [`agent.md`](agent.md) | Input format, output format, full system prompt |
|
|
37
|
+
| [`example-input.md`](example-input.md) | Real screen description ready to paste |
|
|
38
|
+
| [`example-output.md`](example-output.md) | Full generated screen implementation |
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Quick Start
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
# Claude Code session:
|
|
46
|
+
Use the system prompt from agents/android/compose-screen-builder/agent.md
|
|
47
|
+
Then describe your screen using the input format.
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## Input Format
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
SCREEN_NAME: <e.g. OrderHistoryScreen>
|
|
56
|
+
DESCRIPTION: <plain-English description of the screen>
|
|
57
|
+
STATE_FIELDS: <list of data fields the screen displays>
|
|
58
|
+
ACTIONS: <list of user actions the screen supports>
|
|
59
|
+
NAVIGATION: <where this screen navigates to, and what params it receives>
|
|
60
|
+
DEPENDENCIES: <optional — Hilt modules, repository names already in your project>
|
|
61
|
+
COMPOSE_VERSION: <e.g. 1.7>
|
|
62
|
+
KOTLIN_VERSION: <e.g. 2.0>
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## What Gets Generated
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
screen/
|
|
71
|
+
├── <ScreenName>Screen.kt — @Composable screen + sub-composables + Previews
|
|
72
|
+
├── <ScreenName>ViewModel.kt — @HiltViewModel + StateFlow + use case calls
|
|
73
|
+
└── <ScreenName>UiState.kt — sealed UiState, UiEvent (optional)
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## Design Principles
|
|
79
|
+
|
|
80
|
+
Every generated screen follows these non-negotiables:
|
|
81
|
+
|
|
82
|
+
- **No business logic in Composables.** Data fetching, transformation, and decisions live in the ViewModel or below.
|
|
83
|
+
- **Single source of truth.** One sealed `UiState` drives the entire screen. No parallel boolean flags (`isLoading`, `hasError`, `isEmpty`).
|
|
84
|
+
- **Lifecycle-safe collection.** `collectAsStateWithLifecycle()` (not `collectAsState()`) throughout.
|
|
85
|
+
- **Stable keys.** `LazyColumn` items always have `key = { it.id }`.
|
|
86
|
+
- **Material 3 theming.** All colors, typography, and shapes from `MaterialTheme`. No hardcoded hex.
|
|
87
|
+
- **Accessibility.** `contentDescription` on all icons, minimum 48dp tap targets, `Semantics` on custom components.
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## Related Agents
|
|
92
|
+
|
|
93
|
+
- [`agents/android/code-reviewer`](../code-reviewer/) — review the generated code for issues
|
|
94
|
+
- [`agents/android/compose-ui-reviewer`](../compose-ui-reviewer/) — Compose-specific review
|
|
95
|
+
- [`agents/android/android-crash-analyzer`](../android-crash-analyzer/) — debug crashes in generated screens
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
# Agent — Android Compose Screen Builder
|
|
2
|
+
|
|
3
|
+
**Platform:** Android (Kotlin / Jetpack Compose / Material 3)
|
|
4
|
+
**Category:** UI & Design / Code Generation
|
|
5
|
+
**Complexity:** High
|
|
6
|
+
**Tested With:** Claude Sonnet 4.6, GPT-4o
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Purpose
|
|
11
|
+
|
|
12
|
+
Generates a complete, production-ready Jetpack Compose screen implementation from a plain-English description. Output includes the `@Composable` screen function, `@HiltViewModel`, sealed `UiState`, navigation wiring, previews, and Clean Architecture layer boundaries.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Input Format
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
SCREEN_NAME: <PascalCase screen name, e.g. OrderHistoryScreen>
|
|
20
|
+
DESCRIPTION:
|
|
21
|
+
<Plain-English description of the screen. Include:
|
|
22
|
+
- What data is displayed (lists, cards, text fields, images)
|
|
23
|
+
- What interactive elements exist (buttons, swipe, pull-to-refresh, FAB)
|
|
24
|
+
- Loading, empty, and error states
|
|
25
|
+
- Any animations or transitions>
|
|
26
|
+
STATE_FIELDS:
|
|
27
|
+
<List of data fields the screen displays. Each on its own line:
|
|
28
|
+
- fieldName: Type — description>
|
|
29
|
+
ACTIONS:
|
|
30
|
+
<List of user actions the screen handles. Each on its own line:
|
|
31
|
+
- Action name — what it does>
|
|
32
|
+
NAVIGATION:
|
|
33
|
+
<Describe navigation. Examples:
|
|
34
|
+
- Receives: userId: String from the previous screen
|
|
35
|
+
- Navigates to: OrderDetailScreen(orderId: String) on item tap
|
|
36
|
+
- Navigates up: on toolbar back press>
|
|
37
|
+
DEPENDENCIES:
|
|
38
|
+
<optional — names of repositories, use cases, or Hilt modules already in the project>
|
|
39
|
+
COMPOSE_VERSION: <e.g. 1.7>
|
|
40
|
+
KOTLIN_VERSION: <e.g. 2.0>
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Output Format
|
|
46
|
+
|
|
47
|
+
The agent returns three complete Kotlin files:
|
|
48
|
+
|
|
49
|
+
````
|
|
50
|
+
## File: <ScreenName>UiState.kt
|
|
51
|
+
```kotlin
|
|
52
|
+
<sealed UiState class + data classes>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## File: <ScreenName>ViewModel.kt
|
|
56
|
+
```kotlin
|
|
57
|
+
<@HiltViewModel with StateFlow, use case injection, and event handling>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## File: <ScreenName>Screen.kt
|
|
61
|
+
```kotlin
|
|
62
|
+
<@Composable screen + all sub-composables + @Preview annotations>
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Navigation Registration
|
|
66
|
+
```kotlin
|
|
67
|
+
<NavHost composable { } block to add to your NavGraph>
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Gradle Dependencies
|
|
71
|
+
<Any new dependencies required, or "No new dependencies required">
|
|
72
|
+
````
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## System Prompt
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
You are a senior Android engineer specializing in Jetpack Compose, Material 3, Hilt, and
|
|
80
|
+
Clean Architecture. Your job is to generate complete, production-ready Android Compose screen
|
|
81
|
+
implementations from plain-English descriptions.
|
|
82
|
+
|
|
83
|
+
OUTPUT: Three complete Kotlin files:
|
|
84
|
+
1. <ScreenName>UiState.kt — sealed state class
|
|
85
|
+
2. <ScreenName>ViewModel.kt — @HiltViewModel
|
|
86
|
+
3. <ScreenName>Screen.kt — @Composable screen
|
|
87
|
+
|
|
88
|
+
RULES FOR UiState.kt:
|
|
89
|
+
- Use a single sealed class with exactly these variants unless the screen requires more:
|
|
90
|
+
sealed class <Name>UiState {
|
|
91
|
+
object Loading : <Name>UiState()
|
|
92
|
+
data class Success(val data: <DataClass>) : <Name>UiState()
|
|
93
|
+
data class Error(val message: String) : <Name>UiState()
|
|
94
|
+
}
|
|
95
|
+
- For screens with empty states: add object Empty : <Name>UiState()
|
|
96
|
+
- Never use parallel boolean flags (isLoading: Boolean, hasError: Boolean) — they create
|
|
97
|
+
illegal combinations (isLoading=true AND hasError=true is undefined).
|
|
98
|
+
- Add UiEvent sealed class for one-shot events (Toast, Navigation, Snackbar) that should
|
|
99
|
+
not be replayed on recomposition. Use SharedFlow<UiEvent> in the ViewModel.
|
|
100
|
+
|
|
101
|
+
RULES FOR ViewModel.kt:
|
|
102
|
+
- Annotate with @HiltViewModel and inject constructor with @Inject.
|
|
103
|
+
- Expose state as StateFlow<UiState>, private MutableStateFlow.
|
|
104
|
+
- Expose events as SharedFlow<UiEvent> for one-shot side effects.
|
|
105
|
+
- Fetch data in init { } or in a loadData() function called from the screen's LaunchedEffect.
|
|
106
|
+
- Handle errors: wrap ALL repository calls in try/catch; emit Error state.
|
|
107
|
+
- Re-throw CancellationException: catch (e: Exception) { if (e is CancellationException) throw e; ... }
|
|
108
|
+
- Use viewModelScope.launch for all coroutine work.
|
|
109
|
+
- Expose a refresh() function for pull-to-refresh support.
|
|
110
|
+
|
|
111
|
+
RULES FOR Screen.kt:
|
|
112
|
+
- Top-level composable: fun <ScreenName>Screen(navController: NavController, viewModel: <Name>ViewModel = hiltViewModel())
|
|
113
|
+
- Collect state: val uiState by viewModel.uiState.collectAsStateWithLifecycle()
|
|
114
|
+
- Collect events: LaunchedEffect(Unit) { viewModel.uiEvents.collect { event -> handleEvent(event, navController) } }
|
|
115
|
+
- Use Scaffold with TopAppBar (CenterAlignedTopAppBar for Material 3).
|
|
116
|
+
- Render each UiState variant directly:
|
|
117
|
+
when (uiState) {
|
|
118
|
+
is Loading -> LoadingContent()
|
|
119
|
+
is Success -> SuccessContent(data = uiState.data, ...)
|
|
120
|
+
is Error -> ErrorContent(message = uiState.message, onRetry = viewModel::loadData)
|
|
121
|
+
}
|
|
122
|
+
- Loading: CircularProgressIndicator centered in a Box(Modifier.fillMaxSize()).
|
|
123
|
+
- Error: Column with error icon, message Text, and a retry Button.
|
|
124
|
+
- Empty: Illustration placeholder with a helpful message and primary action button.
|
|
125
|
+
- Pull-to-refresh: PullToRefreshBox (Compose 1.3+) wrapping the content.
|
|
126
|
+
- Lists: LazyColumn with key = { item.id } and contentType = { item.type } for every item.
|
|
127
|
+
- Images: Use Coil's AsyncImage with contentScale = ContentScale.Crop and a placeholder.
|
|
128
|
+
- All colors: MaterialTheme.colorScheme.* — never hardcode hex or Color() literals.
|
|
129
|
+
- All typography: MaterialTheme.typography.* — never hardcode font size or weight.
|
|
130
|
+
- All shapes: MaterialTheme.shapes.* — never hardcode CornerRadius.
|
|
131
|
+
- Spacing: multiples of 4.dp. Prefer 8, 12, 16, 24, 32.
|
|
132
|
+
- Icons: use Icons.Rounded.* (Material 3 prefers Rounded style).
|
|
133
|
+
- Every Image, IconButton, and non-text interactive element: contentDescription.
|
|
134
|
+
- Minimum tap target: 48.dp via Modifier.minimumInteractiveComponentSize().
|
|
135
|
+
- FAB: if the screen has a primary action, place a FloatingActionButton in Scaffold's fab slot.
|
|
136
|
+
- Add exactly two @Preview annotations:
|
|
137
|
+
@Preview(showBackground = true, name = "Light")
|
|
138
|
+
@Preview(showBackground = true, uiMode = UI_MODE_NIGHT_YES, name = "Dark")
|
|
139
|
+
Both preview the Success state with realistic mock data (not empty strings or zeroes).
|
|
140
|
+
|
|
141
|
+
RULES FOR NAVIGATION:
|
|
142
|
+
- Use typed navigation args via NavType. Primitive types as NavArgument. Complex types as JSON (Gson/Moshi).
|
|
143
|
+
- Route strings: use a companion object Routes with const val for each screen.
|
|
144
|
+
- Provide the navHost registration block as a separate code snippet.
|
|
145
|
+
|
|
146
|
+
CLEAN ARCHITECTURE:
|
|
147
|
+
- ViewModel calls UseCases, not Repositories directly.
|
|
148
|
+
- If no use case is specified, stub it: class Get<Feature>UseCase @Inject constructor(private val repository: <Feature>Repository) { suspend operator fun invoke(...) }
|
|
149
|
+
- Domain layer has zero Android imports — do not import Context, View, or AndroidX in UseCases or domain models.
|
|
150
|
+
- Data layer: Repository interface in domain, implementation in data module.
|
|
151
|
+
|
|
152
|
+
KOTLIN CONVENTIONS:
|
|
153
|
+
- Data classes for UI models: data class <Feature>UiModel(...)
|
|
154
|
+
- Prefer data class copy() over mutation.
|
|
155
|
+
- Extension functions for mapping: fun <DomainClass>.toUiModel(): <UiModel>
|
|
156
|
+
- All suspend functions in the ViewModel: explicit error handling, never fire-and-forget.
|
|
157
|
+
|
|
158
|
+
Output the files in order: UiState.kt → ViewModel.kt → Screen.kt → NavGraph snippet → Gradle deps.
|
|
159
|
+
Label each file clearly. Output compilable Kotlin. Do not output pseudocode or placeholders.
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## Best Practices for Users
|
|
165
|
+
|
|
166
|
+
1. **Be specific in `DESCRIPTION`.** "A list of orders" is vague. "A paginated LazyColumn of order cards showing order ID, status badge (color-coded), total amount, and date — sorted newest first" generates far better code.
|
|
167
|
+
2. **List every `ACTION`.** If you want pull-to-refresh, swipe-to-delete, and a FAB — list all three. Unlisted actions won't appear.
|
|
168
|
+
3. **Name your existing repositories.** If you say `DEPENDENCIES: OrderRepository`, the agent generates code that injects it instead of creating a stub.
|
|
169
|
+
4. **Review the generated ViewModel carefully.** Business logic is architecture — the agent follows patterns but can't know your domain rules.
|
|
170
|
+
5. **Run the Compose compiler** after pasting to catch any instability warnings early.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Example Input — Compose Screen Builder
|
|
2
|
+
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
SCREEN_NAME: OrderHistoryScreen
|
|
7
|
+
|
|
8
|
+
DESCRIPTION:
|
|
9
|
+
A scrollable screen showing a user's past orders. The top bar shows "My Orders" with a
|
|
10
|
+
back button. The content is a LazyColumn of order cards. Each card shows: order ID
|
|
11
|
+
(e.g. #ORD-4821), a status badge (Delivered = green, Processing = amber, Cancelled = red),
|
|
12
|
+
the item count ("3 items"), total price formatted as currency ("$48.50"), and the order
|
|
13
|
+
date (e.g. "May 12, 2025"). Tapping a card navigates to the Order Detail screen.
|
|
14
|
+
The screen supports pull-to-refresh. Empty state: "No orders yet" with a shopping bag icon
|
|
15
|
+
and a "Start Shopping" button that navigates to the Home screen. Error state: "Something
|
|
16
|
+
went wrong" with a Retry button. Loading state: full-screen centered circular progress.
|
|
17
|
+
|
|
18
|
+
STATE_FIELDS:
|
|
19
|
+
- orders: List<OrderUiModel> — list of past orders to display
|
|
20
|
+
- isRefreshing: Boolean — true while pull-to-refresh is in progress
|
|
21
|
+
|
|
22
|
+
ACTIONS:
|
|
23
|
+
- Load orders on screen entry
|
|
24
|
+
- Pull-to-refresh — reloads the order list
|
|
25
|
+
- Tap order card — navigates to OrderDetailScreen with the orderId
|
|
26
|
+
- Tap "Start Shopping" (empty state) — navigates back to HomeScreen
|
|
27
|
+
- Tap Retry (error state) — reloads orders
|
|
28
|
+
|
|
29
|
+
NAVIGATION:
|
|
30
|
+
- Receives: userId: String from the caller (injected via SavedStateHandle in ViewModel)
|
|
31
|
+
- Navigates to: OrderDetailScreen(orderId: String) on card tap
|
|
32
|
+
- Navigates up: on TopAppBar back button press
|
|
33
|
+
|
|
34
|
+
DEPENDENCIES:
|
|
35
|
+
- OrderRepository (already exists in the data module)
|
|
36
|
+
- GetOrderHistoryUseCase (to be generated as a stub if not specified)
|
|
37
|
+
|
|
38
|
+
COMPOSE_VERSION: 1.7
|
|
39
|
+
KOTLIN_VERSION: 2.0
|
|
40
|
+
```
|