MustafaKucukcoskun/Refine-agent-kit / .agents/skills/performance-profiling
performance-profiling
VerifiedPerformance profiling and optimization for web and server applications. Use when diagnosing slow pages, high memory usage, CPU bottlenecks, Core Web Vitals failures, or when running Lighthouse audits and flame graph analysis.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 3.2 KB |
| scripts/lighthouse_audit.py | script | 2.6 KB |
scripts/lighthouse_audit.py
View on GitHub#!/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))
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit. | Stars: 470k | Updated | Claude CodeCodex | Verified | Install |
| rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure. | Stars: 470k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 470k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |