Website Audit
Comprehensive website auditing skill using Lighthouse, PageSpeed Insights, and web performance APIs to audit performance, accessibility, SEO, best practices, and security.
git clone --depth 1 https://github.com/PramodDutta/qaskills /tmp/website-audit && cp -r /tmp/website-audit/seed-skills/audit-website ~/.claude/skills/website-auditSKILL.md
# Website Audit Skill
You are an expert web performance and quality engineer specializing in comprehensive website audits. When the user asks you to audit, analyze, or optimize websites, follow these detailed instructions.
## Core Principles
1. **Measure first, optimize second** -- Collect baseline metrics before making changes.
2. **Focus on Core Web Vitals** -- LCP, FID/INP, and CLS are critical user experience metrics.
3. **Automate audits in CI/CD** -- Prevent performance and quality regressions before deployment.
4. **Test on real devices** -- Lab tests are useful, but field data is the truth.
5. **Holistic approach** -- Performance, accessibility, SEO, and security are interconnected.
## Project Structure
```
audits/
scripts/
lighthouse-audit.ts
performance-budget.ts
accessibility-audit.ts
seo-audit.ts
security-audit.ts
config/
lighthouse.config.ts
budgets.json
reports/
html/
json/
csv/
utils/
metrics-collector.ts
report-generator.ts
threshold-checker.ts
tests/
audit.spec.ts
playwright.config.ts
package.json
```
## Installation
```bash
npm install --save-dev lighthouse lighthouse-ci playwright @playwright/test
npm install --save-dev web-vitals puppeteer chrome-launcher
```
## Lighthouse Audit with Playwright
### Basic Lighthouse Audit
```typescript
import { test } from '@playwright/test';
import { playAudit } from 'playwright-lighthouse';
import lighthouse from 'lighthouse';
import * as chromeLauncher from 'chrome-launcher';
test.describe('Lighthouse Audits', () => {
test('should pass Lighthouse audit for homepage', async ({ page }) => {
await page.goto('https://example.com');
await playAudit({
page,
thresholds: {
performance: 90,
accessibility: 100,
'best-practices': 90,
seo: 90,
pwa: 50,
},
port: 9222,
});
});
test('should audit with custom Lighthouse config', async () => {
const chrome = await chromeLauncher.launch({ chromeFlags: ['--headless'] });
const options = {
logLevel: 'info' as const,
output: 'json' as const,
onlyCategories: ['performance', 'accessibility', 'best-practices', 'seo'],
port: chrome.port,
};
const runnerResult = await lighthouse('https://example.com', options);
await chrome.kill();
const { categories } = runnerResult.lhr;
expect(categories.performance.score).toBeGreaterThan(0.9);
expect(categories.accessibility.score).toBe(1);
expect(categories['best-practices'].score).toBeGreaterThan(0.9);
expect(categories.seo.score).toBeGreaterThan(0.9);
});
});
```
### Lighthouse Configuration
```typescript
// config/lighthouse.config.ts
import { Config } from 'lighthouse';
export const lighthouseConfig: Config = {
extends: 'lighthouse:default',
settings: {
onlyCategories: ['performance', 'accessibility', 'best-practices', 'seo'],
formFactor: 'mobile',
throttling: {
rttMs: 150,
throughputKbps: 1638.4,
cpuSlowdownMultiplier: 4,
},
screenEmulation: {
mobile: true,
width: 375,
height: 667,
deviceScaleFactor: 2,
disabled: false,
},
},
};
export const desktopConfig: Config = {
extends: 'lighthouse:default',
settings: {
onlyCategories: ['performance', 'accessibility', 'best-practices', 'seo'],
formFactor: 'desktop',
throttling: {
rttMs: 40,
throughputKbps: 10240,
cpuSlowdownMultiplier: 1,
},
screenEmulation: {
mobile: false,
width: 1920,
height: 1080,
deviceScaleFactor: 1,
disabled: false,
},
},
};
```
## Performance Auditing
### Core Web Vitals
```typescript
import { test, expect } from '@playwright/test';
test.describe('Core Web Vitals', () => {
test('should measure and validate Core Web Vitals', async ({ page }) => {
await page.goto('https://example.com');
// Measure LCP (Largest Contentful Paint)
const lcp = await page.evaluate(() => {
return new Promise((resolve) => {
new PerformanceObserver((list) => {
const entries = list.getEntries();
const lastEntry = entries[entries.length - 1];
resolve(lastEntry.renderTime || lastEntry.loadTime);
}).observe({ entryTypes: ['largest-contentful-paint'] });
setTimeout(() => resolve(0), 10000);
});
});
// Measure CLS (Cumulative Layout Shift)
const cls = await page.evaluate(() => {
return new Promise((resolve) => {
let clsValue = 0;
new PerformanceObserver((list) => {
for (const entry of list.getEntries()) {
if (!(entry as any).hadRecentInput) {
clsValue += (entry as any).value;
}
}
}).observe({ entryTypes: ['layout-shift'] });
setTimeout(() => resolve(clsValue), 5000);
});
});
// Measure FID (First Input Delay) - requires real interaction
await page.click('body');
const fid = await page.evaluate(() => {
return new Promise((resolve) => {
new PerformanceObserver((list) => {
const entries = list.getEntries();
if (entries.length > 0) {
resolve((entries[0] as any).processingStart - (entries[0] as any).startTime);
}
}).observe({ entryTypes: ['first-input'] });
setTimeout(() => resolve(0), 5000);
});
});
// Assert Core Web Vitals thresholds
expect(lcp).toBeLessThan(2500); // Good LCP < 2.5s
expect(cls).toBeLessThan(0.1); // Good CLS < 0.1
expect(fid).toBeLessThan(100); // Good FID < 100ms
console.log(`LCP: ${lcp}ms, CLS: ${cls}, FID: ${fid}ms`);
});
test('should measure Time to First Byte (TTFB)', async ({ page }) => {
const ttfb = await page.evaluate(() => {
const perfData = window.performance.timing;
return perfData.responseStart - perfData.requestStart;
});
expect(ttfb).toBeLessThan(600); // Good TTFB < 600mAutomated accessibility testing with axe-core integrated into CI pipelines, including custom rule configuration, issue prioritization, and remediation guidance.
Validating A/B test implementations including traffic splitting accuracy, statistical significance calculation, metric tracking, and experiment cleanup.
Comprehensive WCAG compliance and accessibility testing covering ARIA, keyboard navigation, screen readers, color contrast, and automated a11y validation.
Comprehensive WCAG 2.1 AA compliance testing combining automated axe-core scans with manual keyboard navigation, screen reader compatibility, and focus management verification
American Fuzzy Lop Plus Plus mutation-based fuzz testing for finding crashes, hangs, and security vulnerabilities in binary programs.
Fast Rust-based headless browser automation CLI with Node.js fallback for AI agents, featuring navigation, clicking, typing, snapshots, and structured commands optimized for agent workflows.
AI-first testing methodology where autonomous agents plan, generate, execute, and maintain test suites with minimal human intervention, covering agent orchestration, feedback loops, and intelligent test prioritization.
Comprehensive evaluation patterns for AI agents including multi-turn conversation testing, LLM-as-judge frameworks, benchmark suites, regression detection, and systematic eval pipelines for measuring agent quality and safety.