Storybook startup benchmark

From storybookjs/storybook · View interactive version

Storybook startup benchmark is an AI agent skill from the GitHub repository storybookjs/storybook. Measure Storybook startup time from spawning `storybook dev` until the first story renders in the browser. Use when the user asks about Storybook boot time, server-ready timing, first story render timing, startup regressions, benchmarking with repeat runs, or comparing Storybook versions or feature

How to use this skill

Skill file

Storybook Startup Benchmark

Purpose

Use this skill to build or explain a repeatable benchmark for Storybook startup:

Quick Start

When asked to benchmark Storybook startup:

  1. Confirm the boundary:
  1. Check whether the repo already has a benchmark script. Reuse it if possible.
  2. If not, create a Node script that:
  1. Add --repeat <count> support with grouped summary stats.

Measurement Rules

Use these defaults unless the user asks otherwise:

Do not measure only CLI output. Server listening is not the same as first story rendered.

Recommended Implementation

1. Preview-side signal

Add a small global preview decorator or component that runs once on the first story mount:

Preferred payload:

{
  firstStoryRenderedAt: performance.now(),
  storyId: id
}

2. Harness behavior

The benchmark script should:

  1. Fail fast if the target Storybook port is already in use
  2. Spawn Storybook without opening a browser
  3. Start timing immediately before spawn
  4. Wait for HTTP readiness on the Storybook URL
  5. Launch a controlled browser to /
  6. Wait for the preview-side signal
  7. Print JSON results
  8. Kill the full spawned process group during cleanup

3. Repeated runs

For --repeat N, print:

Recommended summary fields:

{
  "server": {
    "average": "5.2s",
    "min": "4.8s",
    "max": "6.1s",
    "p95": "6.0s"
  },
  "browser": {
    "average": "1.9s",
    "min": "1.6s",
    "max": "2.4s",
    "p95": "2.3s"
  },
  "total": {
    "average": "7.1s",
    "min": "6.6s",
    "max": "8.2s",
    "p95": "8.1s"
  }
}

Interpretation Guidance

Use these heuristics when explaining results:

Common Pitfalls

If a repeated benchmark reports unrealistically low server.average, first check for a stale Storybook server on the same port.

Tooling Notes

Output Style

When reporting results:

Example Triggers

Use this skill when the user says things like:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.