shekhar23/claude-zero-to-hero-android-kmp/android-image-loading-coil

Claude Code and agent skill by shekhar23/claude-zero-to-hero-android-kmp

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Coil image loading patterns for Android/Compose - async images, placeholders, sizing, caching, transformations, and list performance. Use this skill whenever loading remote or local images, optimizing image-heavy screens, handling loading/error states, or deciding how images should be displayed in Compose. Trigger on phrases like "Coil", "AsyncImage", "image loading", "placeholder", "image cache", "transformations", or "loading avatars/photos".

Install

npx vskill@latest install shekhar23/claude-zero-to-hero-android-kmp/android-image-loading-coil

SKILL.md

Android Image Loading with Coil

Core Principles

  • Load images with explicit sizing whenever possible.
  • Treat image loading as UI infrastructure, not business logic.
  • Prefer simple loading pipelines before adding transformations.
  • Keep loading/error UI states intentional.
  • Optimize for scrolling performance on image-heavy screens.

Default Compose Usage

For most screens, use Coil's Compose integration:

kotlin
AsyncImage(
model = imageUrl,
contentDescription = stringResource(R.string.cd_profile_photo),
modifier = Modifier.size(64.dp),
contentScale = ContentScale.Crop
)

This is appropriate for:

  • avatars
  • thumbnails
  • banners
  • article/product images

Prefer Explicit Image Requests When Needed

Use ImageRequest when behavior should be controlled more precisely:

kotlin
AsyncImage(
model = ImageRequest.Builder(LocalContext.current)
.data(imageUrl)
.crossfade(true)
.build(),
contentDescription = stringResource(R.string.cd_cover_image)
)

Good reasons to use ImageRequest:

  • enable crossfade
  • specify placeholders or error drawables
  • set size or transformations
  • add headers or special cache behavior

Loading and Error States

Screens should define what happens when an image:

  • is loading
  • fails to load
  • is absent entirely

Typical options:

  • placeholder while loading
  • fallback avatar/icon when missing
  • stable error UI when request fails

Avoid blank flashing regions when image state matters to layout clarity.


Size Matters

One of the biggest image mistakes is loading much larger images than the UI needs.

Guidelines:

  • constrain layout size intentionally
  • avoid full-resolution loads for small thumbnails
  • use crop/fit rules that match the design
  • prefer server-provided thumbnail sizes when available

Large, unnecessary decodes hurt memory and scrolling performance.


List Performance

For list/grid screens:

  • keep image composables simple
  • avoid expensive per-item transformations when possible
  • provide stable item keys in lazy lists when appropriate
  • avoid rebuilding complex requests unnecessarily
  • prefer thumbnails in feeds and full images only on detail screens

See the android-compose-ui and android-performance-profiling skills for adjacent list and UI performance guidance.


Content Scale

Choose ContentScale intentionally:

  • Crop for avatars and edge-to-edge cards
  • Fit when the full image must remain visible
  • FillBounds only when distortion is acceptable

Wrong scale choices create visual bugs even when loading succeeds.


Transformations

Use transformations sparingly.

Good uses:

  • circle crop for avatars
  • rounded corners when layout requires bitmap transformation instead of clipping
  • blur only when clearly valuable

Avoid stacking heavy transformations on scrolling lists unless measured.

Often, Compose clipping with shapes is enough and simpler.


Caching

Coil handles memory and disk caching for common cases.

Guidelines:

  • rely on defaults first
  • customize caching only for a clear reason
  • avoid disabling cache casually
  • understand that changing request keys/URLs affects cache reuse

If the same image appears across multiple screens, stable URLs/keys improve cache effectiveness.


Accessibility

Every meaningful image needs a proper contentDescription.

Rules:

  • informative image -> meaningful localized description
  • decorative image -> contentDescription = null
  • do not duplicate nearby visible text unnecessarily

See the android-compose-ui and future accessibility/localization guidance for broader semantics rules.


Previews and Testing

For previews:

  • use stable sample URLs only if preview support is reliable in the project
  • otherwise show placeholder/mock image states

For tests:

  • focus on surrounding UI behavior, not real network image loading
  • verify placeholders, fallback states, and layout behavior

Checklist: Adding Image Loading

  • [ ] Use AsyncImage or explicit ImageRequest intentionally
  • [ ] Define placeholder, fallback, and error behavior
  • [ ] Load images at the size the UI actually needs
  • [ ] Keep list/grid image requests lightweight
  • [ ] Choose ContentScale intentionally
  • [ ] Add meaningful contentDescription or mark decorative images as null

Security

  • Security scanPassed, 90 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/shekhar23/claude-zero-to-hero-android-kmp/android-image-loading-coil/badge)](https://verified-skill.com/skills/shekhar23/claude-zero-to-hero-android-kmp/android-image-loading-coil)

Something wrong with this skill or its page? Tell us.