offscreen-lazy
できること
このスキルは、ページの画像タグを確認し、画面の外にある画像に遅延読み込みを追加します。上部の主要な画像は即座に読み込まれたままにします。最初の読み込みを速くしたい制作者向けです。
使う場面
- ✓多くの画像を一度に読み込む遅いページを速くするようエージェントに頼むとき。
- ✓長いページで、訪問者がスクロールしないかもしれない写真を大量にダウンロードしているとき。
- ✓画像のマークアップを確認し、ヒーロー画像を誤って遅延読み込みにしていないか確かめたいとき。
スキルのリンク
https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/offscreen-lazy/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“私の長い商品ページは一度に画像を読み込みすぎます。画面の下側にある画像に遅延読み込みを追加してください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
エージェントは各画像のタグを確認し、最初の画面より下にある画像にネイティブの遅延読み込み属性を追加します。ヒーロー画像は即時読み込みのままにし、レイアウトのずれを防ぐためにwidthとheightの属性を提案します。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
Lazy load offscreen images
Lazy loading eliminates unnecessary image downloads on initial page load. A page with 20 images below the fold may transfer several megabytes of data that users who don't scroll will never see. Deferring these downloads reduces Time to Interactive, improves LCP for above-fold content, and saves bandwidth—particularly impactful for users on metered mobile connections.
Quick Reference
- Add
loading="lazy"to all<img>elements below the fold - Never lazy-load the LCP image (hero, first product image)—use
fetchpriority="high"instead - Always pair
loading="lazy"withwidthandheightattributes to prevent CLS - Native
loading="lazy"has universal support in all modern browsers—no JavaScript polyfill needed - If fold position is unclear from the snippet, do not invent a lazy-loading defect
Check
Scan all <img> elements in this codebase. Identify: 1) Any <img> elements below the fold (not in the first viewport) that are missing loading="lazy". 2) Any <img> elements marked loading="lazy" that appear to be above the fold (hero images, first product images, logos in headers). 3) Any <img> with loading="eager" below the fold. Report the above-fold images that should NOT have lazy loading separately from below-fold images that should have it. If fold position cannot be inferred from the snippet, do not report missing lazy loading as a defect.
Fix
For images that should use lazy loading: 1) Add loading="lazy" to all <img> elements that appear below the fold. 2) Remove loading="lazy" from any hero, logo, or first-visible image—these should load immediately. 3) Ensure all lazy-loaded images have explicit width and height attributes to prevent CLS. 4) For the LCP image specifically, add fetchpriority="high" and remove loading="lazy". Show the corrected HTML for each modified image.
Explain
Explain how native browser lazy loading works. The loading="lazy" attribute tells the browser to defer image download until the image is within a browser-defined distance from the viewport (typically 1250px on a slow connection). This reduces the data transferred on initial load, lowers Time to Interactive, and saves bandwidth for users who never scroll to those images. Browser support is universal in modern browsers. The critical caveat: never lazy-load the LCP image—it must load as fast as possible.
Code Review
Review image assets, markup, and delivery configuration related to Lazy load offscreen images. 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/offscreen-lazy
よくある質問
ヒーロー画像を遅延読み込みにすべきではないのはなぜですか?
最も大きく見える要素であることが多く、遅く読み込むと主要なコンテンツが遅くなるため、このスキルはそれにfetchpriorityをhighにするよう提案しています。
これにJavaScriptのライブラリは必要ですか?
いいえ。このスキルによると、ネイティブの遅延読み込みはすべての主要なブラウザーで対応しており、ポリフィルは不要です。
画像が画面外かどうか分かりにくい場合はどうしますか?
このスキルは、画像が明らかに画面外か重要でない場合を除き、遅延読み込みの欠如を報告しないよう勧めています。
詳細
作者による元の説明
Use when reviewing image assets, markup, and CDN or build transforms related to Lazy load offscreen images. Check encoded size, rendered size, loading strategy, and above-the-fold impact together. Missing `loading='lazy'` is only a valid finding when you can reasonably tell the image is offscreen or non-critical.
人気
- GitHubのスター
- 75k
- ランキング
- #2958
- ライセンス
- MIT
- 更新日
- 2026/10/31
コメント
- …
このリポジトリの他のスキル
frontendchecklist
75kコマンドラインツールを使って、フロントエンドのコードとライブページを、アクセシビリティ、速度、SEO、セキュリティに関する380以上のルールと照らし合わせて確認します。
frontend-checklist-global
75kフロントエンドのプロジェクトを、386のFront-End Checklistのルールすべてと照らし合わせて監査し、見つかった問題ごとに具体的な修正方法を示します。
404-page
75k見つからないページの画面に役立つリンクがあり、本物の404ステータスを返すかを確認し、迷った訪問者が目的のページを見つけられるようにします。
about-page
75kサイトの運営者が誰かを説明する、分かりやすいAboutページがあるかを確認し、訪問者と検索エンジンからの信頼を高めます。
似ているスキル
angular-developer
280kエージェントがAngularのコードを作成し、プロジェクト構成についてアドバイスできるようにします。新しいプロジェクトの開始、コード部品の作成、パフォーマンスやアクセシビリティの改善に役立ちます。
frontend-a11y
280kエージェントが Web インターフェースを誰にとっても使いやすくするよう支援します。スクリーンリーダーやキーボード操作に対応し、サイトやアプリが適切に動作するようにします。
frontend-patterns
280kエージェントがフロントエンド開発の最新パターンを適用できるようにします。React と Next.js において、パフォーマンスの最適化、状態管理、ベストプラクティスの遵守を行います。