# Use Lighthouse with Seikika

Run Lighthouse against a page and use Seikika to track independent budgets for performance, accessibility, best practices and SEO. Reports that include the agentic browsing category also score how well browser agents can navigate the page. Each category earns `within-budget` at 90/100. Edit `minimum` in the example portal to adopt a different target. Lighthouse runs the audits. This site-maintained Seikika package reads the saved results and measures each category's shortfall.

Shopify uses Lighthouse as an admission requirement for its Theme Store. It measures home, product and collection pages on both desktop and mobile, with minimum averages of 60 for performance and 90 for accessibility. Teams adopting this recipe can choose a budget that matches their own routes, devices and users. [Shopify Theme Store requirements](https://shopify.dev/docs/storefronts/themes/store/requirements)

## Install the recipe

From your application's repository, use the origin of this catalog as `SITE_URL`. This example creates a separate portal in `.lighthouse`.

```sh
curl -fsSLO "$SITE_URL/recipes/lighthouse.tar.gz" &&
  curl -fsSLO "$SITE_URL/recipes/lighthouse.tar.gz.sha256" &&
  sha256sum -c lighthouse.tar.gz.sha256 &&
  tar -xzf lighthouse.tar.gz
```

On macOS, use `shasum -a 256 -c lighthouse.tar.gz.sha256` for checksum verification. With a local checkout of Seikika, copy `sites/good-standard-bad-standard/public/recipes/lighthouse` to `.lighthouse` instead. Use Node.js 24, Chrome or Chromium, the Seikika CLI and its matching runner connector. Install the pinned audit tool in the project and commit the resulting lockfile.

```sh
npm install --save-dev --save-exact lighthouse@13.6.0
```

## Measure a page

Start the production build at a stable URL. From the root of your application, run the following with `PAGE_URL` set to the page you want to improve.

```sh
cd .lighthouse
seikika validate . &&
  npx --no-install lighthouse "$PAGE_URL" --chrome-flags="--headless" --output=json --output-path=./report.json &&
  seikika report . --all
```

The scorecard rounds each Lighthouse category to the displayed whole-number score. At 87 with a target of 90, performance fails with a three-point shortfall. Each result identifies the final page URL and category. Failure evidence includes the capture time and tool version. Keep the full report as a build artifact so reviewers can inspect individual audits. Repeat under the same browser, device preset and throttling conditions when performance scores fluctuate.

## Compare two revisions

For a performance decision, capture at least three reports per revision. Use the same final route, Chrome and Lighthouse versions, device profile and throttling settings. Name the files by revision and run so every observation survives. For example, from `.lighthouse`:

```sh
mkdir -p captures/baseline
for run in 1 2 3; do
  npx --no-install lighthouse "$PAGE_URL" --chrome-flags="--headless" --output=json --output-path="./captures/baseline/$run.json" || exit 1
done
```

Repeat into `captures/candidate` after deploying the candidate to the same test URL. Compare the middle performance score of each three-run set against the agreed budget. Report each run and identify any excluded capture and its configuration difference. Inspect accessibility independently and link the full Lighthouse audits supporting a regression. The example Seikika portal evaluates one capture per invocation. Copy the selected capture to `report.json` and keep its original filename alongside the reported score.

## Gate regressions

Read the first report, then record the starting budget for each category. Commit the baseline. In subsequent runs, regenerate `report.json` before checking the baseline from the same directory.

```sh
seikika report . --baseline results.json --update
```

```sh
seikika report . --baseline results.json --fail-on-unknown
```

A growing shortfall fails the ratchet. The categories retain independent evidence, so a gain in SEO cannot offset a drop below the accessibility budget. Automated accessibility checks cover a subset of user needs. Test keyboard and screen-reader journeys alongside the score.

## Add to an existing portal

Copy this recipe's package directory and adapter into your repository. Add an include to your portal's existing `include` array. Resolve the package path relative to the manifest, and the adapter and report paths relative to where you run `seikika report`. For a portal in `.seikika`, a recipe in `.lighthouse` and a report command run at the repository root, use this entry.

```yaml
- package: ../.lighthouse/package
  with:
    minimum: 90
    command: [node, .lighthouse/records.mjs, .lighthouse/report.json]
```

## Try the guided interpretation case

The [offline Lighthouse comparison trial](/evidence/lighthouse/README.md) includes synthetic captures, a fixed question and an independent grader. It exercises configuration matching, median calculation and independent accessibility interpretation.

## Prompt for an agent

> Use this Lighthouse recipe on the application's main user journey. Record the audited URL, Lighthouse version, configuration and each starting category score. Inspect the full report, choose one failing audit that affects the journey, and make the smallest relevant fix. Repeat Lighthouse under the same settings, run the Seikika scorecard and report the before-and-after scores with paths to both reports. Review performance variance across repeated captures. Preserve the existing thresholds and baseline while diagnosing regressions.

[Lighthouse documentation](https://developer.chrome.com/docs/lighthouse/overview/) · [Lighthouse scoring](https://developer.chrome.com/docs/lighthouse/performance/performance-scoring/) · [Seikika runner connector](https://github.com/seikika/seikika/blob/main/docs/reference/runner-connector.md)
