astro-images

Enforce Astro Image and Picture components with image.domains configuration.

Updated Apr 8, 2024
One-click install
npx skills add https://github.com/tumes/dotfiles-nvim --skill astro-images-tumes
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: astro-images
Source: https://github.com/tumes/dotfiles-nvim/tree/main/claude/skills/astro-images
Command: npx skills add https://github.com/tumes/dotfiles-nvim --skill astro-images-tumes

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill enforces the use of Astro image components (Image and Picture) and remote-image caching to replace direct <img> usage and ensure optimization.

Core Features & Use Cases

  • Enforces responsive images with <Picture /> for different viewports and automatic formats
  • Encourages fixed-size images with <Image /> for icons and logos
  • Uses image() in content collections to enable caching and optimization for local and remote images
  • Guides migrations to Astro with clear, repeatable patterns

Quick Start

Replace all <img> tags with Astro's Image or Picture components and configure image.domains in your Astro config to enable remote-image optimization.

Frequently Asked Questions about astro-images

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

FAQPage Schema
How do I optimize remote images in Astro?

To optimize remote images in Astro, you must configure the image.domains array in your Astro config file. This enables the framework to fetch, cache, and process remote images using its built-in Image or Picture components.

When should I use the Astro Picture component instead of Image?

Use the Astro Picture component for responsive images requiring different viewports and automatic formats. Use the Image component for fixed-size images like icons and logos where responsive scaling is unnecessary.

How do I enable image optimization inside Astro content collections?

To enable image optimization inside Astro content collections, use the image() helper function within your collection schema. This allows Astro to process and cache both local and remote images defined in your frontmatter.

What is the best way to migrate standard HTML img tags to Astro?

The best way to migrate standard HTML img tags to Astro is to replace them with Astro's Image or Picture components. This enforces best practices by automatically handling optimization, caching, and responsive formats.

Does Astro require domain whitelisting for remote image optimization?

Yes, Astro requires domain whitelisting for remote image optimization. You must explicitly define all external source URLs in the image.domains property of your Astro configuration to allow image processing and caching.

Why are my Astro image components not rendering optimized files?

Astro image components may not render optimized files if image.domains is not configured or if direct <img> tags are used inconsistently. Ensure consistent component usage and proper domain configuration to satisfy optimization best practices.