К основному содержанию
скилл CX Codex

migrate-xml-views-to-jetpack-compose — скилл для Claude Code

Ведёт миграцию одного XML-экрана Android в Jetpack Compose: от аудита до проверки и удаления устаревшей разметки.

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add android/skills --skill migrate-xml-views-to-jetpack-compose -a claude-code
Открыть на GitHub

Что делает migrate-xml-views-to-jetpack-compose

Скилл разбивает перенос XML View на 10 шагов: выбирает экран, изучает иерархию и проект, составляет план, настраивает зависимости Compose и тему. Затем он переводит разметку в composable, добавляет Compose Preview и заменяет места использования старого layout.

Для визуальной проверки скилл просит скриншот экрана или использует тест снимков в эмуляторе. Если готового теста нет, он предлагает создать его через UI Automator или Espresso. После сравнения с Preview нужно написать Compose UI test.

Тема переносится только в объёме, нужном выбранному экрану, а исходные XML-темы сохраняются для совместимости. Удалять XML и старые тесты можно лишь после проверки ссылок на ресурсы: это повод внимательно проверить проект.

Какие задачи решает

  • перенести один XML layout в Jetpack Compose
  • настроить зависимости и компилятор Compose
  • сопоставить новый интерфейс со снимком исходного экрана
  • подключить Compose к существующим Views
  • удалить неиспользуемую XML-разметку после миграции

Примеры запросов агенту

  • «Перенеси activity_main.xml в Jetpack Compose по этому скиллу.»
  • «Проверь XML-экран и составь план его миграции в Compose.»
  • «Замени использование fragment_profile.xml на composable и проверь внешний вид.»

Как установить migrate-xml-views-to-jetpack-compose

1Через Skills CLI (Vercel)

npx skills add android/skills --skill migrate-xml-views-to-jetpack-compose -a claude-code

2Вручную: положить файлы

~/.claude/skills/migrate-xml-views-to-jetpack-compose/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/migrate-xml-views-to-jetpack-compose/

По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов

Вопросы о migrate-xml-views-to-jetpack-compose

Как установить migrate-xml-views-to-jetpack-compose в Claude Code?

Выполните npx skills add android/skills --skill migrate-xml-views-to-jetpack-compose -a claude-code. Файл скилла будет доступен по пути ~/.claude/skills/migrate-xml-views-to-jetpack-compose/SKILL.md.

Что делает migrate-xml-views-to-jetpack-compose?

Скилл проводит перенос одного XML View в Jetpack Compose по последовательному процессу: анализ, настройка Compose, миграция layout, проверка и очистка XML-кода.

Нужен ли Compose Preview при миграции?

Да. Для созданного composable требуется Compose Preview, чтобы сверить интерфейс с исходным XML-экраном.

Исходный текст

SKILL.md · Apache-2.0
---
name: migrate-xml-views-to-jetpack-compose
description: Provides a structured workflow for migrating an Android XML View to Jetpack
  Compose. This skill details the step-by-step process, from planning and dependency
  setup, to theming and layout migration, validation and XML cleanup. Use this skill
  when you need to migrate an XML View to Jetpack Compose in an Android project. It
  solves the problem of converting the UI of a legacy XML View into modern, declarative
  Compose components while maintaining interoperability.
license: Complete terms in LICENSE.txt
metadata:
  author: Google LLC
  last-updated: '2026-09-18'
  keywords:
  - Jetpack Compose
  - migration
  - XML
  - Views
  - interoperability
  - incremental adoption
  - UI development
---

This skill guides through the process of migrating an existing Android XML View
to Jetpack Compose. It performs a stable, safe and visually consistent
transition by following a structured, 10-step methodology. This skill migrates
UI (XML to Jetpack Compose) only.

## Objective

To systematically convert a single legacy XML layout into modern, declarative
Jetpack Compose UI while maintaining pixel-perfect visual parity and functional
integrity.

## Summary of the 10-step migration process

1. **Identify the optimal XML candidate for migration**
2. **Analyze the project and layout**
3. **Create a plan**
4. **Capture the XML View UI**
5. **Set up Compose dependencies and compiler**
6. **Set up Compose theming**
7. **Migrate the XML layout to Compose**
8. **Validate the migration**
9. **Replace usages**
10. **XML code removal**

## Detailed steps

### Step 1: Identify the optimal XML candidate for migration

If the user has explicitly specified a target XML layout, proceed to Step 2.
Otherwise, analyze the codebase to identify the best candidate for migration by
following the logic in [references/identify-optimal-xml-candidate.md](references/identify-optimal-xml-candidate.md).

### Step 2: Analyze the project and layout

Analyze the identified XML View's structure, hierarchy, and implementation
details.
Use [references/analysis-of-the-project-and-layout.md](references/analysis-of-the-project-and-layout.md) to
guide your technical audit of the layout and surrounding project context.

### Step 3: Create a plan

Using the outputs and analysis done in the Step 1 and 2, generate a
step-by-step plan for the migration. If you support user interaction, present
to the user and ask for approval before proceeding. If user interaction is not
supported, proceed to Step 4 following the generated plan.

### Step 4: Capture the XML View UI

**IF** you support user interaction, ask the user to upload a screenshot of the
XML View UI or provide an absolute path to a file. Use this image as a visual
reference for the layout migration in Step 7.
**ELSE IF** you are able to run an Android emulator, locate an existing
screenshot test for the XML candidate. If none exists, create one using the
existing project testing framework. If no framework exists,
use **UI Automator** or **Espresso** to create a screenshot test with minimum
required setup. Run the test and take a baseline screenshot of the XML UI.
**ELSE** proceed to Step 5.

