什么是skill
AI Coding时代skill可以提升开发体验,skill是可复用提示词,帮助AI大模型理解当前工程的注意点
官网链接
https://github.com/android/skills
例:升级AGP9和迁移compose
SKILL.md
--- name: agp-9-upgrade description: Upgrades, or migrates, an Android project to use Android Gradle Plugin(AGP)version9. Do not use this skillformigrating Kotlin Multiplatform(KMP)projects. license: Complete termsinLICENSE.txt metadata: author: Google LLC keywords: - Android Gradle Plugin9- AGP9- AGP Upgrade - AGP Migration - New AGP DSL - Migrate to built-in Kotlin ---## Migration guideSee the[AGP9migration guide](references/android/build/releases/agp-9-0-0-release-notes.md)forthe major changes, many breaking,inAGP9compared to AGP8.## RequirementsIf the user requests to update or migrate to AGP9, first check the AGP version usedinthe project. If it is lower than9, stop and ask the user to run the AGP Upgrade AssistantinAndroid Studio to update to the latest stable version of AGP, and confirm when done. The user may also request that this requirement be skipped;ifthis is the case, you should update the version of AGP to the latest stable version as part of the AGP9migration. See the[AGP9migration guide](references/android/build/releases/agp-9-0-0-release-notes.md)forhow todothis. Each version of AGP has its ownsetof compatibilities with other tools, such as Gradle, JDK, and Kotlin. The release notesforeach of these versions will include a **Compatibility** table indicating the minimum versionsforthese tools. Do not use this skillforKMP projects, as they are unsupported.## StepsIf AGP is already at9or higher,thendothe following:### Step 1: Update dependenciesIf KSP(`com.google.devtools.ksp`)is usedinthe project, ensure it is on version2.3.6 or higher. If Hilt is usedinthe project, ensure it is on version2.59.2 or higher.### Step 2: Migrate to built-in KotlinSee[the guide](references/android/build/migrate-to-built-in-kotlin.md)fordetailed information.### Step 3. Migrate to the new AGP DSLSee[the guide](references/android/build/releases/agp-9-0-0-release-notes.md)fordetailed information. See also[gradle-recipes](references/recipes.md)forexamples on how to migrate old code to code that is compatible with AGP9and the new DSL.### Step 4. Migrate kapt to KSP or legacy-kaptIf KSP(`com.google.devtools.ksp`)or kapt(`org.jetbrains.kotlin.kapt`)are usedinthe project, see[KSP, kapt, and legacy-kapt](references/ksp-kapt.md)fordetailed migration steps.### Step 5. BuildConfigIf any Android module contains custom BuildConfig fields, see[BuildConfig](references/buildconfig.md)fordetailed information.### Step 6. Update gradle.propertiesAfter the migration, check gradle.properties. Remove the following flags:1. android.builtInKotlin2. android.newDsl3. android.uniquePackageNames4. android.enableAppCompileTimeRClass Additionally, delete all temporary files you've created. ## Guidelines - Never write or run python scripts. - Only search the Gradle dependency cache when inspecting external dependencies, and only as a last resort. - Never add `android.disallowKotlinSourceSets=false` to `gradle.properties`. - When verifying changes, don't run the`clean`task. This is a waste of time.## VerificationAfter migration, verify the following:1. Gradle IDEsyncsucceeds.2.`./gradlewhelp`succeeds.3.`./gradlew build --dry-run`succeeds.## TroubleshootingPaparazzi v2.0.0-alpha04 and lower versions have issues with AGP9. See[references/paparazzi-gradle-9.md](references/paparazzi-gradle-9.md)fordetails.--- name: migrate-xml-views-to-jetpack-compose description: Provides a structured workflowformigrating 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 Composeinan Android project. It solves the problem of converting the UI of a legacy XML View into modern, declarative Compose componentswhilemaintaining interoperability. license: Complete termsinLICENSE.txt metadata: author: Google LLC 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.## ObjectiveTo systematically convert a single legacy XML layout into modern, declarative Jetpack Compose UIwhilemaintaining pixel-perfect visual parity and functional integrity.## Summary of the 10-step migration process1. **Identify the optimal XML candidateformigration**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 migrationIf the user has explicitly specified a target XML layout, proceed to Step2. Otherwise, analyze the codebase to identify the best candidateformigration by following the logicin[references/identify-optimal-xml-candidate.md](references/identify-optimal-xml-candidate.md).### Step 2: Analyze the project and layoutAnalyze 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 planUsing the outputs and analysisdoneinthe Step1and2, generate a step-by-step planforthe migration. If you support user interaction, present to the user and askforapproval before proceeding. If user interaction is not supported, proceed to Step4following 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 referenceforthe layout migrationinStep7. **ELSE IF** you are able to run an Android emulator,locatean existing screenshottestforthe 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 screenshottestwith minimum required setup. Run thetestand take a baseline screenshot of the XML UI. **ELSE** proceed to Step5.### Step 5: Set up Compose dependencies and compilerCheck`build.gradle`or`libs.versions.toml`forCompose dependencies and compiler setup. If missing, use[Setup Compose Dependencies and Compiler](references/android/develop/ui/compose/setup-compose-dependencies-and-compiler.md). Run asyncto ensure dependencies resolve without errors.### Step 6: Set up Compose themingIf the project already has Compose themingsetup, proceed to Step7. If Compose theming is missing, initialize it. For Material-based projects, follow[Material3migration 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 requiredforthe specific XML candidate. Maintain original XML themesforinteroperability. Maintain existing project code conventions, patterns, names and values.### Step 7: Migrate the XML View to ComposeConvert the XML candidate to Jetpack Compose code, referencing[references/xml-layout-migration.md](references/xml-layout-migration.md)and the image from Step4. You must include a **Compose Preview**forthe newly created composable to facilitate visual verification.### Step 8: Replace usagesReplace the usages of the migrated XML layout to use the new Compose component. - ToaddComposeinViews, use[ComposeinViews](references/android/develop/ui/compose/migrate/interoperability-apis/compose-in-views.md). - ToaddViewsinCompose, use[ViewsinCompose](references/android/develop/ui/compose/migrate/interoperability-apis/views-in-compose.md).### Step 9: Validate the migrationCompare the baseline screenshot image from Step4with the rendered Compose Preview of the new composable. Ignore string content;focus on layout and styling. Iterate on the Compose codeuntilvisual parity is achieved. Once verified,writea Compose UItestforthe new composable.### Step 10: XML code removalDelete the migrated XMLfileand its associated legacy tests. **Caution:** Only remove code and resources that are not referenced by other parts of the project.ref:
https://mp.weixin.qq.com/s/TEyjsoYktfvFQJzwfedPAw