Skip to content
Back to skills

Astro Images

ASecurity

Use astro:assets for all images. This enables automatic optimization

  • 18 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 4, 2026
code-qualitydebugging

Security analysis

A100/100

Scanned September 4, 2026

npx -y skills add majiayu000/claude-skill-registry-data --skill astro-images --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Astro Images?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Astro Images
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/majiayu000-astro-images-claude-skill-registry-data/badge)](https://www.skillsdirectory.com/skills/majiayu000-astro-images-claude-skill-registry-data)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: astro-images
description: Use astro:assets for all images. This enables automatic optimization
  (resizing, WebP/AVIF conversion, lazy loading).
---

# Astro Image Optimization

Use `astro:assets` for all images. This enables automatic optimization (resizing, WebP/AVIF conversion, lazy loading).

## When to Use This Skill

Use this skill when:
- Adding images to `.astro` or `.mdx` files
- Moving images from `/public` to optimized assets
- Debugging 404s or unoptimized images in production

## Rules

- **Never use raw `<img>` tags** in `.astro` or `.mdx` files
- **Never reference images from `/public`** — bypasses optimization
- **Always import images** from `src/assets/`

## Correct Pattern

```astro
---
import { Image } from "astro:assets";
import photo from "../assets/photo.png";
---

<Image src={photo} alt="Description" width={800} />
```

## In MDX

```mdx
---
import { Image } from "astro:assets";
import diagram from "../../assets/diagram.png";
---

<Image src={diagram} alt="Diagram" width={600} />
```

## Linting

Run `npm run lint:assets` to catch violations. The linter flags:

- Raw `<img>` tags in `.astro` and `.mdx` files (error)
- Markdown images from `/public` like `![](/image.png)` (warning)
- Direct `/src/` paths in link/script tags (error)

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…