{"data":{"slug":"github-thedaviddias-front-end-checklist-skills-defer-async-18c8adf03dab","title":"Optimize Script Loading with defer, async, or type=module","summary":"Improve page load performance by correctly using defer, async, and type=module attributes in script tags. This includes ensuring scripts in the <head> are marked with defer or async, and that scripts at the bottom of the <body> are moved to the <head> with defer when appropriate.","url":"https:\/\/skillshunter.net\/skills\/github-thedaviddias-front-end-checklist-skills-defer-async-18c8adf03dab","json_url":"https:\/\/skillshunter.net\/api\/public\/v1\/skills\/github-thedaviddias-front-end-checklist-skills-defer-async-18c8adf03dab","markdown_url":"https:\/\/skillshunter.net\/skills\/github-thedaviddias-front-end-checklist-skills-defer-async-18c8adf03dab.md","download_url":"https:\/\/skillshunter.net\/skills\/github-thedaviddias-front-end-checklist-skills-defer-async-18c8adf03dab\/download","category":{"slug":"software-development","name":"Software & Development"},"editor_note":"Ensure scripts in the <head> are marked with defer or async. For ES modules, use type=module. Scripts at the bottom of the <body> that could be moved to the <head> with defer should be flagged for optimization.","instructions":"---\nname: defer-async\ndescription: \"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.\"\nmetadata:\n  category: html\n  priority: high\n  difficulty: beginner\n  estimatedTime: \"15\"\n  source: frontendchecklist.io\n  url: https:\/\/frontendchecklist.io\/rules\/html\/defer-async\n---\n\n# Load scripts with defer, async, or type=module\n\nA plain &lt;script&gt; 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.\n\n## Quick Reference\n\n- defer downloads in parallel and executes after HTML parsing, in order \u2014 use for most scripts\n- async downloads in parallel and executes immediately when ready \u2014 use for independent scripts\n- type=module always defers and enables ES module syntax\n- Never place scripts in <head> without defer or async\n\n## Check\n\nFind 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.\n\n## Fix\n\nAdd defer or async to script tags in the document head, or convert to type=module where ES modules are used.\n\n## Explain\n\nExplain the difference between defer, async, and type=module script loading, and when to use each.\n\n## Code Review\n\nReview 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.\n\n---\n\nFor full implementation details, code examples, and framework-specific guidance,\nsee `references\/rule.md`.\n\nRule page: https:\/\/frontendchecklist.io\/rules\/html\/defer-async\n","use_cases":["Reviewing HTML templates for script loading attributes","Auditing server-rendered HTML for script optimization","Checking shared components for script tag compliance"],"limitations":[],"compatibility":[],"setup_tip":null,"sample_input":null,"sample_output":null,"source_url":"https:\/\/github.com\/thedaviddias\/Front-End-Checklist\/blob\/e8d14d049010e2ce25afcd5e8609dfcbbe63e47e\/skills\/defer-async\/SKILL.md","source_commit":"e8d14d049010e2ce25afcd5e8609dfcbbe63e47e","license":null,"version":null,"listing_approved_at":"2026-11-23","created_at":"2026-11-22T15:50:46.000000Z","updated_at":"2026-11-23T04:54:56.000000Z","seo_title":"Optimize Script Loading with defer async type=module","seo_description":"Learn how to use defer, async, and type=module to improve script loading and page performance.","seo_keywords":["optimize script loading","defer async type=module","script tag optimization","html performance","script loading attributes"]}}