Skip to main content

Kotlin Jetpack Compose Design Patterns

Master Jetpack Compose patterns: state management, navigation, theming, accessibility, and performance optimization for Android.

Vul de plaatshouders in

Edit the values, then copy your finished prompt.

Jouw Prompt
prompt.txt

                                

What this prompt does

This prompt scaffolds a modern Android app in Jetpack Compose using current design patterns. It moves through six steps: setting up a layered architecture, implementing state management, building type-safe navigation, creating a Material 3 design system, applying accessibility practices, and optimizing recomposition performance. The result is a coherent foundation where screens stay stateless and predictable as the app grows, which is what keeps a multi-module project from drifting into spaghetti.

The variables tailor the scaffold to your project. [architecture_pattern] and [dependency_injection] set the structural backbone, [module_count] defines the multi-module layout, and [state_approach] decides how UI state flows. [screen_count] and [nav_graph_count] shape the navigation graph, [brand_name] and [font_family] drive theming, [touch_target_size] enforces accessibility minimums, and [profiling_tool], [image_library], and [frame_budget] govern the performance pass. Each variable maps to a concrete decision you would otherwise make ad hoc on day one.

When to use it

  • You are starting a native Android app and want a Compose architecture decided up front.
  • You need a stateless-screen, hoisted-state pattern instead of logic scattered in composables.
  • You want type-safe navigation across [screen_count] screens and nested graphs.
  • You are building a Material 3 theme with light, dark, and dynamic color support.
  • You want accessibility handled deliberately rather than retrofitted before launch.
  • You need a concrete plan for hunting unnecessary recompositions and hitting a frame budget.

Example output

Expect a module structure for a multi-module project, a BaseViewModel exposing UI state via StateFlow and one-time events via SharedFlow, and a sealed UiState with Loading/Success/Error variants. From there you get a type-safe navigation graph with bottom navigation and deep linking, a Material 3 theme definition with light/dark color schemes and a typography scale, reusable composable components, accessibility annotations, and a recomposition-optimization checklist. It is a mix of architecture description and Kotlin code spread across the presentation, domain, and data layers, with the state-hoisting pattern applied so that screens receive state plus event callbacks rather than owning logic themselves.

Pro tips

  • Match [architecture_pattern] and [state_approach] to your team's experience; MVI with StateFlow is powerful but adds ceremony for small apps, so weigh the overhead against the size of the project.
  • Set [module_count] to reflect real feature boundaries, not an arbitrary number, so the module graph stays meaningful.
  • Make sure [screen_count] and [nav_graph_count] are consistent with the flows you actually have, including auth and onboarding back-stack handling.
  • Keep [touch_target_size] at the platform minimum or above; accessibility scanners flag anything smaller.
  • Use [profiling_tool] early and feed real findings back into the prompt; recomposition wins come from removing wasted work, not adding code.
  • Pick an [image_library] you already use so lazy loading integrates cleanly with your existing build and caching setup.

Frequently Asked Questions

Does this assume a specific architecture or can I choose?
You choose via `[architecture_pattern]` and `[state_approach]`. The default is Clean Architecture with MVI and `StateFlow`, but you can swap in MVVM or another pattern. The prompt then structures the presentation, domain, and data layers to match your selection.
Will it handle dark mode and Material You dynamic color?
Yes. Step 4 builds a Material 3 theme with light and dark color schemes and ensures components support dynamic color on Android 12 and above. You set `[brand_name]` and `[font_family]` to control the palette and typography scale.
How does it address Compose performance?
Step 6 uses `[profiling_tool]` to find unnecessary recompositions and applies `remember`, `derivedStateOf`, and `key` strategically, plus lazy image loading via `[image_library]`. The target is keeping transitions under your `[frame_budget]`, though real results depend on profiling your own screens.
Is accessibility actually covered or just mentioned?
Step 5 is dedicated to it: content descriptions, merged semantics for clickable containers, custom accessibility actions, a minimum `[touch_target_size]`, and TalkBack navigation order, with a pass through the Accessibility Scanner. It is treated as implementation work, not an afterthought.
Engr Mejba Ahmed

Need this built for real?

Engr Mejba Ahmed

AI Developer · Software Engineer

I'm Mejba — I design and ship production AI systems, automations, and full-stack apps. If you want this turned into a working solution for your team, let's talk.

Meer in Mobile App Development Prompts

Engr Mejba Ahmed

Engr Mejba Ahmed

Claude Code Expert · Online

👋

Hey there!

Quick Actions

WhatsApp Instant reply

Chat on WhatsApp

+880 1723 741224 · Instant reply

Popular Questions

Engr Mejba Ahmed is connected
Engr Mejba Ahmed is typing...
Engr Mejba Ahmed avatar

✉ Want me to follow up? Drop your email

Engr Mejba Ahmed avatar

📞 Connect Directly

Choose how you'd like to reach me

WhatsApp

+880 1723 741224

Email

[email protected]

✓ Details sent! I'll get back to you shortly.

Powered by OpenAI

335+

Blog Posts

25

AI Courses

63

Projects

Services & Expertise

Pricing & Process

Learning & Resources

Connect & Support