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

speculation-rules

它能做什么

这个技能为可能的下一页设置浏览器的推测规则(Speculation Rules)功能,并检查规则是否过于宽泛。它面向希望多页网站页面切换更快的网站构建者。

适用场景

  • ✓你请智能体让网站页面之间的导航感觉更快的时候。
  • ✓页面切换感觉很慢,而访客经常前往相同的几个下一页的时候。
  • ✓你希望检查推测规则,确保它们不会加载无关或个人页面的时候。

技能链接

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/speculation-rules/SKILL.md

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

使用方法

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

可直接粘贴的消息

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

可以这样问 AI

“我网站的页面之间切换感觉很慢。请帮我添加推测规则,让下一页提前加载吗?”

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

工作原理

智能体会添加一个推测规则代码块,针对最可能的下一页链接。它先使用预取(prefetch)提前加载 HTML,并建议对很可能被打开的页面使用预渲染(prerender)。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Use the Speculation Rules API to prefetch and prerender navigations

Navigation latency is one of the biggest contributors to poor Interaction to Next Paint (INP) and overall perceived performance. Prerendering the most likely next page eliminates all network and rendering latency — the user sees the new page in under 100 ms regardless of server response time. Google Search has used this API to deliver its "instant" results page experience.

Quick Reference

  • Use prefetch rules to load the next page's HTML ahead of time
  • Use prerender rules to fully render the next page in the background (instant navigation)
  • Scope rules with href-matches or CSS selector patterns to avoid wasting bandwidth
  • Prefer document rules (CSS selectors) over URL list rules for dynamic sites

Check

Check whether the site uses the Speculation Rules API or equivalent prefetch/prerender techniques for likely navigation targets.

Fix

Add a Speculation Rules JSON block targeting the most likely next-page links, starting with prefetch and graduating to prerender.

Explain

Explain how the Speculation Rules API differs from rel=prefetch and rel=prerender, and how prerendering achieves near-zero navigation latency.

Code Review

Review speculation rule selectors for over-eagerness — flag patterns that would prerender unrelated pages, third-party URLs, or pages with personalised/authenticated content that should not be pre-fetched.


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

Rule page: https://frontendchecklist.io/rules/performance/speculation-rules

常见问题

预取和预渲染有什么区别?

这个技能说,预取会提前加载页面的 HTML,而预渲染会在后台完整渲染页面。

这会浪费流量吗?

如果规则过于宽泛,可能会。因此这个技能建议将其范围严格限定。

个人页面应该包括在内吗?

不应该。这个技能说,应避免预渲染个性化或需要登录的页面。

详情

作者的原始描述

Use when optimising multi-page navigation performance, reducing INP on page transitions, or implementing progressive enhancement for fast page loads.

repo: thedaviddias/Front-End-Checklist

热度

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

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能