KS
Killer-Skills

compose-preview — how to use compose-preview how to use compose-preview, compose-preview setup guide, jetpack compose preview, material 3 android app, compose-preview alternative, compose-preview vs jetpack compose, compose-preview install, what is compose-preview

v1.0.0
GitHub

About this Skill

Perfect for Android Development Agents utilizing Jetpack Compose and Material 3 for advanced UI previewing. compose-preview is a tool for creating previews of Jetpack Compose functions, utilizing @Preview annotations and Material 3 design.

Features

Creates previews for Jetpack Compose functions using @Preview annotations
Supports Material 3 design for Android apps
Utilizes Jetpack Compose for building native Android apps
Allows customization of preview names using the 'name' parameter
Enables grouping of previews using the 'group' parameter

# Core Topics

heddxh heddxh
[0]
[0]
Updated: 3/6/2026

Quality Score

Top 5%
30
Excellent
Based on code quality & docs
Installation
SYS Universal Install (Auto-Detect)
Cursor IDE Windsurf IDE VS Code IDE
> npx killer-skills add heddxh/NeoDB-You/compose-preview

Agent Capability Analysis

The compose-preview MCP Server by heddxh is an open-source Categories.community integration for Claude and other AI agents, enabling seamless task automation and capability expansion. Optimized for how to use compose-preview, compose-preview setup guide, jetpack compose preview.

Ideal Agent Persona

Perfect for Android Development Agents utilizing Jetpack Compose and Material 3 for advanced UI previewing.

Core Value

Empowers agents to generate previews for Jetpack Compose functions, utilizing annotations like @Preview and integrating with Material 3 for enhanced UI design, all within the native Android app NeoDB.

Capabilities Granted for compose-preview MCP Server

Generating previews for custom composable functions
Debugging UI components with Material 3
Creating themed previews with AppTheme

! Prerequisites & Limits

  • Requires NeoDB and Android development environment
  • Specific to Jetpack Compose and Material 3
Project
SKILL.md
3.9 KB
.cursorrules
1.2 KB
package.json
240 B
Ready
UTF-8

# Tags

[No tags]
SKILL.md
Readonly

Compose Preview

为 Jetpack Compose 函数创建预览。

基本用法

kotlin
1@Preview 2@Composable 3private fun XxxPreview() { 4 AppTheme { 5 Xxx() 6 } 7}

@Preview 注解参数

参数说明示例
name预览名称@Preview(name = "Dark Mode")
group分组名称@Preview(group = "Buttons")
widthDp宽度 (dp)@Preview(widthDp = 320)
heightDp高度 (dp)@Preview(heightDp = 640)
showBackground显示背景@Preview(showBackground = true)
backgroundColor背景色 (ARGB Long)@Preview(backgroundColor = 0xFFFFFFFF)
showSystemUi显示系统 UI@Preview(showSystemUi = true)
device设备规格@Preview(device = "id:pixel_5")
uiModeUI 模式@Preview(uiMode = Configuration.UI_MODE_NIGHT_YES)
locale语言@Preview(locale = "zh-rCN")
fontScale字体缩放@Preview(fontScale = 1.5f)
wallpaper壁纸@Preview(wallpaper = Wallpapers.GREEN_DOMINATED_EXAMPLE)

Multipreview 注解

创建自定义多预览注解以复用配置:

kotlin
1@Preview(name = "Light", uiMode = Configuration.UI_MODE_NIGHT_NO) 2@Preview(name = "Dark", uiMode = Configuration.UI_MODE_NIGHT_YES) 3annotation class ThemePreviews 4 5@Preview(name = "Phone", device = "spec:width=411dp,height=891dp") 6@Preview(name = "Tablet", device = "spec:width=1280dp,height=800dp,dpi=240") 7annotation class DevicePreviews

使用:

kotlin
1@ThemePreviews 2@DevicePreviews 3@Composable 4private fun MyComponentPreview() { 5 AppTheme { 6 MyComponent() 7 } 8}

设备规格

预定义设备

  • id:pixel_5, id:pixel_fold, id:pixel_tablet
  • id:wearos_small_round, id:wearos_large_round

自定义规格

kotlin
1@Preview(device = "spec:width=411dp,height=891dp,dpi=420") 2@Preview(device = "spec:width=1280dp,height=800dp,orientation=landscape")

项目约定

  1. Preview 函数命名: XxxPreviewPreviewXxx
  2. 使用 AppTheme: 始终用 AppTheme { } 包裹预览内容
  3. 私有函数: Preview 函数应为 private
  4. Mock 数据: 使用假数据填充预览,不依赖 ViewModel
  5. 放置位置: 在同一文件中,放在被预览组件下方

工作流程

  1. 找到需要预览的 Composable 函数
  2. 分析其参数,确定需要的 mock 数据
  3. 在函数下方创建 Preview 函数
  4. NeoDBYouTheme 包裹
  5. 根据需要添加多个 @Preview 变体(亮/暗主题、不同尺寸等),大多数情况下Preview不需要参数。

示例

简单组件预览

kotlin
1@Composable 2fun Greeting(name: String, modifier: Modifier = Modifier) { 3 Text(text = "Hello $name!", modifier = modifier) 4} 5 6@Preview(showBackground = true) 7@Composable 8private fun GreetingPreview() { 9 AppTheme { 10 Greeting("Android") 11 } 12}

状态变体预览

kotlin
1@Preview(name = "Empty") 2@Preview(name = "Loading") 3@Preview(name = "Content") 4@Composable 5private fun MyScreenPreview() { 6 AppTheme { 7 // 根据需要展示不同状态 8 } 9}

亮暗主题预览

kotlin
1@PreviewLightDark 2@Composable 3private fun CardPreview() { 4 AppTheme { 5 MyCard(title = "Sample", content = "Preview content") 6 } 7}

Related Skills

Looking for an alternative to compose-preview or building a Categories.community AI Agent? Explore these related open-source MCP Servers.

View All

widget-generator

Logo of f
f

widget-generator is an open-source AI agent skill for creating widget plugins that are injected into prompt feeds on prompts.chat. It supports two rendering modes: standard prompt widgets using default PromptCard styling and custom render widgets built as full React components.

149.6k
0
Design

chat-sdk

Logo of lobehub
lobehub

chat-sdk is a unified TypeScript SDK for building chat bots across multiple platforms, providing a single interface for deploying bot logic.

73.0k
0
Communication

zustand

Logo of lobehub
lobehub

The ultimate space for work and life — to find, build, and collaborate with agent teammates that grow with you. We are taking agent harness to the next level — enabling multi-agent collaboration, effortless agent team design, and introducing agents as the unit of work interaction.

72.8k
0
Communication

data-fetching

Logo of lobehub
lobehub

The ultimate space for work and life — to find, build, and collaborate with agent teammates that grow with you. We are taking agent harness to the next level — enabling multi-agent collaboration, effortless agent team design, and introducing agents as the unit of work interaction.

72.8k
0
Communication