defer-async
できること
このスキルは、Webページ のHTMLでスクリプトがどのように読み込まれているかを確認します。ページをより速く表示させたい開発者向けです。
使う場面
- ✓スクリプトのダウンロード中に、ページが白い画面のままになるとき。
- ✓ページのheadにあるscriptタグが、最初の表示を遅くしているとき。
- ✓遅い回線でも、ページが早く表示され始めるようにしたいとき。
スキルのリンク
https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/defer-async/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“読み込みを遅くしないように、私のページのscriptタグを確認してもらえますか?”
毎週5つの新しいスキル。1分で読めます。
仕組み
エージェントは、ページの表示を妨げるscriptタグを見つけ、安全な場合にdeferまたはasyncを追加します。適したスクリプトは、moduleのタイプに切り替えることもできます。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
Load scripts with defer, async, or type=module
A plain <script> tag in the document head blocks all HTML parsing until the script downloads, parses, and executes. On a slow network this can add seconds of white-screen time before any content renders. defer and async allow the browser to continue parsing HTML while the script downloads, reducing Time to First Contentful Paint dramatically.
Quick Reference
- defer downloads in parallel and executes after HTML parsing, in order — use for most scripts
- async downloads in parallel and executes immediately when ready — use for independent scripts
- type=module always defers and enables ES module syntax
- Never place scripts in <head> without defer or async
Check
Find all script tags in this HTML file. Flag any in the <head> without defer or async, and any at the bottom of <body> that could be in <head> with defer.
Fix
Add defer or async to script tags in the document head, or convert to type=module where ES modules are used.
Explain
Explain the difference between defer, async, and type=module script loading, and when to use each.
Code Review
Review templates, server-rendered HTML, and shared components that output markup related to Load scripts with defer, async, or type=module. Flag exact elements, attributes, and routes where the rendered HTML violates the rule.
For full implementation details, code examples, and framework-specific guidance,
see references/rule.md.
Rule page: https://frontendchecklist.io/rules/html/defer-async
よくある質問
deferとasyncの違いは何ですか?
deferは、ページを読み終えた後で順番にスクリプトを実行します。asyncは、各スクリプトが届き次第、順番を決めずに実行します。
どちらを使うべきですか?
ほとんどのスクリプトにはdeferを、互いに独立したスクリプトにはasyncを勧めています。
フレームワークのサイトにも当てはまりますか?
ソースのテンプレートだけでなく、ブラウザが受け取る最終的なHTMLを確認するよう、このスキルは述べています。
詳細
作者による元の説明
Use when reviewing templates, rendered HTML, or shared components related to Load scripts with defer, async, or type=module. Validate the final browser-facing markup, not just the source framework abstraction.
人気
- GitHubのスター
- 75k
- ランキング
- #2812
- ライセンス
- 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 において、パフォーマンスの最適化、状態管理、ベストプラクティスの遵守を行います。