ronjunevaldoz/kmp-agent-skills/kmp-compose-preview-driven-development
Claude Code and agent skill by ronjunevaldoz/kmp-agent-skills
- community
Checking that the SKILL.md file is still in the repository.
Preview-Driven Development (PDD) workflow for KMP: write Content composables first, iterate on Desktop JVM previews (3-5x faster than Android), cover all states with @PreviewParameterProvider, then promote previews directly to Roborazzi screenshot tests.
Install
npx vskill@latest install ronjunevaldoz/kmp-agent-skills/kmp-compose-preview-driven-developmentSKILL.md
The same SKILL.md was published earlier as ronjunevaldoz/kmp-agent-skills/kmp-compose-preview-driven-development.
When to Use This Skill
Use when you need to:
- Build a new Compose UI screen or component
- Iterate quickly on layout and state variations without running a build
- Cover loading/error/empty/success states visually before writing logic
- Set up
@PreviewParameterProviderto test all states in one function - Create a workflow where previews double as Roborazzi golden screenshots
Trigger keywords: preview, PDD, desktop preview, @Preview, PreviewParameterProvider, fast UI iteration, Compose preview, desktop app run, JVM preview, preview workflow.
Freshness rule: Compose Multiplatform desktop preview support evolves — recheck the IntelliJ/Android Studio plugin version needed for interactive Desktop previews.
Recommendation First
Default to Desktop-first previews: write the `Content` composable, add `@Preview` functions targeting the Desktop JVM target, iterate in the IDE without running a build.
Make previews mandatory, not optional:
- every
*Content.ktshould have at least one preview stub - feature UI modules should keep preview files alongside the screen/content code or in a
previews/ sibling folder
- the preview should exercise the states that matter for the screen, not just the happy path
Why Desktop over Android previews:
- JVM only — no
processDebugResources, no D8, no manifest merge - 3–5× faster compilation than the Android target
- Works without a connected device or running emulator
- Same JVM target as Roborazzi screenshot tests — golden images are stable across machines
./gradlew :desktopApp:rungives a live interactive window during development
The Screen/Content split (from kmp-presenter-module) is the technical prerequisite: Content accepts state as a parameter, Screen holds the ViewModel. Previews only need Content.
PDD Cycle
Steps 1–5 happen before any logic is wired — UI shape is validated visually first.
Content Composable Pattern
Key rules:
Contenthas noViewModelparameter — it receives state and a lambda- All user actions go through
onIntent— one callback, not N individual lambdas modifierparameter is the last named arg — standard Compose convention
Preview Functions
Per-state previews (simple)
@PreviewParameterProvider (preferred for many states)
One function, all states — the IDE renders each provider value as a separate frame.
Preview Data Object
Centralise preview data so all previews use consistent models:
Keep PreviewData in the :ui module — it is not needed outside previews.
Desktop Run Cycle
Configure the Desktop entry point in desktopApp/src/jvmMain/kotlin/main.kt:
Promote Previews to Roborazzi
The same @Preview functions become Roborazzi screenshot tests with zero extra test code. See kmp-roborazzi for the Gradle plugin wiring.
Conceptual link:
Related Skills
kmp-presenter-module— the Screen/Content split that makes previews statelesskmp-roborazzi— promotes previews to CI screenshot testskmp-feature-scaffold— the Desktop target must be declared in the feature's:uiconvention pluginkmp-unit-testing— unit tests for the ViewModel; PDD covers the UI layer
Common Anti-Patterns
- putting ViewModel logic into the
Contentcomposable — previews need fixed state; a ViewModel call breaks them - one preview per file instead of
@PreviewParameterProvider— harder to see all states at a glance - skipping the
AppTheme {}wrapper in previews — colors and typography look wrong; always wrap - using Android emulator to verify layout during development — Desktop preview is 3–5× faster
- hardcoding preview data inline — use
PreviewDataobject so all previews stay in sync - shipping a
Contentcomposable without a matching preview stub — that leaves the
preview workflow optional and is exactly how drift sneaks in
- two preview states that render identically (e.g. a separate "Initial" preview next to
"Default" when both pass the same field values) — before adding a new named state, check whether it's visually distinct from an existing one; a preview that duplicates another pixel-for-pixel is noise, not coverage. One preview per genuinely distinct visual state
- a horizontally-scrolling container (
LazyRow, carousel) in a preview with no
Modifier.fillMaxWidth() or explicit width on the container — an unbounded-width scrolling row can collapse to its first item's intrinsic width or render nothing useful in the preview panel; wrap it in a fixed-width Box or set fillMaxWidth() so the preview reflects the real on-screen proportions
If the Desktop preview doesn't render, check that the :ui convention plugin declares jvm() and that the Compose plugin is applied.
Output Style
When asked about UI iteration, previews, or fast Compose development, respond in this order:
- Content composable structure (state param + onIntent lambda)
@PreviewParameterProviderwith all state variants- Desktop run command for live iteration
- how previews promote to Roborazzi
- PreviewData object placement
Changelog
| Date | Change | |
|---|---|---|
| 2026-07-08 | Added 2 anti-patterns from real shadcn-compose bug reports: duplicate preview states that render identically (e.g. "Initial" vs "Default"), and horizontally-scrolling containers previewed with no explicit/fillMaxWidth container width. | |
| 2026-06-18 | Initial release. |
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/kmp-compose-preview-driven-development/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/ronjunevaldoz/kmp-agent-skills/kmp-compose-preview-driven-development)