ttfb
它能做什么
这项技能检查服务器开始响应访客请求的速度。适用于发现页面开始加载很慢、并希望服务器响应更快的开发者。
适用场景
- ✓当页面在浏览器中出现任何内容之前需要很长时间的时候。
- ✓当服务端渲染的页面或 API 的首次响应很慢的时候。
- ✓当团队需要确认慢是来自服务器还是网络的时候。
技能链接
https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/ttfb/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“我的网站要等很久才显示第一个内容。请帮我检查是不是服务器的问题?”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会查看从请求到首次响应路径上的服务器处理、缓存和数据库工作。它会先把服务器时间与网络延迟区分开,然后再建议修改。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Reduce Time to First Byte (TTFB)
TTFB is the foundation of page performance; if the server is slow to respond, all subsequent loading stages are delayed.
Quick Reference
- Optimize server-side logic and database queries to speed up response generation
- Use a Content Delivery Network (CDN) to serve content closer to users
- Implement effective caching strategies at the server and edge levels
Check
Review the page's TTFB and identify any bottlenecks in the server-side processing or network transmission.
Fix
Optimize the server's response time by improving database queries, caching responses, and using a CDN.
Explain
Explain how TTFB impacts the entire page load process and why it is a critical starting point for performance optimization.
Code Review
Review server-rendered routes, API handlers, cache configuration, and database access on the critical path. Flag uncached HTML, slow synchronous work before the first byte, repeated upstream fetches, or expensive queries that keep TTFB above roughly 800ms.
For full implementation details, code examples, and framework-specific guidance,
see references/rule.md.
Rule page: https://frontendchecklist.io/rules/performance/ttfb
常见问题
什么样的首次响应时间算好?
这项技能把超过约 800 毫秒的响应时间标记为需要关注。
CDN 能帮忙吗?
可以。这项技能建议使用内容分发网络(CDN),使内容从离用户更近的地方提供。
哪些常见原因会导致响应变慢?
它会查找的常见原因包括数据库查询慢、缺少缓存,以及重复的上游请求。
详情
作者的原始描述
Use when auditing slow first responses on SSR pages, APIs, or cacheable HTML. Distinguish origin compute time from network latency and CDN cache misses before proposing a fix.
热度
- GitHub 星标
- 75k
- 排名
- #3064
- 许可证
- MIT
- 更新时间
- 2026/10/31
评论
- …
同一仓库的更多技能
frontendchecklist
75k使用命令行工具,依据 380 多条关于无障碍、速度、SEO 和安全的规则,检查前端代码和线上页面。
frontend-checklist-global
75k依据全部 386 条 Front-End Checklist 规则审查前端项目,并为发现的每个问题给出具体修复方法。
404-page
75k检查你的页面缺失提示是否提供有用的链接,并返回真正的 404 状态,帮助迷路的访客找到方向。
about-page
75k审查你的网站是否有清晰的关于页面,说明由谁运营,以建立访客和搜索引擎的信任。