Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

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от 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

  1. Agree on what to render. Find the candidate @Preview functions (e.g. grep -rn "@Preview" --include=*.kt <module>, or by running <android_bin> preview list --reference <reference> [--all] [--format=text|json] [-- <build_args>...] in project_dir using android_bin from GET /api/status to also discover custom MultiPreview functions) and ask the user which previews to render, and confirm the arguments of android preview render (see Arguments). Do not guess silently when several modules or previews match.
  2. Configure and render with POST /api/session (see HTTP API), with "wait": true so you get the result. The sidecar runs android preview render; do not run it yourself.
  3. Check the result. If the job status is failed, read its output (build errors, render errors, missing classes), fix the problem, and render again with POST /api/render. If it is completed, tell the user to open the Android Compose Preview pane. You can look at the rendered images yourself: their paths are in the job images, and per preview in GET /api/state.
  4. After changing the code of a rendered preview, re-render with POST /api/render and "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 to project_dir (. for project_dir itself) 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 to debug: a module with product flavors has no debug variant, 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, with project_dir the google3 directory).
    • Ask the user if you are not sure which build system or target to use.
  • fqn: the fully qualified name of a @Preview function to render (fqns in the API): the package, the class containing the function (for a top-level function in HomeScreen.kt, the file class HomeScreenKt), 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
Полный SKILL.md на GitHub

Установить 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), без исполняемых скриптов.

Похожие скиллы

Сравнить compose-preview с