migrate-xml-views-to-jetpack-compose
O que ela faz
Esta skill orienta a conversão de um único layout XML legado de um app Android para o Jetpack Compose. Mantém a aparência igual e verifica o resultado antes de remover o XML antigo. É para desenvolvedores Android que modernizam telas antigas.
Quando usar
- ✓Quando você tem uma tela Android antiga feita com views XML e quer essa tela no Jetpack Compose.
- ✓Quando você quer escolher qual layout XML é o melhor candidato para migrar primeiro.
- ✓Quando você precisa de um plano e de verificações visuais para que a nova tela em Compose combine com a antiga.
Link da skill
https://github.com/android/skills/blob/main/jetpack-compose/migration/migrate-xml-views-to-jetpack-compose/SKILL.mdCopie e cole na sua IA (Claude, ChatGPT ou Cursor) pedindo para seguir as instruções.
Como usar
O jeito mais fácil: copie a mensagem e cole na sua IA. Ela lê a skill e segue as instruções.
Mensagem pronta para colar
Para Claude Code, Codex ou Cursor: rode na pasta do projeto e a skill fica instalada.
Baixe o SKILL.md e coloque na pasta de skills do seu agente.
Exemplo do que pedir para a IA
“Migre a minha tela de configurações de views XML para o Jetpack Compose e mantenha a mesma aparência.”
5 skills novas por semana. 1 minuto de leitura.
Como funciona
A skill percorre um processo de dez passos, desde a escolha e a análise do layout até a configuração do Compose e do tema. Ela captura a tela antiga, constrói a versão em Compose, verifica visualmente, depois substitui os usos antigos e remove o XML.
Conteúdo técnico (SKILL.md original)
Texto original do autor, em inglês, direto do GitHub.
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
- Identify the optimal XML candidate for migration
- Analyze the project and layout
- Create a plan
- Capture the XML View UI
- Set up Compose dependencies and compiler
- Set up Compose theming
- Migrate the XML layout to Compose
- Validate the migration
- Replace usages
- 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.
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 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.
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. 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 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.
- To add Views in Compose, use Views in Compose.
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 remo
Perguntas frequentes
Ela migra o app inteiro de uma vez?
Não. Migra um layout XML por vez, e você pode escolher o layout ou deixar a skill escolher um.
Como ela verifica o resultado?
Ela captura a tela antiga e compara a nova tela em Compose com ela para confirmar a paridade visual.
Ela muda a lógica do app?
Não. A skill migra apenas a interface do usuário.
Detalhes
Descrição original do autor
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.
repo: android/skills
Popularidade
- Estrelas no GitHub
- 10 mil
- Posição no ranking
- #11922
- Licença
- Apache-2.0
- Atualizada em
- 29/10/2026
Comentários
- …
Mais skills deste repositório
agp-9-upgrade
10 milAjuda seu agente a atualizar um app Android para o Android Gradle Plugin 9 e resolver suas mudanças incompatíveis. Não serve para projetos multiplataforma.
camerax
10 milAjuda seu agente a criar recursos de câmera no Android com o CameraX, incluindo gravação de vídeo, controles de hardware, ML Kit e efeitos do Media3.
android-for-cars-parked-apps
10 milAjuda seu agente a adaptar um app Android de vídeo, jogo ou navegador para rodar como app estacionado no Android Auto e no Android Automotive.
appfunctions
10 milAjuda seu agente a encontrar fluxos de trabalho principais de um app Android e expô-los como AppFunctions que agentes de IA e comandos de voz podem executar.
Skills parecidas
android-clean-architecture
280 milFaz seu agente organizar projetos Android de forma eficiente. Ele estrutura o código para facilitar a manutenção e o desenvolvimento de novos recursos.
compose-multiplatform-patterns
280 milAjuda seu agente a usar Compose Multiplatform e Jetpack Compose em projetos KMP. Cobre estado, navegação, temas e performance.
dart-flutter-patterns
280 milFaz seu agente escrever código para apps Dart e Flutter. Ele usa padrões modernos para criar apps robustos e fáceis de gerenciar.