js-file-size
它能做什么
这个技能检查 JavaScript 包的体积,并标出对性能来说过重的文件。它面向页面在手机上显得很慢的开发者。
适用场景
- ✓某个 JavaScript 文件压缩后超过约 200 KB 的时候。
- ✓页面在低端手机上加载时没有响应的时候。
- ✓你的包分析显示有几个非常大的依赖项的时候。
技能链接
https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/js-file-size/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请帮我检查 JavaScript 包是不是太大了吗?”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会检查包的体积,标出压缩后超过约 200 KB 的文件。它会建议做代码拆分、tree-shaking,并检查较重的依赖项。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Optimize JavaScript bundle size
Excessive JavaScript increases parse and execution time, especially on low-end devices, leading to sluggish user experiences and high data costs.
Quick Reference
- Keep individual JS bundles under 200KB (compressed)
- Large bundles delay Time to Interactive (TTI) and First Input Delay (FID)
- Use code-splitting and tree-shaking to reduce unused code
Check
Review the JavaScript bundle sizes and identify any files exceeding 200KB (Gzip/Brotli).
Fix
Implement code-splitting, tree-shaking, and dependency audits to reduce the size of the JavaScript bundles.
Explain
Explain how large JavaScript files impact the main thread and delay user interactivity (FID/TTI).
Code Review
Review the routes, assets, and loading behavior that affect Optimize JavaScript bundle size. 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/js-file-size
常见问题
为什么包的体积很重要?
这个技能说,大的脚本解析和运行都需要更长时间,在低端设备上尤其明显。
多大算太大?
这个技能把每个包压缩后约 200 KB 作为参考标准。
什么是代码拆分?
就是把代码分成更小的块,让每个页面只加载它需要的部分。
详情
作者的原始描述
Use when auditing slow page loads, heavy assets, or rendering delays related to Optimize JavaScript bundle size. Verify the actual bottleneck in DevTools, Lighthouse, or field data before recommending changes.
热度
- GitHub 星标
- 75k
- 排名
- #2903
- 许可证
- MIT
- 更新时间
- 2026/10/31
评论
- …
同一仓库的更多技能
frontendchecklist
75k使用命令行工具,依据 380 多条关于无障碍、速度、SEO 和安全的规则,检查前端代码和线上页面。
frontend-checklist-global
75k依据全部 386 条 Front-End Checklist 规则审查前端项目,并为发现的每个问题给出具体修复方法。
404-page
75k检查你的页面缺失提示是否提供有用的链接,并返回真正的 404 状态,帮助迷路的访客找到方向。
about-page
75k审查你的网站是否有清晰的关于页面,说明由谁运营,以建立访客和搜索引擎的信任。