streaming-html
它能做什么
这个技能检查服务器渲染代码,看 HTML 是分块流式发送,还是等全部准备好才发送,并在有帮助的地方建议使用流式输出。它面向开发服务器渲染网站的开发者,例如 Next.js 或 Node.js 应用。
适用场景
- ✓你请智能体检查服务器渲染的页面是否采用流式传输 HTML 的时候。
- ✓由于一个缓慢的数据请求拖住了所有内容,页面的首字节到达得很慢的时候。
- ✓你使用 Next.js App Router 或 Node.js 处理程序,并想确认流式输出设置正确的时候。
技能链接
https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/streaming-html/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“我的服务器渲染页面要很久才显示内容,因为一个慢查询拖住了全部。请帮我设置流式输出吗?”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会检查渲染代码是否在发送 HTML 前等待所有数据。然后它会在慢速数据周围添加 Suspense 边界,或使用流式 API,使页面顶部立即发送。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Stream HTML to the browser before the full response is ready
Traditional SSR waits for all data fetches to complete before sending a single byte of HTML, which means the browser cannot parse, discover subresources, or render anything until the slowest data query finishes. Streaming decouples the delivery of above-fold content from slow database queries and third-party API calls, dramatically improving perceived performance and LCP.
Quick Reference
- Streaming sends HTML in chunks as it is generated instead of waiting for the full response
- React renderToPipeableStream and Next.js App Router stream by default when you use Suspense
- Place Suspense boundaries around slow data dependencies to flush above-fold HTML immediately
- Monitor TTFB in Lighthouse — values above 600ms are a sign that streaming is not being used
Check
Examine this server-side rendering implementation to determine whether HTML is streamed in chunks or buffered until fully generated before sending to the client.
Fix
Refactor the SSR implementation to use renderToPipeableStream with Suspense boundaries around slow data fetches, or use ReadableStream in a Node.js handler, so that above-fold HTML is flushed to the client immediately.
Explain
Explain how streaming HTML improves TTFB and FCP by decoupling the delivery of fast content from slow server-side data dependencies.
Code Review
Review server entry points and page components for renderToString calls, missing Suspense boundaries around data-fetching components, and use of await on slow queries before returning a response.
For full implementation details, code examples, and framework-specific guidance,
see references/rule.md.
Rule page: https://frontendchecklist.io/rules/performance/streaming-html
常见问题
流式输出对访客有什么改变?
这个技能说,即使最慢的数据查询还未完成,浏览器也可以先解析、查找资源并显示内容。
Next.js 中流式输出是自动的吗?
这个技能说,使用 Suspense 时,App Router 默认进行流式输出。
我应该关注哪个数字?
这个技能建议在 Lighthouse 中关注首字节时间,并说超过 600 毫秒可能表明缺少流式输出。
详情
作者的原始描述
Use when reviewing server-side rendering setup, Next.js App Router pages, or Node.js HTTP handlers to verify that HTML is streamed incrementally rather than buffered until completion.
热度
- GitHub 星标
- 75k
- 排名
- #3037
- 许可证
- MIT
- 更新时间
- 2026/10/31
评论
- …
同一仓库的更多技能
frontendchecklist
75k使用命令行工具,依据 380 多条关于无障碍、速度、SEO 和安全的规则,检查前端代码和线上页面。
frontend-checklist-global
75k依据全部 386 条 Front-End Checklist 规则审查前端项目,并为发现的每个问题给出具体修复方法。
404-page
75k检查你的页面缺失提示是否提供有用的链接,并返回真正的 404 状态,帮助迷路的访客找到方向。
about-page
75k审查你的网站是否有清晰的关于页面,说明由谁运营,以建立访客和搜索引擎的信任。