Saltar al contenido
Skillpedia
Apps móviles10 mil · #11921

jetpack-compose-performance

Qué hace

Esta skill revisa el código de las pantallas de Jetpack Compose en busca de problemas de rendimiento, como demasiados redibujados y fotogramas perdidos. Es para desarrolladores de Android cuya app se siente lenta al desplazarse o al abrir pantallas.

Cuándo usarla

  • ✓Cuando una pantalla de Android con Compose se entrecorta o pierde fotogramas al desplazarse.
  • ✓Cuando quieres reducir los redibujados innecesarios en tus pantallas de Compose.
  • ✓Cuando quieres configurar los ajustes de compilación de lanzamiento y los perfiles de referencia para acelerar el inicio de la app.

Link de la skill

https://github.com/android/skills/blob/main/jetpack-compose/jetpack-compose-performance/SKILL.md

Cópialo y pégalo en tu IA (Claude, ChatGPT o Cursor) pidiéndole que siga las instrucciones.

Cómo usar

La forma más fácil: copia el mensaje y pégalo en tu IA. Ella lee la skill y sigue las instrucciones.

Mensaje listo para pegar

Usa esta skill para ayudarme: https://github.com/android/skills/blob/main/jetpack-compose/jetpack-compose-performance/SKILL.md Lee el archivo SKILL.md de ese link y sigue sus instrucciones en mi tarea.
¿Quieres que tu IA encuentre skills como esta por sí sola?Instala el MCP gratis de Skillpedia: una línea, y busca entre 15.000+ skills antes de cada tarea.Instalar en 1 minuto →

Ejemplo de qué pedirle a la IA

“Mi lista de Compose se entrecorta al desplazarme. Busca los problemas de rendimiento y corrígelos.”

5 skills nuevas por semana. 1 minuto de lectura.

Cómo funciona

La skill comprueba primero que la compilación use ajustes de lanzamiento, ya que las compilaciones de depuración son lentas para medir. Después revisa cada composable y cada lista con una lista de comprobación y lee notas de referencia antes de proponer una corrección.

Contenido técnico (SKILL.md original)

Texto original del autor, en inglés, directo de GitHub.

Foundational prerequisites

Before micro-optimizing composables, ensure standard production flags are in place:

  1. Release Build: Never profile or benchmark debuggable builds; ART runtime verification severely degrades performance.
  2. R8 Minification: Keep R8 enabled to optimize bytecode and coroutine dispatch.
  3. Baseline Profiles: Generate baseline profiles for critical user journeys (cold start, key scrolling feeds) so the ART VM pre-compiles and preloads classes ahead of time.

Optimization audit workflow

  1. Exhaustive Scan : Scan the target code against all 7 core categories in the following sections. Evaluate every @Composable function, modifier chain, and lazy-layout data model against all checklist rules rather than stopping after the first issue found.
  2. Mandatory Reference Read Before Flagging or Editing : Whenever a file matches a rule in Categories 1--7, you MUST open and read the corresponding references/*.md file for the approved fix pattern and full scope guards before reporting a finding or editing code. Never rely on the summary bullets alone to write fixes.

1. State, snapshots, and stability (references/state-and-stability.md)

MANDATORY : Before flagging or fixing any issue in this category, you MUST read references/state-and-stability.md.

  • Phase Deferral (Lambdas) : Wrap frequently changing state reads in lambdas (such as Modifier.offset or Modifier.graphicsLayer) so reads occur in Layout or Draw phase rather than Composition.
  • Prohibit Backwards Writes (Verify Read-Before-Write Order) : Never modify state in a later phase or after it has already been read in the same composition pass (Read -> Write, or Composition Read -> Layout or Draw Write). Prevent backwards writes across phases to avoid first-frame popping, jank, and infinite recomposition loops (Backwards Write). Do not flag a state assignment at the start of a composable (Write -> Read or Composition Write -> Draw Read) as a backwards write---a backwards write strictly requires a read of that state to precede the write.
  • Avoid Redundant State Wrapping in Composition (Write -> Read) : Do not wrap synchronous values in remember { mutableStateOf(...) } only to overwrite them immediately at the top of composition before reading them (for example, var path by remember { mutableStateOf(Path()) }; path = viewModel.getPath()). While not a backwards write, this adds unnecessary slot table and MutableState snapshot overhead (and risks becoming a backwards write if a read is later added preceding the assignment); use a plain local val or read the value directly inside the target phase (such as Modifier.drawWithCache).
  • Explicit remember Keys & Slot Overhead : Always pass all input variables and composable parameters referenced inside remember as calculation keys. Remember that remember stores keys + 1 objects in the slot table and checks key equality on every recomposition; only remember when allocations are heavy or identity must be preserved. Do not pass snapshot state values/properties (e.g. state.value) as keys when wrapping derivedStateOf (passing the State instance itself is fine if the instance reference can change).
  • computedStateOf vs derivedStateOf (Compose 1.13+) : On Compose 1.13+, use computedStateOf for simple condition checks and filtered state from fast-changing inputs (such as scrollState.value > 0), which provides significantly faster invalidation than derivedStateOf (on Compose < 1.13, use remember { derivedStateOf { ... } }). Reserve derivedStateOf for heavy calculations that benefit from multi-read caching, or trivial calculations read frequently enough per composition (roughly 10 / numberOfStatesReadPerCalculation times without invalidating between reads) to make up for the invalidation cost.
  • Synchronous State Derivation : Audit for asynchronous produceState + snapshotFlow blocks observing Compose states (such as scroll positions or collection sizes); replace them with synchronous remember { derivedStateOf { ... } } (or computedStateOf on Compose 1.13+).
  • Trivial Primitives : Prefer plain custom Kotlin getters (get()) over derivedStateOf or computedStateOf for simple boolean expressions and property lookups.
Preguntas frecuentes

¿Debo medir el rendimiento en una compilación de depuración?

No. La skill indica que las compilaciones de depuración van más lentas que el uso real, así que mide en una compilación de lanzamiento.

¿Qué es un perfil de referencia?

Es un archivo que indica a Android qué código preparar por adelantado, para que los recorridos clave como el inicio y el desplazamiento vayan más rápido.

¿Reescribe toda la pantalla?

No. Busca problemas concretos según su lista de comprobación y propone correcciones específicas para cada uno que encuentra.

Detalles

Descripción original del autor

Diagnose and optimize Android Jetpack Compose UI code. Use this skill when analyzing performance bottlenecks of existing code to minimize recomposition overhead and prevent dropped frames and UI lag.

repo: android/skills

Popularidad

Estrellas en GitHub
10 mil
Posición en el ranking
#11921
Licencia
Apache-2.0
Actualizada
29/10/2026

¿Te sirve esta skill?

0

Entra para votar.

Comentarios

  • …

Más skills de este repositorio

Skills parecidas