本文へスキップ
Skillpedia
画像とアイコン75k · #2998

responsive-size

できること

このスキルは、各画像の実際の幅と、画面上で表示される幅を比べ、大きすぎる画像を直します。大きな画像のせいでページの読み込みが遅くなっている制作者向けです。

使う場面

  • ✓サイト内で大きすぎる画像を見つけるようエージェントに頼むとき。
  • ✓ページ監査で、画像が必要以上に大きいと報告されたとき。
  • ✓ヒーロー画像が非常に大きいのに、スマートフォンでは小さなコンテナーに表示されているとき。

スキルのリンク

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/responsive-size/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/responsive-size/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“私のサイトの写真の中には、画面に表示される大きさに比べてかなり大きいものがあります。それらを見つけて、小さいバージョンを作ってください。”

毎週5つの新しいスキル。1分で読めます。

仕組み

エージェントは、一般的な画面サイズで各画像の実際の幅と表示幅を比べます。大きすぎる画像については、複数の幅のバージョンを作り、ブラウザーが適切なものを選べるようにsrcsetとsizesを追加します。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

Serve images at the correct display size

A single oversized hero image can add several megabytes to a page load unnecessarily. On mobile devices with 375px screens, serving a 1600px image downloads 4x the data users need. The 'Properly size images' Lighthouse audit consistently identifies this as one of the highest-impact performance opportunities on most websites.

Quick Reference

  • Serving a 1600px image in a 400px container wastes ~16x the necessary bandwidth
  • Use srcset with width descriptors and sizes with actual layout widths
  • The sizes attribute is critical—without it the browser assumes 100vw and picks the largest image
  • Lighthouse 'Properly size images' audit reports estimated savings per oversized image

Check

Audit images in this codebase for oversizing. Use Lighthouse 'Properly size images' audit results as the primary signal. For each <img> in the HTML: 1) Compare the image file's intrinsic width to the element's rendered CSS width (check CSS rules, container constraints). 2) Flag any image where the intrinsic width is more than 2x the rendered width at any common viewport size. 3) Check for srcset usage—images over 200px wide should have srcset variants. 4) Check sizes attribute accuracy—does it reflect the actual CSS layout?

Fix

For each oversized image: 1) Generate multiple size variants: 400w, 800w, 1200w, 1600w (use Sharp or Squoosh). 2) Add srcset listing each variant with its width descriptor. 3) Add a sizes attribute describing the image's display width at each breakpoint (e.g., sizes="(max-width: 600px) 100vw, (max-width: 1200px) 50vw, 400px"). 4) For art direction (different crops), use <picture> with media attributes. 5) For the <img> src fallback, use the medium size (800w). Show complete before/after HTML.

Explain

Explain why serving oversized images wastes bandwidth. If a browser renders an image at 400px wide but the image file is 2000px wide, the browser downloads ~25x more pixel data than it can display (bandwidth scales with pixel count, not linear dimensions). The Lighthouse 'Properly size images' audit estimates potential savings in KiB for each oversized image. The sizes attribute is the key to accuracy—without it, the browser assumes 100vw and downloads the largest srcset candidate even on narrow viewports.

Code Review

Review image assets, markup, and delivery configuration related to Serve images at the correct display size. Flag exact files or components where format choice, sizing, or loading behavior violates the rule, and describe how to confirm the fix in DevTools.


For full implementation details, code examples, and framework-specific guidance, see references/rule.md.

Rule page: https://frontendchecklist.io/rules/images/responsive-size

よくある質問

一般的なサイズのセットはどのようなものですか?

このスキルは、幅400、800、1200、1600ピクセルのバージョンを提案しています。

sizesの属性はなぜ重要ですか?

このスキルによると、これがないと、ブラウザーは画像が画面の全幅を占めると仮定し、最も大きいファイルを選んでしまうからです。

画像のサイズを変えるにはどのツールを使えますか?

このスキルは、バージョンを作るためにSharpやSquooshに触れています。

詳細

作者による元の説明

Use when reviewing image assets, markup, and CDN or build transforms related to Serve images at the correct display size. Check encoded size, rendered size, loading strategy, and above-the-fold impact together.

repo: thedaviddias/Front-End-Checklist

人気

GitHubのスター
75k
ランキング
#2998
ライセンス
MIT
更新日
2026/10/31

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル