import-on-visibility
できること
このスキルは、長いページやフィードで、見えるようになる前に読み込まれる重いセクションを確認します。コンテンツの多いページを作る開発者向けです。
使う場面
- ✓長いページで、ほとんどの訪問者がスクロールしないグラフやレビューを読み込んでいるとき。
- ✓フィードやダッシュボードが、遠くにあるパネルのコードを送っているとき。
- ✓重いセクションが現れて、スクロールがかくつくとき。
スキルのリンク
https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/import-on-visibility/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“レビューのセクションを、訪問者がスクロールして近づいたときだけ読み込むようにしてもらえますか。”
毎週5つの新しいスキル。1分で読めます。
仕組み
エージェントは、先に読み込まれてしまう画面外のコンポーネントを見つけ、Intersection Observer を使って、表示領域に近づいたら読み込むことを提案します。レイアウトがずれないようにプレースホルダーも提案します。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
Load non-critical code when content approaches the viewport
Many pages ship JavaScript for offscreen sections that a user may never reach. Import-on-visibility keeps the initial route lighter while still loading content early enough to feel ready when users scroll to it.
Quick Reference
- Use Intersection Observer to start loading code before an offscreen section becomes visible
- Reserve space with placeholders or skeletons so deferred sections do not cause layout shift
- Tune
rootMarginso heavy content loads early enough without competing with above-the-fold work - Use this for charts, reviews, related products, embeds, and offscreen dashboards
Check
Identify components, widgets, or modules that load on first render even though they only appear after the user scrolls. Flag which ones can switch to visibility-based loading.
Fix
Use Intersection Observer or an equivalent framework primitive to load the offscreen component or dependency when it approaches the viewport, while preserving layout stability and a clear placeholder.
Explain
Explain import-on-visibility, how it differs from import-on-interaction, and how viewport-based loading helps large pages stay fast.
Code Review
Inspect scroll-triggered sections, embeds, charts, recommendation modules, and long landing pages. Flag code that is bundled eagerly even though the corresponding UI stays offscreen until later, and verify the deferred version still loads before the user reaches it.
For full implementation details, code examples, and framework-specific guidance,
see references/rule.md.
Rule page: https://frontendchecklist.io/rules/performance/import-on-visibility
よくある質問
Intersection Observer とは何ですか?
要素が表示領域に近づいたり、入ったりしたときにそれを知らせる、ブラウザの機能です。
クリックで読み込む方法とはどう違いますか?
これは、セクションが画面に近づいたときにコードを読み込みます。クリックで読み込む方法は、訪問者の操作を待ちます。
なぜプレースホルダーを使うのですか?
遅延されたセクションがレイアウトのずれを起こさないように、レイアウトを安定させるためだとこのスキルは説明しています。
詳細
作者による元の説明
Use when reviewing long pages, dashboards, or content feeds with expensive offscreen modules. Balance early enough loading for smooth scrolling against keeping the initial route light.
人気
- GitHubのスター
- 75k
- ランキング
- #2889
- ライセンス
- 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 において、パフォーマンスの最適化、状態管理、ベストプラクティスの遵守を行います。