mcpField
L
lighthouse-audit

lighthouse-audit

github.com/guia-matthieu测试与质量150247 次安装4 周前更新
代码仓库

关于 lighthouse-audit

lighthouse-audit 是用于运行 Google Lighthouse 审计并分析多个 URL 结果的命令行技能。它支持性能、SEO、无障碍、最佳实践和 PWA 检查,并提供批量审计、结果对比、历史记录及多种报告格式。

主要功能

  1. 01运行 URL 的 Lighthouse 审计
  2. 02检查性能、SEO 和无障碍
  3. 03批量审计 URL 列表
  4. 04与基准结果进行对比
  5. 05追踪历史评分
  6. 06导出 JSON、CSV、HTML 或 Markdown

适用场景

  1. 01比较更改前后的 Core Web Vitals
  2. 02检查网站页面的技术 SEO
  3. 03生成 HTML 客户报告
  4. 04追踪网站审计评分

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/guia-matthieu/clawfu-skills --skill lighthouse-audit

安装后在 Claude Code 中输入/lighthouse-audit确认已加载。

附带文件scripts/main.pyscripts/requirements.txt

详细介绍

Lighthouse Audit

自动执行 Google Lighthouse 审计,以衡量和跟踪 Core Web Vitals、SEO 和无障碍性——这些也是 Google 用于搜索排名的指标。

何时使用此技能

  • 性能优化 - 衡量变更前后的 LCP、FID、CLS
  • SEO 审计 - 检查技术 SEO 问题(元标签、结构化数据等)
  • 无障碍检查 - 识别无障碍问题,确保符合规范
  • 客户报告 - 生成专业的性能报告
  • 监控 - 跟踪多个页面的评分变化

Claude 做什么,哪些由你决定

Claude 做什么由你决定
构建分析框架指标定义
识别数据中的模式业务解读
创建可视化模板仪表板设计
建议优化方向行动优先级
计算统计指标决策阈值

依赖项

pip install click pandas jinja2
# Also requires Chrome and Lighthouse CLI
# npm install -g lighthouse
# Or use Chrome DevTools built-in Lighthouse

命令

单个 URL 审计
python scripts/main.py audit https://example.com --categories performance,seo
python scripts/main.py audit https://example.com --format html --output report.html
批量审计
python scripts/main.py batch urls.txt --output results/
python scripts/main.py batch urls.txt --categories performance --format csv
对比前后结果
python scripts/main.py compare https://example.com --baseline scores.json
python scripts/main.py compare https://example.com --baseline-url https://staging.example.com
随时间监控
python scripts/main.py history https://example.com --days 30
python scripts/main.py history https://example.com --plot

示例

示例 1:全站性能审计
# Create URL list
cat > urls.txt << EOF
https://example.com/
https://example.com/pricing
https://example.com/features
https://example.com/blog
EOF

# Run batch audit
python scripts/main.py batch urls.txt --categories performance,seo,accessibility

# Output: results/audit_2024-01-15/
# ├── example.com_.json
# ├── example.com_pricing.json
# ├── example.com_features.json
# ├── example.com_blog.json
# └── summary.csv
示例 2:前后结果对比
# Save baseline
python scripts/main.py audit https://example.com --output baseline.json

# Make optimizations...

# Compare
python scripts/main.py compare https://example.com --baseline baseline.json

# Output:
# Core Web Vitals Comparison
# ─────────────────────────────
# Metric         Before    After    Change
# LCP            3.2s      1.8s     -44% ✓
# FID            120ms     45ms     -63% ✓
# CLS            0.25      0.08     -68% ✓
# Performance    52        89       +37 pts
示例 3:生成客户报告
# Full audit with HTML report
python scripts/main.py audit https://client-site.com \
  --format html \
  --output client-report.html \
  --include-screenshots

# Output: Professional HTML report with:
# - Executive summary
# - Core Web Vitals scores
# - Screenshots of issues
# - Prioritized recommendations

审计类别

类别检查项影响
performanceLCP、FID、CLS、TTFB、Speed Index搜索排名
seo元标签、标题、链接、移动设备搜索可见度
accessibilityWCAG 合规性、对比度、标签合规性
best-practicesHTTPS、安全性、现代 API信任度
pwaService Worker、清单、离线功能类应用体验

Core Web Vitals 阈值

指标良好需要改进较差
LCP(最大内容绘制)≤2.5s2.5s-4.0s>4.0s
FID(首次输入延迟)≤100ms100ms-300ms>300ms
CLS(累积布局偏移)≤0.10.1-0.25>0.25
INP(与下一次绘制的交互)≤200ms200ms-500ms>500ms

输出格式

格式用途内容
json自动化、存储完整原始数据
csv电子表格、分析汇总评分
html客户报告可视化报告
md文档Markdown 摘要

技能边界

此技能的优势
  • 构建数据分析框架
  • 识别模式和趋势
  • 创建可视化框架
  • 计算统计指标
此技能无法做到
  • 访问你的实际数据
  • 替代统计专业知识
  • 做出业务决策
  • 保证预测准确性

相关技能

技能元数据

  • 模式:centaur
category: seo-tools
subcategory: performance
dependencies: [lighthouse, click, pandas]
difficulty: beginner
time_saved: 3+ hours/week

评论

支持 Markdown