compose-preview
БесплатноБез исполняемых скриптовНе проверенInstructions for the Android Compose Preview sidecar, which renders Jetpack Compose @Preview functions with `android preview render` and shows them in the…
от sharkrebel★ 94 звезды на GitHubОб этом скилле
Android Compose Preview Skill
The Android Compose Preview sidecar (plugin android-cli) is a local web server run by android sidecar run compose-preview.
It renders Compose @Preview functions with the android preview render CLI, and shows the result in the Android Compose Preview
pane, one preview below the other. A function can produce several images (one per @Preview annotation, or per value of a
PreviewParameterProvider): the pane shows them side by side. Configuring a new session replaces the previews shown.
Rendering previews
- Agree on what to render. Find the candidate
@Previewfunctions (e.g.grep -rn "@Preview" --include=*.kt <module>, or by running<android_bin> preview list --reference <reference> [--all] [--format=text|json] [-- <build_args>...]inproject_dirusingandroid_binfromGET /api/statusto also discover custom MultiPreview functions) and ask the user which previews to render, and confirm the arguments ofandroid preview render(see Arguments). Do not guess silently when several modules or previews match. - Configure and render with
POST /api/session(see HTTP API), with"wait": trueso you get the result. The sidecar runsandroid preview render; do not run it yourself. - Check the result. If the job
statusisfailed, read itsoutput(build errors, render errors, missing classes), fix the problem, and render again withPOST /api/render. If it iscompleted, tell the user to open the Android Compose Preview pane. You can look at the rendered images yourself: their paths are in the jobimages, and per preview inGET /api/state. - After changing the code of a rendered preview, re-render with
POST /api/renderand"wait": true, only after all your code edits are saved: never start the render in the same batch of parallel tool calls as an edit, or it may build the old code. Fix any render failure. Then tell the user that the pane shows the result, summarizing what you changed.
Arguments
Do not run android preview render (or android preview render --help) yourself. The sidecar runs it, and it may not even be available
in your shell. To check the arguments, configure the session: a wrong reference fails within seconds, and the error is in the job
output (e.g. No supported build system found for path: ...). Fix the arguments and call POST /api/session again.
The sidecar runs, in project_dir, a single command that builds the project once and renders all the previews of the session (or,
if the command line would be too long, several commands one after the other, each with some of the previews):
android preview render [--daemon] [--component-tree] <reference> --fqn <fqn1> --fqn <fqn2>... [-- <build_args>...]
--daemon and --component-tree are settings of the pane (--component-tree on by default, --daemon off by default, see /api/settings). With --daemon, the renderer
keeps running in the background until it is idle for 10 minutes, which makes the next renders faster. With --component-tree, it
writes next to each image a JSON file with its composables (see bounds_url below), which the pane uses to highlight the composable
under the mouse.
reference: the previewable unit,[<system>://]<path>?<target>:<path>is a directory relative toproject_dir(.forproject_diritself) from which the build system is detected;<target>identifies the module or target in that build system: for Gradle, the project path and the build variant,:<project>[@<variant>](e.g.:app@debug,:feature:home@demoDebug). The variant defaults todebug: a module with product flavors has nodebugvariant, so give the full variant name, flavors first (e.g.demoDebug). For Bazel, a label.<system>is the build system name. When it is omitted, the build system is detected from<path>; if that fails, or several build systems match, give it explicitly. Built-in systems:gradle,bazel,soong,lightbuild; the user may have configured custom ones (e.g.blaze).- Examples:
gradle://.?:app@debug,gradle://.?:feature:home@demoDebug,bazel://.?//app/src/main:ui,blaze://.?//java/com/example/ui:ui(google3, withproject_dirthegoogle3directory). - Ask the user if you are not sure which build system or target to use.
fqn: the fully qualified name of a@Previewfunction to render (fqnsin the API): the package, the class containing the function (for a top-level function inHomeScreen.kt, the file classHomeScreenKt), and the function name, e.g.com.example.ui.HomeScreenKt.HomeScreenPreview. The target must contain the files that declare the functions. You can list the available@Preview(and MultiPreview) FQNs in a target without rendering by running `preview list --reference [--all] [--format=text|js
Установить compose-preview в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл compose-preview?
Instructions for the Android Compose Preview sidecar, which renders Jetpack Compose @Preview functions with `android preview render` and shows them in the Android Compose Preview pane. Use it when the user wants to see a Compose preview, or to review the result of UI changes — re-render after changing the code so that the pane shows the result.
Как установить скилл compose-preview?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл compose-preview запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic