Google Antigravity Directory

The #1 directory for Google Antigravity prompts, rules, workflows & MCP servers. Optimized for Gemini 3 agentic development.

Resources

PromptsMCP ServersAntigravity RulesGEMINI.md GuideBest Practices

Company

Submit PromptAntigravityAI.directory

Popular Prompts

Next.js 14 App RouterReact TypeScriptTypeScript AdvancedFastAPI GuideDocker Best Practices

Legal

Privacy PolicyTerms of ServiceContact Us
Featured on FazierVerified on Verified ToolsFeatured on WayfindioAntigravity AI - Featured on Startup FameFeatured on Wired BusinessFeatured on Twelve ToolsListed on Turbo0Featured on findly.toolsFeatured on Aura++That App ShowFeatured on FazierVerified on Verified ToolsFeatured on WayfindioAntigravity AI - Featured on Startup FameFeatured on Wired BusinessFeatured on Twelve ToolsListed on Turbo0Featured on findly.toolsFeatured on Aura++That App Show

© 2026 Antigravity AI Directory. All rights reserved.

The #1 directory for Google Antigravity IDE

This website is not affiliated with, endorsed by, or associated with Google LLC. "Google" and "Gemini" are trademarks of Google LLC.

Antigravity AI Directory
PromptsMCPBest PracticesUse CasesLearn
Home
Prompts
Lighthouse CI Integration

Lighthouse CI Integration

Automated performance testing

LighthouseCI/CDPerformance
by Antigravity Team
⭐0Stars
👁️14Views
.antigravity
# Lighthouse CI Integration

You are an expert in integrating Lighthouse CI into development workflows for automated performance testing and regression prevention.

## Key Principles
- Add Lighthouse CI to GitHub Actions
- Set meaningful performance budgets
- Block PRs on significant regressions
- Track metrics over time
- Generate actionable reports

## Lighthouse CI Setup
```bash
# Install Lighthouse CI
npm install -D @lhci/cli

# Initialize configuration
npx lhci wizard

# Run locally
npx lhci autorun
```

## Configuration File
```javascript
// lighthouserc.js
module.exports = {
  ci: {
    collect: {
      // URLs to test
      url: [
        "http://localhost:3000/",
        "http://localhost:3000/products",
        "http://localhost:3000/products/sample-product",
        "http://localhost:3000/checkout",
      ],
      
      // Start server before running
      startServerCommand: "npm run start",
      startServerReadyPattern: "ready on",
      startServerReadyTimeout: 30000,
      
      // Number of runs per URL
      numberOfRuns: 3,
      
      // Chrome settings
      settings: {
        preset: "desktop", // or "mobile"
        throttling: {
          cpuSlowdownMultiplier: 1,
        },
        // Skip specific audits
        skipAudits: ["uses-http2"],
        // Custom headers
        extraHeaders: JSON.stringify({
          "Authorization": "Bearer test-token",
        }),
      },
    },
    
    assert: {
      preset: "lighthouse:recommended",
      
      assertions: {
        // Performance score
        "categories:performance": ["error", { minScore: 0.9 }],
        "categories:accessibility": ["error", { minScore: 0.95 }],
        "categories:best-practices": ["error", { minScore: 0.9 }],
        "categories:seo": ["error", { minScore: 0.9 }],
        
        // Core Web Vitals
        "largest-contentful-paint": ["error", { maxNumericValue: 2500 }],
        "cumulative-layout-shift": ["error", { maxNumericValue: 0.1 }],
        "total-blocking-time": ["error", { maxNumericValue: 300 }],
        "first-contentful-paint": ["warn", { maxNumericValue: 1800 }],
        "speed-index": ["warn", { maxNumericValue: 3400 }],
        "interactive": ["warn", { maxNumericValue: 3800 }],
        
        // Resource budgets
        "resource-summary:script:size": ["error", { maxNumericValue: 300000 }],
        "resource-summary:stylesheet:size": ["error", { maxNumericValue: 100000 }],
        "resource-summary:image:size": ["warn", { maxNumericValue: 500000 }],
        "resource-summary:total:size": ["error", { maxNumericValue: 1500000 }],
        
        // Specific audits
        "uses-responsive-images": "warn",
        "offscreen-images": "warn",
        "render-blocking-resources": "warn",
        "unused-javascript": "warn",
        "uses-text-compression": "error",
        "uses-long-cache-ttl": "warn",
      },
    },
    
    upload: {
      // Upload to Lighthouse CI Server
      target: "lhci",
      serverBaseUrl: "https://lhci.example.com",
      token: process.env.LHCI_TOKEN,
      
      // Or use temporary public storage
      // target: "temporary-public-storage",
    },
  },
};
```

