# /migrate-xml-views-to-jetpack-compose: Convert one XML layout to Compose with visual parity

Source: https://trendhub.net/skills/android-skills/migrate-xml-views-to-jetpack-compose
Skill folder: https://github.com/android/skills/tree/main/jetpack-compose/migration/migrate-xml-views-to-jetpack-compose
Pack: Android Skills (https://trendhub.net/skills/android-skills)
Works with: Android CLI (detected agents), Claude Code, Codex

This skill moves a single XML layout to Jetpack Compose through a fixed ten-step process. The agent picks or confirms a candidate, studies it, writes a plan, captures how the old screen looks, sets up only the Compose dependencies and theming it needs, rebuilds the layout with a preview, swaps call sites through interop APIs, compares against the baseline and then removes the unused XML.

## When to use it

- You are adopting Compose screen by screen in a View-based app.
- You want help choosing which XML layout to migrate first.
- You need the new composable to look the same as the old view.

## How it works

1. **Pick and analyse**: The agent uses the user's choice or finds the best candidate, then audits its hierarchy and project context.
2. **Plan and capture**: It writes a plan for approval and gets a baseline image, either from the user or from a screenshot test run on an emulator.
3. **Set up minimally**: Compose dependencies are added if missing, and only the theming this layout needs is ported, leaving XML themes in place.
4. **Rebuild and swap**: The layout is rewritten in Compose with a preview, and call sites use Compose-in-Views or Views-in-Compose interop.
5. **Validate and clean up**: The preview is compared with the baseline until they match, a Compose UI test is written and unreferenced XML is deleted.

## What it steers the agent away from

- Migrating the whole app theme for one screen.
- Deleting resources that other parts of the project still use.
- Shipping a composable that has never been compared with the original.

## What it can touch

It edits Gradle files, Kotlin and XML layouts, may create and run screenshot tests on an emulator, and deletes the migrated XML once nothing references it.

## Pairs well with

- `/adaptive`
- `/navigation-3`
- `/testing-setup`

## Questions

### Does it migrate logic too?

No. The skill states it migrates the UI only, from XML to Compose.

### Can it run without user interaction?

Yes. When interaction is not supported it follows its own plan and uses an emulator screenshot test for the baseline if it can run one.
