import-on-interaction
できること
このスキルは、誰も使う前から読み込まれている重い機能を、ページのコードで確認します。初回の読み込みを速くしたい開発者向けです。
使う場面
- ✓チャットウィジェットや地図が、ほとんど使われないのに毎回の訪問で読み込まれているとき。
- ✓誰も開いていないエディターや書き出しのツールが、最初の読み込みに含まれているとき。
- ✓初期のコードのバンドルが、最初の表示に必要なサイズよりずっと大きいとき。
スキルのリンク
https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/import-on-interaction/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“チャットウィジェットを、訪問者がクリックして開いたときだけ読み込むようにしてもらえますか。”
毎週5つの新しいスキル。1分で読めます。
仕組み
エージェントは、クリック、フォーカス、ホバーの後でしか必要ない機能を見つけ、動的な import で読み込むことを提案します。読み込み中も、すぐにフィードバックを表示することを提案します。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
Load non-critical code on user interaction
Users should not pay the download, parse, and execution cost for features they may never use. Import-on-interaction shrinks initial JavaScript, reduces main-thread work during page load, and keeps the first view focused on content that matters immediately.
Quick Reference
- Move non-essential code behind clicks, focus, hovers, or explicit user actions
- Use dynamic import() so the code is absent from the initial route bundle
- Show immediate UI feedback while the deferred chunk loads
- Use this for chat widgets, editors, maps, filters, and export flows that are not needed on first paint
Check
Inspect this route or component for heavy modules, widgets, or third-party scripts that load on first render but are only needed after a user clicks, focuses, hovers, or opens a panel.
Fix
Move the non-critical dependency behind a user-triggered dynamic import(), add immediate loading feedback, and ensure the initial render still works without the deferred feature.
Explain
Explain import-on-interaction, why it improves initial performance, and which features are safe to defer until the user shows intent.
Code Review
Inspect event handlers, modal triggers, drawers, editors, maps, export actions, and third-party widgets. Flag code that is included in the initial bundle even though it is only needed after a user interaction, and verify the fix keeps the initial path lighter without degrading the triggered flow.
For full implementation details, code examples, and framework-specific guidance,
see references/rule.md.
Rule page: https://frontendchecklist.io/rules/performance/import-on-interaction
よくある質問
動的な import とは何ですか?
最初のページの読み込みではなく、必要になったときだけコードを読み込む仕組みです。
どの機能を遅らせても安全ですか?
チャットウィジェット、エディター、地図、フィルター、書き出しの流れなど、最初の表示に必要ないものを挙げています。
その機能がなくてもページは動きますか?
はい。最初の描画は、遅延された機能がなくても動くべきだとこのスキルは説明しています。
詳細
作者による元の説明
Use when reviewing slow initial loads caused by optional features. Prioritize code that is expensive to download or execute and not required for the first viewport, first input, or core task completion.
人気
- GitHubのスター
- 75k
- ランキング
- #2888
- ライセンス
- 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 において、パフォーマンスの最適化、状態管理、ベストプラクティスの遵守を行います。