storybook-startup-benchmark
Skill này làm gì
Skill này hướng dẫn AI đo thời gian khởi động Storybook, từ lúc chạy máy chủ đến lúc hiển thị câu chuyện đầu tiên. Skill dành cho lập trình viên muốn so sánh tốc độ giữa các phiên bản hoặc thay đổi.
Khi nào nên dùng
- ✓Khi bạn muốn biết Storybook mất bao lâu để khởi động cho dự án của mình.
- ✓Khi bạn nghi một phiên bản mới làm Storybook khởi động chậm hơn.
- ✓Khi bạn muốn các phép đo lặp lại để so sánh hai phiên bản hoặc cài đặt.
Liên kết skill
https://github.com/storybookjs/storybook/blob/next/.agents/skills/storybook-startup-benchmark/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Đo thời gian Storybook của chúng tôi khởi động, chạy năm lần, và cho tôi xem trung bình.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
AI khởi động Storybook mà không mở trình duyệt, chờ đến khi máy chủ phản hồi, rồi mở một trang và đo thời gian câu chuyện đầu tiên xuất hiện. Nó có thể lặp lại lần chạy và tóm tắt kết quả.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
Storybook Startup Benchmark
Purpose
Use this skill to build or explain a repeatable benchmark for Storybook startup:
server: process spawn -> Storybook server respondsbrowser: server responds -> first story renderedtotal: process spawn -> first story rendered
Quick Start
When asked to benchmark Storybook startup:
- Confirm the boundary:
- Start timing immediately before spawning
storybook dev - Open Storybook at
/, notiframe.html - Stop timing on first story mount plus one
requestAnimationFrame()
- Start timing immediately before spawning
- Check whether the repo already has a benchmark script. Reuse it if possible.
- If not, create a Node script that:
- starts Storybook without opening a browser
- waits for the server to respond
- launches a browser it controls
- waits for a preview-side render signal
- prints JSON results
- Add
--repeat <count>support with grouped summary stats.
Measurement Rules
Use these defaults unless the user asks otherwise:
- Start URL:
/ - Browser path: normal manager page, let Storybook load the preview iframe itself
- Render signal: first preview story mount + one
requestAnimationFrame() - Browser launch: external harness launches the browser, not Storybook
- Auto-open: keep Storybook from opening a browser. Storybook 11 opens one only with
--open; Storybook 10 and older need--no-open
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:
- wait one
requestAnimationFrame() - set a global value like
window.__sbStartupBenchmark - also mirror that value to
window.topwhen same-origin - optionally call
performance.mark('sb:first-story-rendered')
Preferred payload:
{
firstStoryRenderedAt: performance.now(),
storyId: id
}
2. Harness behavior
The benchmark script should:
- Fail fast if the target Storybook port is already in use
- Spawn Storybook without opening a browser
- Start timing immediately before spawn
- Wait for HTTP readiness on the Storybook URL
- Launch a controlled browser to
/ - Wait for the preview-side signal
- Print JSON results
- Kill the full spawned process group during cleanup
3. Repeated runs
For --repeat N, print:
- per-run results
- summary stats grouped by
server,browser, andtotal - human-readable durations like
5.2sor2m15s, not raw millisecond field names
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:
- If
servergrows, the regression is likely on the server/build side. - If
browsergrows, the regression is likely in manager boot, preview boot, or first-story render. - If averages are close but
p95grows a lot, the feature likely increases variability or tail latency. - If newer Storybook without a feature is much faster than older Storybook, but enabling the feature returns timings to older levels, the feature likely erases the newer startup gains.
Common Pitfalls
- Existing Storybook already running on the benchmark port
- Storybook auto-opening a separate browser window
- Measuring direct
iframe.htmlloads instead of normal/ - Leaving child Storybook processes alive between runs
- Treating warm repeated runs as cold-start data
If a repeated benchmark reports unrealistically low server.average, first check for a stale Storybook server on the same port.
Tooling Notes
- Prefer a plain Node script for portability.
- For Chrome-family browsers, remote debugging is a practical control path.
- If Storybook CLI flags or behavior are in question, fetch current Storybook docs first.
Output Style
When reporting results:
- clearly separate
server,browser, andtotal - call out averages and p95 first, with min/max as supporting bounds
- highlight whether the regression affects common-case latency, tail latency, or both
- avoid claiming root cause unless the benchmark isolates server vs render behavior
Example Triggers
Use this skill when the user says things like:
- "How can I test Storybook
Câu hỏi thường gặp
Những gì được đo?
Ba phần: thời gian khởi động máy chủ, thời gian trình duyệt đến câu chuyện đầu tiên, và tổng thời gian.
Nó có mở cửa sổ trình duyệt không?
Skill nói Storybook không nên tự mở trình duyệt, và một công cụ bên ngoài sẽ khởi chạy trình duyệt.
Nó có so sánh phiên bản được không?
Có. Skill nói nó có thể so sánh các phiên bản Storybook hoặc cờ tính năng bằng các lần chạy lặp lại.
Chi tiết
Mô tả gốc của tác giả
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 flags.
repo: storybookjs/storybook
Độ phổ biến
- Sao GitHub
- 91k
- Vị trí xếp hạng
- #1321
- Giấy phép
- MIT
- Cập nhật
- 2/11/2026
Bình luận
- …
Thêm skill từ kho mã này
handle-pr-comments
91kGiúp agent của bạn xử lý từng bình luận review trên pull request GitHub, đề xuất cách sửa, áp dụng lựa chọn của bạn và đóng luồng thảo luận.
principle-encode-lessons-in-structure
91kDạy agent của bạn biến các lỗi lặp lại thành kiểm tra tự động, như quy tắc lint hoặc script, thay vì viết lại cùng một lời nhắc nhở.
storybook-upgrade
91kChỉ cho agent của bạn cách nâng cấp mọi package Storybook trong dự án lên phiên bản đã chọn, mỗi lần một phiên bản major.
update-pr-description
91kGiúp agent của bạn kiểm tra tiêu đề và mô tả pull request còn khớp với thay đổi code không, rồi đề xuất cập nhật chính xác.
Skill tương tự
test-driven-development
311kDạy agent của bạn viết kiểm thử thất bại trước, xem nó thất bại, rồi viết đoạn mã ngắn nhất để vượt qua trước khi làm bất kỳ tính năng hay bản sửa nào.
verification-before-completion
311kDạy agent của bạn chạy kiểm tra thực tế và đọc kết quả đầu ra trước khi khẳng định một việc, bản sửa hoặc bản build đã hoàn thành hay vượt qua.
migrate-to-shoehorn
310kThay các ép kiểu rủi ro trong tệp kiểm thử bằng thư viện shoehorn, để các bài kiểm thử dùng dữ liệu một phần vẫn qua được kiểm tra kiểu.