搜索

PythonReactSEOPDF
GitHub Skill

android-compose-creator

Generate Android/Kotlin Multiplatform code using Jetpack Compose and Compose Multiplatform (CMP). Use when: (1) Creating new Compose UI components, (2) Building screens with Compose, (3) Implementing state management in Compose, (4) Writing Compose Multiplatform shared UI, (5) Reviewing or refactoring Compose code, (6) Any Android/KMP UI development task. Triggers: "compose", "android ui", "kotlin multiplatform", "CMP", "jetpack compose", "composable", "@Composable", "Material3", "screen", "component".

shoheikawano☆ 3 仓库 Stars0 仓库 Forks

安装与使用

请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。

查看来源 ↗使用指南

技能说明

Android Compose Creator

Orchestrator for Compose Multiplatform code generation. Can delegate to specialized sub-skills.

Coding Standards

MANDATORY: This skill follows kotlin-compose-standards. All generated code MUST comply with these standards:

  • Trailing comma EXCEPT for Modifier arguments
  • Parameter order: required → Modifier → optional
  • Modifier passed last when calling composables
  • Each Modifier method on its own line
  • New line at end of file

Sub-Skills

Skill When to Delegate
/compose-state-generator ViewModel, UiState, StateFlow patterns
/compose-test-generator UI tests, screenshot tests

Workflow

  1. Analyze request - UI only? Needs ViewModel? Needs tests?
  2. Check existing code - Match project patterns
  3. Generate/delegate:
    • Simple UI component → generate inline
    • Screen with state → invoke /compose-state-generator then generate UI
    • Tests requested → invoke /compose-test-generator
  4. Verify - Run build if requested

Quick Reference

Composable Function Naming
// DO: PascalCase for UI-emitting composables
@Composable
fun ProfileCard(user: User, modifier: Modifier = Modifier) { }

// DO: camelCase for value-returning composables
@Composable
fun rememberProfileState(): ProfileState { }
Standard Parameter Order
@Composable
fun Component(
    // 1. Required parameters
    title: String,
    onClick: () -> Unit,
    // 2. Modifier parameter
    modifier: Modifier = Modifier,
    // 3. Optional parameters with defaults
    enabled: Boolean = true,
) { }
State Hoisting Pattern
// Stateless (preferred for reusability)
@Composable
fun Counter(
    count: Int,
    onIncrement: () -> Unit,
    modifier: Modifier = Modifier,
) { }

// Stateful wrapper
@Composable
fun Counter(modifier: Modifier = Modifier) {
    var count by remember { mutableStateOf(0) }
    Counter(
        count = count,
        onIncrement = { count++ },
        modifier = modifier  // Modifier last when calling, no trailing comma
    )
}

References

Load these based on the task:

File When to Read
composables.md Writing any composable function
state-management.md State, remember, side effects
architecture.md Screen architecture, ViewModel integration
performance.md Optimizing recomposition, lazy lists
multiplatform.md CMP expect/actual, platform-specific code
testing.md Writing UI tests for composables

Core Principles

  1. Unidirectional Data Flow - State flows down, events flow up
  2. Single Source of Truth - One owner for each piece of state
  3. Composition over Inheritance - Small, focused composables
  4. Modifier as Last Parameter - Always accept and apply Modifier
  5. Stateless by Default - Hoist state to callers when possible

使用示例

查看来源仓库中的使用示例与配置说明。

查看来源 ↗

来源历史

收录时间
2026-01-20
索引更新时间
2026-01-26
Branch
main

收录与同步日期属于本站记录。源码修改历史请查看来源仓库。

GitHub ↗

chat Comments (0)

chat_bubble_outline

No comments yet. Be the first to share your thoughts!