跳到正文
Skillpedia
网站与界面(前端)75k · #3057

third-party-scripts

它能做什么

这项技能检查网页上的外部脚本,例如分析、广告和聊天小组件。适用于发现页面加载缓慢的开发者和网站所有者。

适用场景

  • ✓当页面因分析、广告或聊天脚本而感觉很慢的时候。
  • ✓当页面上的 script 标签缺少 async 或 defer 属性的时候。
  • ✓当性能审计指出第三方代码是瓶颈的时候。

技能链接

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/third-party-scripts/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/third-party-scripts/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“我的网站加载很慢,我怀疑是聊天小组件和分析工具造成的。请帮我检查它们的加载方式。”

每周 5 个新技能,1 分钟读完。

工作原理

智能体会检查每个外部脚本的加载方式,以及它是否阻塞页面。它会建议使用 async、defer 或懒加载,并先用测量数据确认真正的瓶颈。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Optimize third-party script loading

Third-party scripts are the #1 cause of slow websites—unoptimized loading can add 2-5 seconds to your page load time.

Quick Reference

  • Use async for independent scripts (analytics, ads)
  • Use defer for DOM-dependent scripts (chat widgets, social)
  • Lazy-load non-critical scripts after page load
  • Consider self-hosting critical third-party scripts

Check

Analyze third-party scripts on this page to ensure they use async/defer and don't block rendering.

Fix

Add async or defer attributes to third-party scripts and consider lazy loading non-critical scripts.

Explain

Explain the performance impact of third-party scripts and strategies to minimize their blocking effect.

Code Review

Review the routes, assets, and loading behavior that affect Optimize third-party script loading. Flag exact files, requests, or rendering steps that add unnecessary network, CPU, or layout cost, and describe the measurement method used to confirm the issue.


For full implementation details, code examples, and framework-specific guidance, see references/rule.md.

Rule page: https://frontendchecklist.io/rules/performance/third-party-scripts

常见问题

脚本应该何时使用 async 或 defer?

这项技能建议对分析等独立脚本使用 async,对依赖页面的脚本(例如聊天小组件)使用 defer。

我应该自己托管这些脚本吗?

这项技能指出,对于关键的第三方脚本,自托管可能是合理的。

这项技能如何确认某个脚本确实拖慢了页面?

在建议修改之前,它会查看浏览器开发者工具、Lighthouse 或真实用户数据中的证据。

详情

作者的原始描述

Use when auditing slow page loads, heavy assets, or rendering delays related to Optimize third-party script loading. Verify the actual bottleneck in DevTools, Lighthouse, or field data before recommending changes.

repo: thedaviddias/Front-End-Checklist

热度

GitHub 星标
75k
排名
#3057
许可证
MIT
更新时间
2026/10/31

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能