首页龙虾技能列表 › 前端性能审计清单 — 技能工具

前端性能审计清单 — 技能工具

v1.1.0

提供网页性能诊断流程和优化建议,涵盖Core Web Vitals、资源加载、代码分割、图片懒加载与缓存策略。

0· 73·0 当前·0 累计
下载技能包
License
MIT-0
最后更新
2026/4/6
安全扫描
VirusTotal
无害
查看报告
OpenClaw
安全
high confidence
This is an instruction-only frontend performance-audit checklist whose requirements and instructions align with its stated purpose and do not request unrelated credentials or installs.
评估建议
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) — lik...
详细分析 ▾
用途与能力
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.
指令范围
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.
安装机制
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.
凭证需求
The skill requests no environment variables, credentials, or config paths. That is proportionate to a documentation/checklist skill.
持久化与权限
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.
安全有层次,运行前请审查代码。

License

MIT-0

可自由使用、修改和再分发,无需署名。

运行时依赖

无特殊依赖

版本

latestv1.1.02026/4/6

新增定价,内容不变

● 无害

安装命令 点击复制

官方npx clawhub@latest install frontend-perf-audit
镜像加速npx clawhub@latest install frontend-perf-audit --registry https://cn.clawhub-mirror.com

技能文档

Core Web Vitals 目标

指标含义目标
LCP最大内容绘制< 2.5s> 4s
FID/INP交互延迟< 100ms> 300ms
CLS布局偏移< 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 总大小(目标 < 500KB gzipped)
  • 是否有阻塞渲染的资源
  • 是否利用了缓存(304/200 from cache)

优化策略

LCP 优化(最大内容绘制 < 2.5s)

// 1. 关键 CSS 内联
// vite-plugin-critical 提取首屏 CSS 内联到 HTML

// 2. 图片懒加载 description // 或原生 description

// 3. 预加载关键资源

// 4. 骨架屏

// 5. 字体优化

CLS 优化(布局偏移 < 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

一句话总结

先消除渲染阻塞,再优化资源加载,最后做代码分割和缓存 — 按这个顺序效果最大。

数据来源:ClawHub ↗ · 中文优化:龙虾技能库
OpenClaw 技能定制 / 插件定制 / 私有工作流定制

免费技能或插件可能存在安全风险,如需更匹配、更安全的方案,建议联系付费定制

了解定制服务