← Back to Skills Marketplace
前端性能审计清单
by
chenxiaoyu0124-web
· GitHub ↗
· v1.1.0
· MIT-0
109
Downloads
0
Stars
0
Active Installs
2
Versions
Install in OpenClaw
/install frontend-perf-audit
Description
提供网页性能诊断流程和优化建议,涵盖Core Web Vitals、资源加载、代码分割、图片懒加载与缓存策略。
README (SKILL.md)
前端性能审计清单
Core Web Vitals 目标
| 指标 | 含义 | 目标 | 差 |
|---|---|---|---|
| LCP | 最大内容绘制 | \x3C 2.5s | > 4s |
| FID/INP | 交互延迟 | \x3C 100ms | > 300ms |
| CLS | 布局偏移 | \x3C 0.1 | > 0.25 |
诊断流程
Step 1: Lighthouse 审计
# Chrome DevTools → Lighthouse → 生成报告
# 或命令行
npx lighthouse https://your-site.com --output html --output-path ./report.html
重点关注:
- Performance 分数(目标 > 90)
- Opportunities(优化建议,按影响排序)
- Diagnostics(诊断信息)
Step 2: Coverage 分析
F12 → Coverage → 点击录制 → 操作页面 → 查看未使用代码
// vite.config.ts — 代码分割
export default defineConfig({
build: {
rollupOptions: {
output: {
manualChunks: {
'vendor': ['vue', 'vue-router', 'pinia'],
'ui': ['ant-design-vue'],
'chart': ['@antv/s2', 'three'],
},
},
},
},
})
Step 3: Network 瀑布图
F12 → Network → 过滤 Doc/JS/CSS/Img
检查:
- JS Bundle 总大小(目标 \x3C 500KB gzipped)
- 是否有阻塞渲染的资源
- 是否利用了缓存(304/200 from cache)
优化策略
LCP 优化(最大内容绘制 \x3C 2.5s)
// 1. 关键 CSS 内联
// vite-plugin-critical 提取首屏 CSS 内联到 HTML
// 2. 图片懒加载
\x3Cimg v-lazy="imageUrl" alt="description" />
// 或原生
\x3Cimg loading="lazy" src="image.jpg" alt="description" />
// 3. 预加载关键资源
\x3Clink rel="preload" href="/fonts/main.woff2" as="font" crossorigin>
\x3Clink rel="preload" href="/js/chunk-vendor.js" as="script">
// 4. 骨架屏
\x3CSuspense>
\x3Ctemplate #default>\x3CMainContent />\x3C/template>
\x3Ctemplate #fallback>\x3CSkeletonScreen />\x3C/template>
\x3C/Suspense>
// 5. 字体优化
\x3Clink rel="preconnect" href="https://fonts.googleapis.com">
\x3Clink rel="dns-prefetch" href="https://fonts.gstatic.com" crossorigin>
CLS 优化(布局偏移 \x3C 0.1)
/* 1. 图片/视频容器预留空间 */
.media-container {
aspect-ratio: 16 / 9;
width: 100%;
background: #f5f5f5;
}
/* 2. 字体回退策略 */
body {
font-family: -apple-system, 'PingFang SC', sans-serif;
}
/* 3. 动态内容区域预留最小高度 */
.dynamic-content {
min-height: 200px;
}
Bundle 优化
// vite.config.ts
export default defineConfig({
build: {
target: 'es2020',
minify: 'terser',
terserOptions: {
compress: {
drop_console: true, // 生产环境去掉 console
drop_debugger: true,
},
},
rollupOptions: {
output: {
manualChunks(id) {
if (id.includes('node_modules')) {
return 'vendor'
}
if (id.includes('ant-design')) {
return 'ui'
}
},
},
},
chunkSizeWarningLimit: 500,
},
})
缓存策略
// vite.config.ts
export default defineConfig({
build: {
rollupOptions: {
output: {
// 文件名带 hash,利于长期缓存
entryFileNames: 'assets/[name].[hash].js',
chunkFileNames: 'assets/[name].[hash].js',
assetFileNames: 'assets/[name].[hash].[ext]',
},
},
},
})
// nginx 配置
// assets/ — Cache-Control: public, max-age=31536000, immutable
// index.html — Cache-Control: no-cache
持续监控
// 在应用中埋点
if ('PerformanceObserver' in window) {
const observer = new PerformanceObserver((list) => {
for (const entry of list.getEntries()) {
console.log(entry.name, entry.startTime, entry.duration)
}
})
observer.observe({ type: 'largest-contentful-paint', buffered: true })
observer.observe({ type: 'layout-shift', buffered: true })
observer.observe({ type: 'first-input', buffered: true })
}
优化优先级
- 消除渲染阻塞 — 内联关键 CSS、async/defer JS
- 图片优化 — WebP/AVIF、懒加载、响应式图片
- 代码分割 — 路由懒加载、vendor 分离
- 缓存策略 — hash 文件名 + 长期缓存
- 字体优化 — preconnect + font-display: swap
- 服务端 — gzip/brotli、CDN、HTTP/2
一句话总结
先消除渲染阻塞,再优化资源加载,最后做代码分割和缓存 — 按这个顺序效果最大。
Usage Guidance
This is a readable checklist and code-snippet collection for frontend performance auditing — it appears coherent and safe. Before using: (1) review and test any config/code changes in a staging environment (don’t paste snippets blindly into production); (2) running suggested commands like `npx lighthouse` will download and run an npm package at runtime — only run those on a trusted machine and network; (3) note a small metadata mismatch (pack metadata version differs from registry version) — likely benign but worth noticing; (4) because this skill is instruction-only, it won’t automatically execute code, but if you invoke suggested commands they will run on your system, so exercise usual caution.
Capability Analysis
Type: OpenClaw Skill
Name: frontend-perf-audit
Version: 1.1.0
The skill bundle is a legitimate educational resource for frontend performance auditing. It contains standard diagnostic procedures using Lighthouse and provides best-practice code snippets for Vite configuration, CSS optimization, and performance monitoring in SKILL.md. There are no signs of data exfiltration, malicious execution, or prompt injection.
Capability Tags
Capability Assessment
Purpose & Capability
The name/description (frontend performance audit) matches the SKILL.md: Lighthouse, DevTools workflows, vite/nginx snippets, and PerformanceObserver usage are appropriate and expected for this purpose. No unrelated binaries, credentials, or config paths are requested.
Instruction Scope
Instructions are scoped to performance diagnosis and remediation steps (Lighthouse, Coverage, Network, config/code examples). They do not instruct reading system files, secrets, or sending data to unexpected external endpoints. The only network action suggested is running npx lighthouse or loading resources from CDNs, which is consistent with the topic.
Install Mechanism
No install spec or code files are included (instruction-only). This is low-risk. Note: SKILL.md suggests using npx (which fetches an npm package at runtime) but that is a normal, user-invoked diagnostic action rather than an automatic install by the skill.
Credentials
The skill requests no environment variables, credentials, or config paths. That is proportionate to a documentation/checklist skill.
Persistence & Privilege
always is false and the skill does not request persistent system presence or modify other skills. Agent autonomous invocation is allowed (platform default) but is not combined here with other red flags.
How to Use
- Make sure OpenClaw is installed (local or Docker)
- Run the install command in chat:
/install frontend-perf-audit - After installation, invoke the skill by name or use
/frontend-perf-audit - Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.1.0
新增定价,内容不变
v1.0.0
初始发布:Core Web Vitals+Bundle优化+缓存策略
Metadata
Frequently Asked Questions
What is 前端性能审计清单?
提供网页性能诊断流程和优化建议,涵盖Core Web Vitals、资源加载、代码分割、图片懒加载与缓存策略。 It is an AI Agent Skill for Claude Code / OpenClaw, with 109 downloads so far.
How do I install 前端性能审计清单?
Run "/install frontend-perf-audit" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.
Is 前端性能审计清单 free?
Yes, 前端性能审计清单 is completely free, licensed under MIT-0. You can download, install and use it at no cost.
Which platforms does 前端性能审计清单 support?
前端性能审计清单 is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).
Who created 前端性能审计清单?
It is built and maintained by chenxiaoyu0124-web (@chenxiaoyu0124-web); the current version is v1.1.0.
More Skills