Langsung ke konten
Skillpedia
Aplikasi mobile10k · #11922

migrate-xml-views-to-jetpack-compose

Fungsinya

Skill ini memandu konversi satu tata letak XML lama di aplikasi Android menjadi Jetpack Compose. Skill menjaga tampilannya tetap sama dan memeriksa hasilnya sebelum menghapus XML lama. Skill ditujukan bagi pengembang Android yang memodernisasi layar lama.

Kapan dipakai

  • ✓Saat Anda punya layar Android lama yang dibangun dengan view XML dan ingin memindahkannya ke Jetpack Compose.
  • ✓Ketika Anda ingin memilih tata letak XML mana yang paling layak dimigrasikan lebih dulu.
  • ✓Ketika Anda membutuhkan rencana dan pemeriksaan visual agar layar Compose yang baru cocok dengan yang lama.

Link skill

https://github.com/android/skills/blob/main/jetpack-compose/migration/migrate-xml-views-to-jetpack-compose/SKILL.md

Salin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.

Cara pakai

Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.

Pesan siap tempel

Gunakan skill ini untuk membantu saya: https://github.com/android/skills/blob/main/jetpack-compose/migration/migrate-xml-views-to-jetpack-compose/SKILL.md Baca file SKILL.md di link tersebut dan ikuti instruksinya untuk tugas saya.
Mau AI Anda menemukan skill seperti ini sendiri?Pasang MCP Skillpedia gratis: cukup satu baris, dan AI mencari di antara 15.000+ skill sebelum tiap tugas.Pasang dalam 1 menit →

Contoh permintaan ke AI

“Migrasikan layar pengaturan saya dari view XML ke Jetpack Compose dan pastikan tampilannya tetap sama.”

5 skill baru setiap minggu. 1 menit baca.

Cara kerjanya

Skill mengerjakan proses sepuluh langkah, mulai dari memilih dan menganalisis tata letak hingga menyiapkan Compose dan tema. Skill menangkap layar lama, membangun versi Compose, memeriksanya secara visual, lalu mengganti pemakaian lama dan menghapus XML.

Konten teknis (SKILL.md asli)

Teks asli dari pembuat, dalam bahasa Inggris, langsung dari 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

  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.

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.

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

Pertanyaan umum

Apakah ia memigrasikan seluruh aplikasi sekaligus?

Tidak. Ia memigrasikan satu tata letak XML dalam satu waktu, dan Anda bisa memilih tata letaknya atau membiarkan skill yang memilih.

Bagaimana ia memeriksa hasilnya?

Ia menangkap layar lama dan membandingkannya dengan layar Compose yang baru untuk memastikan kesamaan visual.

Apakah ia mengubah logika aplikasi?

Tidak. Skill hanya memigrasikan antarmuka pengguna.

Detail

Deskripsi asli dari pembuat

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

Popularitas

Bintang GitHub
10k
Peringkat
#11922
Lisensi
Apache-2.0
Diperbarui
29/10/2026

Apakah skill ini berguna?

0

Masuk untuk memberi suara.

Komentar

  • …

Skill lain dari repositori ini

Skill serupa