coil-compose

Integrate Coil image loading into Jetpack Compose with AsyncImage and state handling.

Updated Dec 4, 2025
One-click install
npx skills add https://github.com/thinhtt264/Snaplet-App --skill coil-compose
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: coil-compose
Source: https://github.com/thinhtt264/Snaplet-App/tree/main/.cursor/skills/coil-compose
Command: npx skills add https://github.com/thinhtt264/Snaplet-App --skill coil-compose

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Coil-based image loading in Jetpack Compose can be verbose and error-prone without a guiding pattern. This Skill provides the recommended approach to loading images from URLs, handling loading states, and applying transformations with Coil for a smooth, efficient user experience.

Core Features & Use Cases

  • AsyncImage: Primary composable for most scenarios with automatic size resolution and standard parameters.
  • rememberAsyncImagePainter: Use when a Painter is required (e.g., Canvas or Icon) or when you need to observe load state manually.
  • SubcomposeAsyncImage: When a custom slot API is needed to render different states (Loading, Success, Error).
  • Performance & Best Practices: Use a single ImageLoader, enable crossfade, and set proper contentScale to avoid oversized loads.
  • Use Case: Load a user avatar from a URL with a placeholder and error fallback within a list item.

Quick Start

Use AsyncImage with a sample URL and placeholder to immediately render an image in a Compose screen.

Frequently Asked Questions about coil-compose

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

FAQPage Schema
How do I load images from a URL in Jetpack Compose?

Load images from a URL in Jetpack Compose using the Coil AsyncImage composable for automatic size resolution and standard parameters, ensuring efficient rendering without verbose boilerplate.

What is the best way to handle loading states for async images in Compose?

Handle loading states for async images in Compose using SubcomposeAsyncImage to render different states like Loading, Success, and Error through a custom slot API, or manually observe states with rememberAsyncImagePainter.

When should I use rememberAsyncImagePainter instead of AsyncImage?

Use rememberAsyncImagePainter instead of AsyncImage when a Painter object is required for Canvas or Icon composables, or when you need to manually observe the image load state.

How do I optimize Coil image loading performance in Compose?

Optimize Coil image loading performance in Compose by using a single singleton ImageLoader, enabling crossfade animations, and setting proper contentScale to avoid oversized image loads.

Does Coil work with Jetpack Compose for rendering user avatars in lists?

Yes, Coil works with Jetpack Compose to render user avatars in lists by using AsyncImage with a sample URL, placeholder, and error fallback within list items for a smooth user experience.