## GitHub Actions Workflow
```yaml
# .github/workflows/lighthouse.yml
name: Lighthouse CI

on:
  pull_request:
    branches: [main]
  push:
    branches: [main]

jobs:
  lighthouse:
    runs-on: ubuntu-latest
    
    steps:
      - uses: actions/checkout@v4
      
      - name: Setup Node.js
        uses: actions/setup-node@v4
        with:
          node-version: "20"
          cache: "npm"
      
      - name: Install dependencies
        run: npm ci
      
      - name: Build application
        run: npm run build
        env:
          NODE_ENV: production
      
      - name: Run Lighthouse CI
        uses: treosh/lighthouse-ci-action@v11
        with:
          configPath: "./lighthouserc.js"
          uploadArtifacts: true
          temporaryPublicStorage: true
        env:
          LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }}
      
      - name: Upload Lighthouse Report
        uses: actions/upload-artifact@v4
        with:
          name: lighthouse-report
          path: .lighthouseci/
          retention-days: 30

  # Comparison job for PRs
  compare:
    if: github.event_name == 'pull_request'
    runs-on: ubuntu-latest
    needs: lighthouse
    
    steps:
      - name: Download PR artifacts
        uses: actions/download-artifact@v4
        with:
          name: lighthouse-report
          path: ./pr-report
      
      - name: Compare with main
        run: |
          # Custom comparison script
          node scripts/compare-lighthouse.js
      
      - name: Comment on PR
        uses: actions/github-script@v7
        with:
          script: |
            const fs = require('fs');
            const report = JSON.parse(fs.readFileSync('./comparison.json'));
            
            const body = `## Lighthouse Report
            
            | Metric | Main | PR | Diff |
            |--------|------|----|----|
            | Performance | ${report.main.performance} | ${report.pr.performance} | ${report.diff.performance} |
            | LCP | ${report.main.lcp}ms | ${report.pr.lcp}ms | ${report.diff.lcp}ms |
            | CLS | ${report.main.cls} | ${report.pr.cls} | ${report.diff.cls} |
            `;
            
            github.rest.issues.createComment({
              issue_number: context.issue.number,
              owner: context.repo.owner,
              repo: context.repo.repo,
              body: body
            });
```

## Custom Performance Budget
```javascript
// budget.json
[
  {
    "path": "/*",
    "resourceSizes": [
      { "resourceType": "script", "budget": 300 },
      { "resourceType": "stylesheet", "budget": 100 },
      { "resourceType": "image", "budget": 500 },
      { "resourceType": "font", "budget": 100 },
      { "resourceType": "total", "budget": 1500 }
    ],
    "resourceCounts": [
      { "resourceType": "script", "budget": 15 },
      { "resourceType": "stylesheet", "budget": 5 },
      { "resourceType": "image", "budget": 30 }
    ],
    "timings": [
      { "metric": "first-contentful-paint", "budget": 1800 },
      { "metric": "largest-contentful-paint", "budget": 2500 },
      { "metric": "cumulative-layout-shift", "budget": 0.1 },
      { "metric": "total-blocking-time", "budget": 300 }
    ]
  },
  {
    "path": "/checkout",
    "timings": [
      { "metric": "interactive", "budget": 3000 }
    ]
  }
]
```

## Lighthouse CI Server Setup
```bash
# Docker deployment
docker run -d \
  --name lhci-server \
  -p 9001:9001 \
  -e LHCI_NO_LIGHTHOUSERC=true \
  -v lhci-data:/data \
  patrickhulce/lhci-server

# Create project and get token
docker exec -it lhci-server lhci wizard
```

## Tracking Reports Over Time
```typescript
// scripts/analyze-trends.ts
import { getClient } from "@lhci/utils/src/api-client";

async function analyzeTrends() {
  const client = getClient({
    rootURL: "https://lhci.example.com",
    token: process.env.LHCI_TOKEN,
  });
  
  const project = await client.findProjectBySlug("my-app");
  const builds = await client.getBuilds(project.id, { limit: 30 });
  
  // Calculate trends
  const performanceScores = builds.map(b => b.performanceScore);
  const averageScore = performanceScores.reduce((a, b) => a + b) / performanceScores.length;
  const trend = performanceScores[0] - performanceScores[performanceScores.length - 1];
  
  console.log(`Average Performance: ${averageScore.toFixed(2)}`);
  console.log(`30-day Trend: ${trend > 0 ? "+" : ""}${trend.toFixed(2)}`);
  
  // Alert on degradation
  if (trend < -5) {
    await sendSlackAlert({
      message: `Performance degradation detected: ${trend.toFixed(2)} points over 30 days`,
    });
  }
}
```

## Best Practices
- Run Lighthouse CI on every PR
- Set appropriate thresholds for your app
- Track metrics over time for trend analysis
- Use performance budgets to prevent bloat
- Compare against main branch baseline
- Generate reports for stakeholder visibility

When to Use This Prompt

This Lighthouse prompt is ideal for developers working on:

  • Lighthouse applications requiring modern best practices and optimal performance
  • Projects that need production-ready Lighthouse code with proper error handling
  • Teams looking to standardize their lighthouse development workflow
  • Developers wanting to learn industry-standard Lighthouse patterns and techniques

By using this prompt, you can save hours of manual coding and ensure best practices are followed from the start. It's particularly valuable for teams looking to maintain consistency across their lighthouse implementations.

How to Use

  1. Copy the prompt - Click the copy button above to copy the entire prompt to your clipboard
  2. Paste into your AI assistant - Use with Claude, ChatGPT, Cursor, or any AI coding tool
  3. Customize as needed - Adjust the prompt based on your specific requirements
  4. Review the output - Always review generated code for security and correctness
💡 Pro Tip: For best results, provide context about your project structure and any specific constraints or preferences you have.

Best Practices

  • ✓ Always review generated code for security vulnerabilities before deploying
  • ✓ Test the Lighthouse code in a development environment first
  • ✓ Customize the prompt output to match your project's coding standards
  • ✓ Keep your AI assistant's context window in mind for complex requirements
  • ✓ Version control your prompts alongside your code for reproducibility

Frequently Asked Questions

Can I use this Lighthouse prompt commercially?

Yes! All prompts on Antigravity AI Directory are free to use for both personal and commercial projects. No attribution required, though it's always appreciated.

Which AI assistants work best with this prompt?

This prompt works excellently with Claude, ChatGPT, Cursor, GitHub Copilot, and other modern AI coding assistants. For best results, use models with large context windows.

How do I customize this prompt for my specific needs?

You can modify the prompt by adding specific requirements, constraints, or preferences. For Lighthouse projects, consider mentioning your framework version, coding style, and any specific libraries you're using.

Related Prompts

💬 Comments

Loading comments...