http-requests
它能做什么
这项技能统计页面发出的独立文件请求,并找出减少它们的方法。适用于希望页面首次加载更快的开发者。
适用场景
- ✓当你的页面在显示内容前要加载几十个小文件的时候。
- ✓当你的审计指出首次加载的请求过多的时候。
- ✓当你有许多可以合并的小图标的时候。
技能链接
https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/http-requests/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请帮我减少页面加载时下载的文件数量。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会统计页面发出的请求,并建议合并文件、使用图标精灵图,以及内联关键资源。它还会指出,HTTP/2 有帮助,但并不能消除这些开销。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Minimize HTTP requests
Each HTTP request incurs network overhead—DNS lookup, TCP connection, and TLS handshake add latency. Reducing requests significantly improves initial load time.
Quick Reference
- Each HTTP request adds latency (DNS, TCP, TLS handshakes)
- HTTP/2 multiplexing reduces but doesn't eliminate request overhead
- Bundle critical CSS/JS, use SVG sprites for icons
- Target under 50 requests for initial page load
Check
Count the number of HTTP requests this page makes and identify opportunities for reduction.
Fix
Reduce HTTP requests by combining files, using sprites, inlining critical resources, and implementing HTTP/2.
Explain
Explain how each HTTP request adds latency and why minimizing requests improves performance.
Code Review
Review the routes, assets, and loading behavior that affect Minimize HTTP requests. Flag exact files, requests, or rendering steps that add unnecessary network, CPU, or layout cost, and describe the measurement method used to confirm the issue.
For full implementation details, code examples, and framework-specific guidance,
see references/rule.md.
Rule page: https://frontendchecklist.io/rules/performance/http-requests
常见问题
为什么请求会拖慢页面?
每个请求在文件到达之前,都要花时间进行域名查询、建立连接和加密握手。
HTTP/2 能解决这个问题吗?
这项技能指出,HTTP/2 的多路复用减少了请求开销,但并不能彻底消除。
它建议的目标数字是多少?
它建议首次加载页面时请求数少于 50 个。
详情
作者的原始描述
Use when auditing slow page loads, heavy assets, or rendering delays related to Minimize HTTP requests. Verify the actual bottleneck in DevTools, Lighthouse, or field data before recommending changes.
热度
- GitHub 星标
- 75k
- 排名
- #2875
- 许可证
- MIT
- 更新时间
- 2026/10/31
评论
- …
同一仓库的更多技能
frontendchecklist
75k使用命令行工具,依据 380 多条关于无障碍、速度、SEO 和安全的规则,检查前端代码和线上页面。
frontend-checklist-global
75k依据全部 386 条 Front-End Checklist 规则审查前端项目,并为发现的每个问题给出具体修复方法。
404-page
75k检查你的页面缺失提示是否提供有用的链接,并返回真正的 404 状态,帮助迷路的访客找到方向。
about-page
75k审查你的网站是否有清晰的关于页面,说明由谁运营,以建立访客和搜索引擎的信任。