跳到正文
Skillpedia
部署与云(DevOps)75k · #2975

performance-budget

它能做什么

这个技能设置并检查性能预算,即体积和速度的固定上限,超出时会使构建失败。它面向希望网站随着规模增长仍保持快速的团队。

适用场景

  • ✓你请智能体在项目的构建或拉取请求检查中添加性能限制的时候。
  • ✓你的应用因为每次改动都增加一点体积而越来越慢的时候。
  • ✓你添加新依赖项,并想确认它仍在体积限制之内的时候。

技能链接

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/performance-budget/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/performance-budget/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 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.

repo: thedaviddias/Front-End-Checklist

热度

GitHub 星标
75k
排名
#2975
许可证
MIT
更新时间
2026/10/31

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能