本文へスキップ
Skillpedia
WebサイトとUI(フロントエンド)75k · #2812

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がスキルを読んで指示に従います。

貼り付け用メッセージ

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

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.

repo: thedaviddias/Front-End-Checklist

人気

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

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

0

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

コメント

  • …

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

似ているスキル