Chuyển đến nội dung
Skillpedia
Website và giao diện (frontend)75k · #3037

streaming-html

Skill này làm gì

Skill này rà soát code render phía máy chủ để xem HTML được truyền theo từng khối hay bị giữ lại cho tới khi mọi thứ sẵn sàng, rồi gợi ý streaming ở nơi nó hữu ích. Nó dành cho lập trình viên làm việc với website render phía máy chủ, như ứng dụng Next.js hoặc Node.js.

Khi nào nên dùng

  • ✓Khi bạn yêu cầu agent kiểm tra xem các trang render phía máy chủ có stream HTML hay không.
  • ✓Khi byte đầu tiên của trang mất nhiều thời gian vì một yêu cầu dữ liệu chậm kéo theo mọi thứ.
  • ✓Khi bạn dùng Next.js App Router hoặc handler Node.js và muốn xác nhận streaming đã được thiết lập đúng.

Liên kết skill

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

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/streaming-html/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Trang render trên máy chủ của tôi mất nhiều thời gian trước khi có gì hiện ra, vì một truy vấn chậm giữ mọi thứ lại. Bạn có thể thiết lập streaming không?”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Agent kiểm tra xem code render có chờ toàn bộ dữ liệu trước khi gửi HTML hay không. Sau đó nó thêm ranh giới Suspense quanh dữ liệu chậm, hoặc dùng API streaming, để phần đầu trang được gửi ngay.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

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

Câu hỏi thường gặp

Streaming thay đổi điều gì với người xem?

Skill cho biết trình duyệt có thể phân tích, tìm tài nguyên và hiển thị nội dung trước khi truy vấn chậm nhất hoàn tất.

Next.js có stream tự động không?

Skill cho biết App Router stream theo mặc định khi có dùng Suspense.

Tôi nên theo dõi chỉ số nào?

Skill gợi ý theo dõi time to first byte trong Lighthouse, và cho biết giá trị trên 600 mili giây có thể là dấu hiệu thiếu streaming.

Chi tiết

Mô tả gốc của tác giả

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.

repo: thedaviddias/Front-End-Checklist

Độ phổ biến

Sao GitHub
75k
Vị trí xếp hạng
#3037
Giấy phép
MIT
Cập nhật
31/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự