performance-budget
它能做什么
这个技能设置并检查性能预算,即体积和速度的固定上限,超出时会使构建失败。它面向希望网站随着规模增长仍保持快速的团队。
适用场景
- ✓你请智能体在项目的构建或拉取请求检查中添加性能限制的时候。
- ✓你的应用因为每次改动都增加一点体积而越来越慢的时候。
- ✓你添加新依赖项,并想确认它仍在体积限制之内的时候。
技能链接
https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/performance-budget/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请帮我在项目中设置体积和速度限制,让变慢的改动在上线前就被标记出来吗?”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会在你的持续集成流程中添加 size-limit 的包体积限制和 Lighthouse CI 断言。它会为体积和速度设置阈值,并在改动超过阈值时使检查失败。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Enforce performance budgets in CI
Without automated enforcement, performance degrades gradually — each PR adds a small library, each feature adds a few KB, and within months the app that loaded in 2 seconds now takes 5. Performance budgets make regressions visible at PR time rather than after user complaints. Catching 'this PR added 200KB to the bundle' in review is far cheaper than debugging a slow production site.
Quick Reference
- Define specific thresholds: max bundle size, min Lighthouse score, max LCP time
- Fail CI when budgets are exceeded to prevent performance regressions
- Size budgets catch accidental heavy dependencies; Lighthouse budgets catch runtime regressions
- Start with loose budgets and tighten them as you optimize
- Monitor production RUM so regressions are caught after deploy, not only in CI
Check
Does this project have performance budgets defined? Check package.json and CI configuration for size or Lighthouse thresholds.
Fix
Set up bundle size limits with size-limit and Lighthouse CI assertions in the CI pipeline.
Explain
Explain performance budgets, how to choose appropriate thresholds, and how to enforce them with size-limit and Lighthouse CI.
Code Review
Inspect CI workflows, package.json, and Lighthouse or bundle-size config for explicit thresholds. Flag repos where budgets are missing, too loose to catch regressions, or unenforced on pull requests. Check whether production RUM and alerting are wired to detect regressions after release.
For full implementation details, code examples, and framework-specific guidance,
see references/rule.md.
Rule page: https://frontendchecklist.io/rules/testing/performance-budget
常见问题
体积预算和运行时预算有什么区别?
这个技能说,体积预算用于发现体积大的依赖项,而 Lighthouse 预算用于发现运行时变慢的问题。
限制一开始应该很严格吗?
这个技能建议从宽松的预算开始,并随着网站优化逐步收紧。
上线后有了预算,还需要监控吗?
需要。这个技能建议同时监控真实用户数据,以便在部署后发现性能退化。
详情
作者的原始描述
Use when reviewing CI configuration, bundle analysis workflows, or pull requests that add dependencies and assets. Distinguish bundle-size budgets from runtime budgets such as Lighthouse or Core Web Vitals so teams can enforce both.
热度
- GitHub 星标
- 75k
- 排名
- #2975
- 许可证
- MIT
- 更新时间
- 2026/10/31
评论
- …
同一仓库的更多技能
frontendchecklist
75k使用命令行工具,依据 380 多条关于无障碍、速度、SEO 和安全的规则,检查前端代码和线上页面。
frontend-checklist-global
75k依据全部 386 条 Front-End Checklist 规则审查前端项目,并为发现的每个问题给出具体修复方法。
404-page
75k检查你的页面缺失提示是否提供有用的链接,并返回真正的 404 状态,帮助迷路的访客找到方向。
about-page
75k审查你的网站是否有清晰的关于页面,说明由谁运营,以建立访客和搜索引擎的信任。