css-critical
它能做什么
这项技能说明如何把首屏所需的关键 CSS 内联,并稍后加载其余部分。适合希望首次绘制更快、加载评分更好的开发者。
适用场景
- ✓当因为样式表很大,首屏需要很长时间才能出现时。
- ✓当 Lighthouse 标记出阻塞渲染的 CSS 时。
- ✓当你设置的构建流程应当自动提取关键样式时。
技能链接
https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/css-critical/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请找出我首页顶部区域所需的样式,并将它们内联,让页面显示得更快。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会提取首屏可见部分的样式,把它们放入 head 中,并以不阻塞渲染的方式加载其余的 CSS,最好通过自动化构建工具完成。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Inline critical CSS for faster rendering
Critical CSS eliminates render-blocking resources, enabling browsers to paint content immediately—directly improving LCP and FCP scores.
Quick Reference
- Inline ~14KB of critical above-the-fold CSS in <head>
- Use tools: critical, critters, or Lighthouse to extract
- Load remaining CSS asynchronously after page load
- Automate in build process—don't manually maintain
Check
Analyze this page's CSS loading strategy to identify critical above-the-fold styles that should be inlined and non-critical styles that can be loaded asynchronously.
Fix
Extract and inline critical CSS for above-the-fold content, then load remaining CSS asynchronously to improve initial page render performance.
Explain
Explain how critical CSS improves Core Web Vitals by reducing render-blocking resources and enabling faster First Contentful Paint and Largest Contentful Paint.
Code Review
Review stylesheets, component styles, and responsive states related to Inline critical CSS for faster rendering. Flag exact selectors, declarations, or breakpoints that violate the rule in the rendered UI.
For full implementation details, code examples, and framework-specific guidance,
see references/rule.md.
Rule page: https://frontendchecklist.io/rules/css/css-critical
常见问题
应该内联多少 CSS?
这项技能建议大约 14 KB 的首屏关键 CSS。
哪些工具可以提取它?
这项技能提到了 critical、critters 和 Lighthouse。
关键 CSS 应该手动维护吗?
不应该。这项技能建议在构建流程中将其自动化。
详情
作者的原始描述
Use when reviewing stylesheets, component styles, and responsive behavior related to Inline critical CSS for faster rendering. Check the rendered layout across breakpoints and interaction states before proposing a fix.
热度
- GitHub 星标
- 75k
- 排名
- #2796
- 许可证
- MIT
- 更新时间
- 2026/10/31
评论
- …
同一仓库的更多技能
frontendchecklist
75k使用命令行工具,依据 380 多条关于无障碍、速度、SEO 和安全的规则,检查前端代码和线上页面。
frontend-checklist-global
75k依据全部 386 条 Front-End Checklist 规则审查前端项目,并为发现的每个问题给出具体修复方法。
404-page
75k检查你的页面缺失提示是否提供有用的链接,并返回真正的 404 状态,帮助迷路的访客找到方向。
about-page
75k审查你的网站是否有清晰的关于页面,说明由谁运营,以建立访客和搜索引擎的信任。