### Step 5: Set up Compose dependencies and compiler

Check `build.gradle` or `libs.versions.toml` for Compose dependencies and
compiler setup. If missing, use
[Setup Compose Dependencies and Compiler](references/android/develop/ui/compose/setup-compose-dependencies-and-compiler.md).
Run a sync to ensure dependencies resolve without errors.

### Step 6: Set up Compose theming

If the project already has Compose theming set up, proceed to Step 7. If Compose
theming is missing, initialize it. For Material-based projects, follow
[Material 3 migration guidelines](references/android/develop/ui/compose/designsystems/migrate-xml-theme-to-compose.md).
For custom design systems, apply expert judgment to migrate XML theming and
match existing styles.
**Constraints:** Do not migrate the entire theme. Implement only the minimum
theming required for the specific XML candidate. Maintain original XML themes
for interoperability. Maintain existing project code conventions, patterns,
names and values.

### Step 7: Migrate the XML View to Compose

Convert the XML candidate to Jetpack Compose code, referencing
[references/xml-layout-migration.md](references/xml-layout-migration.md) and the image from Step 4.
You must include a **Compose Preview** for the newly created composable to
facilitate visual verification.

### Step 8: Replace usages

Replace the usages of the migrated XML layout to use the new Compose component.

- To add Compose in Views, use [Compose in Views](references/android/develop/ui/compose/migrate/interoperability-apis/compose-in-views.md).
- To add Views in Compose, use [Views in Compose](references/android/develop/ui/compose/migrate/interoperability-apis/views-in-compose.md).

### Step 9: Validate the migration

Compare the baseline screenshot image from Step 4 with the rendered Compose
Preview of the new composable. Ignore string content; focus on layout and
styling. Iterate on the Compose code until visual parity is achieved. Once
verified, write a Compose UI test for the new composable.

### Step 10: XML code removal

Delete the migrated XML file and its associated legacy tests. **Caution:** Only
remove code and resources that are not referenced by other parts of the project.

© Google LLC · Apache-2.0 · android/skills

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

Всё по теме «Мобильная разработка» →
android-jetpack-compose-cursorrules-prompt-file PatrickJS Правило для Cursor, которое задаёт агенту ориентиры по Android-разработке на Jetpack Compose: архитектура, состояние, тесты. ★ 41 011звёзд репо android-jetpack-compose TheBushidoCollective Помогает агенту писать Android-интерфейсы на Jetpack Compose и выбирать паттерны состояния. Пригодится при работе с composable-функциями и ViewModel. CX Codex +1 2 200установок expo-ui-jetpack-compose официальный Expo Team Скилл подсказывает агенту, как писать нативные Android-интерфейсы через @expo/ui/jetpack-compose в приложении Expo. CX Codex GP ChatGPT 1установок compose-multiplatform-patterns affaan-m Скилл подсказывает паттерны Compose Multiplatform и Jetpack Compose для KMP-проектов: состояние, навигация, темы и UI под разные платформы. CX Codex +1 4 600установок compose-animations chrisbanes Помогает выбирать и ревьюить анимации в Jetpack Compose под разные сценарии движения. Пригодится при настройке переходов видимости, смене контента и связывании нескольких свойств. CX Codex +1 1 800установок compose-expert vitorpamplona Скилл с правилами разработки общего UI на Jetpack Compose в проекте Amethyst: навигация, адаптивная вёрстка и ревью компонентов. CX Codex +1 1 400установок

Из того же набора24

navigation-3 Справочник по Jetpack Navigation 3 для агента: миграция с Navigation 2 и готовые рецепты — deep links, несколько back stack, сцены, Hilt, ViewModel. CX Codex +1 3 200установок r8-analyzer Скилл проверяет файлы сборки Android и правила R8 на избыточность и чересчур широкие keep-директивы. Помогает оптимизировать размер приложения при настройке Proguard. CX Codex +1 3 200установок testing-setup Анализирует текущую стратегию тестирования Android-приложения и помогает установить библиотеки, инфраструктуру и фреймворки для unit-тестов, UI-тестов, скриншот-тестов и e2e-тестов. CX Codex +1 2 500установок adaptive Настраивает адаптивный интерфейс Android-приложений на Jetpack Compose под телефоны, планшеты, складные устройства и десктоп. Спасёт при переносе экрана на экраны разных размеров. CX Codex +1 2 400установок styles Ведёт агента по переводу Android-проекта на экспериментальный Jetpack Compose Styles API: зависимости, тема, кастомные компоненты. CX Codex +1 2 200установок play-billing-library-version-upgrade Скилл ведёт Android-проект с устаревшей Google Play Billing Library до актуальной стабильной версии. Он сам находит зависимость в Gradle и проверяет сборку после каждого шага. CX Codex +1 1 900установок android-intent-security Находит уязвимости перенаправления интентов и проверяет настройки компонентов в AndroidManifest.xml и коде приложения. CX Codex +1 1 700установок engage-sdk-integration Ведёт интеграцию Play Engage SDK в Android-приложение: находит вертикаль, собирает классы публикации, правит Gradle и проверяет сборку. CX Codex +1 1 500установок

Спонсоры проекта

Компании, которые помогают держать аналитику открытой