website_audit

📁 nyhxiaoning/skill_webaudit_henry 📅 Today
3
总安装量
2
周安装量
#57327
全站排名
安装命令
npx skills add https://github.com/nyhxiaoning/skill_webaudit_henry --skill website_audit

Agent 安装分布

amp 2
cline 2
opencode 2
kimi-cli 2
codex 2

Skill 文档

website_audit

描述

对指定 URL 运行 Lighthouse 审计,产出结构化 JSON。返回 performance 分数与完整原始报告,便于在代理、流水线或质量门禁中消费与比对。

使用场景

  • 开发阶段快速评估页面性能
  • PR/CI 中设定性能阈值做质量门禁
  • 上线前建立/对比性能基线
  • 定时巡检以发现性能回归
  • 用户提出“审计网站性能/生成 Lighthouse 报告/检测页面速度”等需求时触发

指令

  1. 接收入参 { url },校验为 http/https 且非空。
  2. 执行命令 npx lighthouse <url> --output=json 获取审计结果。
    • 在无头或 CI 环境可追加 --chrome-flags="--headless=new"。
  3. 解析 stdout 为 JSON,读取 categories.performance.score。
  4. 构造并返回:
    { "score": <number>, "raw": { /* Lighthouse 完整 JSON */ } }
    
  5. 异常处理:捕获执行/解析错误,返回错误信息或抛出异常以便上层处理。

示例(可选)

  • CLI:
    node dist/cli.js --url https://example.com
    # 或:npm link && website-audit --url https://example.com
    
  • 代码:
    import { websiteAuditSkill } from "websiteauditskill_henry";
    const res = await websiteAuditSkill({ url: "https://example.com" });
    console.log(res.score);
    // { score: 0.92, raw: { ... } }