Files
sck_0 4e8e5069fa feat: add 33 skills from vudovn/antigravity-kit
- Added: api-patterns, app-builder, architecture, bash-linux, behavioral-modes,
  clean-code, code-review-checklist, database-design, deployment-procedures,
  docker-expert, documentation-templates, game-development, geo-fundamentals,
  i18n-localization, lint-and-validate, mobile-design, nestjs-expert,
  nextjs-best-practices, nodejs-best-practices, parallel-agents,
  performance-profiling, plan-writing, powershell-windows, prisma-expert,
  python-patterns, react-patterns, red-team-tactics, seo-fundamentals,
  server-management, tailwind-patterns, tdd-workflow, typescript-expert,
  vulnerability-scanner
- Updated README: skill count 179 → 223
- Added credit for vudovn/antigravity-kit (MIT License)

Source: https://github.com/vudovn/antigravity-kit
2026-01-20 08:51:02 +01:00

77 lines
2.6 KiB
Python

#!/usr/bin/env python3
"""
Skill: performance-profiling
Script: lighthouse_audit.py
Purpose: Run Lighthouse performance audit on a URL
Usage: python lighthouse_audit.py https://example.com
Output: JSON with performance scores
Note: Requires lighthouse CLI (npm install -g lighthouse)
"""
import subprocess
import json
import sys
import os
import tempfile
def run_lighthouse(url: str) -> dict:
"""Run Lighthouse audit on URL."""
try:
with tempfile.NamedTemporaryFile(suffix='.json', delete=False) as f:
output_path = f.name
result = subprocess.run(
[
"lighthouse",
url,
"--output=json",
f"--output-path={output_path}",
"--chrome-flags=--headless",
"--only-categories=performance,accessibility,best-practices,seo"
],
capture_output=True,
text=True,
timeout=120
)
if os.path.exists(output_path):
with open(output_path, 'r') as f:
report = json.load(f)
os.unlink(output_path)
categories = report.get("categories", {})
return {
"url": url,
"scores": {
"performance": int(categories.get("performance", {}).get("score", 0) * 100),
"accessibility": int(categories.get("accessibility", {}).get("score", 0) * 100),
"best_practices": int(categories.get("best-practices", {}).get("score", 0) * 100),
"seo": int(categories.get("seo", {}).get("score", 0) * 100)
},
"summary": get_summary(categories)
}
else:
return {"error": "Lighthouse failed to generate report", "stderr": result.stderr[:500]}
except subprocess.TimeoutExpired:
return {"error": "Lighthouse audit timed out"}
except FileNotFoundError:
return {"error": "Lighthouse CLI not found. Install with: npm install -g lighthouse"}
def get_summary(categories: dict) -> str:
"""Generate summary based on scores."""
perf = categories.get("performance", {}).get("score", 0) * 100
if perf >= 90:
return "[OK] Excellent performance"
elif perf >= 50:
return "[!] Needs improvement"
else:
return "[X] Poor performance"
if __name__ == "__main__":
if len(sys.argv) < 2:
print(json.dumps({"error": "Usage: python lighthouse_audit.py <url>"}))
sys.exit(1)
result = run_lighthouse(sys.argv[1])
print(json.dumps(result, indent=2))