compression
它能做什么
这项技能检查 HTML、CSS 和 JavaScript 发送给浏览器时是否经过压缩。适合希望加快页面传输速度的网站所有者和开发者。
适用场景
- ✓当你的服务器发送的文本文件没有经过压缩时。
- ✓当使用较慢移动网络的访客等待页面很久时。
- ✓当你设置新的 Web 服务器或 CDN 时。
技能链接
https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/compression/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请检查我的网站是否压缩了 HTML、CSS 和 JavaScript;如果没有,请开启 Brotli 或 Gzip。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会检查响应标头中是否有 gzip 或 br 编码,如果缺少,则在 Web 服务器或 CDN 设置中开启压缩。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Enable text-based compression
Compressed assets download faster, reducing the time to first paint and improving the overall perceived performance, especially on slower mobile networks.
Quick Reference
- Use Gzip or Brotli to compress text resources (HTML, JS, CSS)
- Brotli provides superior compression for modern browsers
- Significantly reduces data transfer size and load times
- Compression helps network cost, but it does not remove parse and execution cost from oversized bundles
Check
Verify that text-based resources are served with Content-Encoding: gzip or br headers.
Fix
Enable Gzip or Brotli compression in your web server (Nginx, Apache) or CDN settings.
Explain
Explain how text-based compression works and its impact on asset delivery speed.
Code Review
Review the routes, assets, and loading behavior that affect Enable text-based compression. 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/compression
常见问题
这项技能提到了哪些压缩方法?
Gzip 和 Brotli。其中 Brotli 被认为对现代浏览器更好。
压缩能解决庞大的 JavaScript 包的问题吗?
不能。这项技能说明,压缩会减小传输体积,但不会减少解析大型包的开销。
在哪里开启压缩?
这项技能提到了 Nginx、Apache 或 CDN 的设置。
详情
作者的原始描述
Use when auditing slow page loads, heavy assets, or rendering delays related to Enable text-based compression. Verify the actual bottleneck in DevTools, Lighthouse, or field data before recommending changes.
热度
- GitHub 星标
- 75k
- 排名
- #2777
- 许可证
- MIT
- 更新时间
- 2026/10/31
评论
- …
同一仓库的更多技能
frontendchecklist
75k使用命令行工具,依据 380 多条关于无障碍、速度、SEO 和安全的规则,检查前端代码和线上页面。
frontend-checklist-global
75k依据全部 386 条 Front-End Checklist 规则审查前端项目,并为发现的每个问题给出具体修复方法。
404-page
75k检查你的页面缺失提示是否提供有用的链接,并返回真正的 404 状态,帮助迷路的访客找到方向。
about-page
75k审查你的网站是否有清晰的关于页面,说明由谁运营,以建立访客和搜索引擎的信任。