Claude软件排障修复AI 评分 · 73/100AI 辅助编辑·未发现明显提示词注入风险X

用 Claude Code 一键优化网站加载速度

输入网站 URL → Claude Code 自动跑 PageSpeed Insights 诊断并修复最大瓶颈 → 输出前后基准数据与访客可感知的改动

有一点经验步骤提示词贴士
给谁
有网站维护需求、想快速定位性能瓶颈的开发者或站长
你会得到
获得基于真实 Chrome 用户数据的诊断,按提示词自动修复最大瓶颈,每次改动前后各测 3 次并报告中位数与波动范围
你需要
Claude Code

硬约束

需要 Claude Code 环境和一个可公开访问的网站 URL。Claude Code 会自动调用 PageSpeed Insights API 读取 28 天 Chrome 用户实测数据(field data),按提示词流程诊断并修复。作者未说明是否产生额外 API 费用。

他们做了什么

作者 @Andrew22Lane 当晚将该提示词用于一个客户网站。Claude Code 先从 Google 的访客数据入手(页面已能在 0.6 秒呈现),随后直接定位慢速手机的等待原因:图片尺寸远超屏幕所需、样式表从二级域名加载、未打开屏幕上的图片提前加载。

效果如何

作者报告:在慢速手机模拟环境下,页面加载从 6.8 秒降至 3.6 秒,接近减半;每次测量均取 3 次前后对比的中位数。(来源:作者自述,未经验证)

值得知道

来源未披露具体修复代码或客户网站 URL,无法独立复现该 6.8s→3.6s 结果;PageSpeed Insights API 可能有调用配额或费用;提示词要求'只保留访客能感受到的修复',实际保留标准由 Claude 判断;28 天 Chrome 用户数据需要网站有足够访问量才会有 field data。

步骤

  1. 粘贴提示词并提交网站 URL

    在 Claude Code 中粘贴下方提示词,随后提供你要优化的网站 URL。Claude 会先运行 PageSpeed Insights 读取完整报告(含顶部的 Chrome 用户实测数据),找出最大瓶颈,逐条修复,并在每次修复前后各跑 3 次基准测试。

    运行提示词 · 来源原文。Claude Code 主对话输入框;先粘贴提示词,再提供网站 URL

    Make this website faster for the people who visit it. Run PageSpeed Insights on the live URL first and read the whole report before you change anything, including the field data (Chrome user data) at the top. Find the biggest gap, fix it, and benchmark every fix 3 times before and 3 times after. Report the median and the range. Keep a fix only if a visitor would feel it.
  2. 安全建议

    安全建议:在 Claude Code 把任何改动部署到线上网站之前,先核对改动内容并确认。

可复制提示词

搭建指导 · 本站建议版本。交给搭建助手确认 Claude Code 已安装并准备输入 URL

这一段是提示词,页面不会在这里插入广告。

Make this website faster for the people who visit it. Run PageSpeed Insights on the live URL first and read the whole report before you change anything, including the field data (Chrome user data) at the top. Find the biggest gap, fix it, and benchmark every fix 3 times before and 3 times after. Report the median and the range. Keep a fix only if a visitor would feel it.

提示词为英文原文,直接粘贴进 Claude Code 即可,无需翻译。

来源

一段提示词让 Claude Code 给网站提速:先读 PageSpeed 实测数据找最大差距,每个改动前后各测 3 次,只保留访客能感受到的修复 · Andrew22Lane · X · 2026-10-15T04:20:31.000Z

留言与反馈

试过这个方法吗?分享效果、遇到的问题或改进建议。留言审核后公开,请勿填写敏感信息。

正在加载…

    相关用例