One-click install
npx skills add https://github.com/santimattius/performance-compose-skills --skill compose-animations-santimattius
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: compose-animations
Source: https://github.com/santimattius/performance-compose-skills/tree/main/skills/compose-animations
Command: npx skills add https://github.com/santimattius/performance-compose-skills --skill compose-animations-santimattius

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

It prevents jank and excessive recomposition when implementing animations in Jetpack Compose by moving animation-driven state reads into the correct rendering phase.

Core Features & Use Cases

  • Phase-optimal animation placement: Applies the three-phase model (Composition → Layout → Drawing) to choose the lowest-cost way to animate values.
  • graphicsLayer lambda guidance: Enforces the lambda overload to keep animation ticks out of Composition and recomposition.
  • API selection for animation patterns: Recommends the right tool among animate*AsState, updateTransition, AnimatedVisibility, AnimatedContent, and Animatable based on the interaction/structure of the animation.
  • Performance toolchain recommendations: Guides profiling and reporting practices for release/benchmark builds and identifies instability-related issues from compiler reports.

Quick Start

Use the compose-animations skill to refactor an animation implementation that currently triggers recomposition on every frame by switching to graphicsLayer lambda overloads and choosing the correct animation API for your state transition.

Frequently Asked Questions about compose-animations

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
Why does my Jetpack Compose animation cause recomposition on every frame?

Jetpack Compose animation causes recomposition when animation-driven state reads occur in the composition phase. Moving these state reads into the layout or drawing phase using graphicsLayer lambda overloads prevents the excessive recomposition and frame jank.

How do I animate Jetpack Compose graphicsLayer without triggering recomposition?

To animate Jetpack Compose graphicsLayer without recomposition, use the lambda overload of the modifier. Reading the animated state inside the graphicsLayer lambda defers the read to the drawing phase, skipping composition and layout entirely for smooth performance.

When should I use Animatable versus updateTransition in Jetpack Compose?

Use Animatable with LaunchedEffect for coroutine-driven animation sequences, and use updateTransition for synchronized multi-property state transitions. Choosing the correct API based on interaction structure ensures optimal phase placement and avoids unnecessary recomposition.

Does this Jetpack Compose animation approach work in Compose Multiplatform commonMain?

Yes, this animation approach applies CMP-safe API usage across commonMain and supported targets. It ensures phase-optimal animation placement using graphicsLayer lambda overloads and correct animated sizing modifier ordering without breaking multiplatform compatibility.

What is the best way to profile Jetpack Compose animation performance and identify instability?

The best way to profile Jetpack Compose animation performance is using release and benchmark builds. Checking compiler reports identifies instability-related issues, ensuring that phase-optimal state reads and mandatory animation labels are correctly applied to eliminate jank.

How do I fix frame jank in AnimatedVisibility and AnimatedContent transitions?

Fix frame jank in AnimatedVisibility and AnimatedContent by enforcing phase-optimal state placement. Moving animation state reads to the drawing phase via graphicsLayer lambda overloads and applying correct modifier ordering prevents recomposition during content transitions.