Chuyển đến nội dung
Skillpedia
Kiểm thử33k · #9145

sbshot-visual-diff

Skill này làm gì

Skill này hướng dẫn agent AI dùng công cụ sbshot để chụp các story Storybook ở hai phiên bản git và so sánh chúng. Skill dành cho các đội frontend muốn có bằng chứng trực quan về những gì pull request đã thay đổi.

Khi nào nên dùng

  • ✓Khi bạn muốn có ảnh chụp màn hình trước và sau cho các thay đổi giao diện trong một pull request.
  • ✓Khi bạn cần chứng minh rằng một thay đổi không làm ảnh hưởng đến các màn hình mà nó không nên chạm tới.
  • ✓Khi bạn muốn có báo cáo so sánh trực quan để chia sẻ với người rà soát.

Liên kết skill

https://github.com/SigNoz/signoz/blob/main/.claude/skills/sbshot-visual-diff/SKILL.md

Sao 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

Hãy dùng skill này để giúp tôi: https://github.com/SigNoz/signoz/blob/main/.claude/skills/sbshot-visual-diff/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Bạn có thể chụp các story Storybook của chúng tôi trước và sau thay đổi này, rồi cho tôi biết màn hình nào khác nhau không?”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Agent chụp các story ở cả hai tham chiếu git, ghép các ảnh chụp theo đường dẫn, rồi tạo một bản so sánh mà người rà soát có thể mở.

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.

sbshot visual diffs

npx -y github:SigNoz/sbshot shoots Storybook stories and pixel-diffs two runs. Use it. Do not hand-roll a Playwright screenshot loop or a canvas pixel-compare: sbshot already handles story selection, themes, settling, retries, diffing, tagging, a viewer and a static export, and its runs are the format the rest of the team can open.

sbshot is not installed by any package. It is run through npx, so nothing it knows travels into this repo on its own. This file is where that knowledge lives.

The shape of a run

capture <storybook> --name-run <ref>     # once per git ref
diff <baseline> <after>                  # pairs them by relative path
tag <diff> <tag> <story-id>...           # what the reviewer should look at
export <diff> --out <dir>                # a static site, hostable

<storybook> is a running dev server (http://localhost:6006), a build directory holding index.json, or a project directory with .storybook/. The frontend has no build-storybook script, only storybook dev -p 6006, so point capture at a dev server.

Cover the change with stories first

A diff can only show what a story renders. A screen, state or variant with no story is invisible to sbshot: it produces no pair, so it reads as "nothing changed" rather than "never looked at". This is the failure mode that makes a clean-looking diff worthless.

Before capturing, list the screens and states the change touches and check each has a story. For anything missing, write it first — the signoz-page-story skill covers how. New states reached only by an interaction need a play function, or the capture shoots the page at rest and the state never appears.

Then confirm it worked: the two runs' story counts should differ by exactly the stories the change adds. A new screen that produced no new story id is a screen nobody is reviewing. Say the count in the summary, so a reader can tell coverage from silence.

Rules that are not optional

One freshly started Storybook per ref. Never start one server and switch git branches under it. Vite's HMR reloads the page, but some modules do not re-initialise, so the shot differs silently from a clean boot and the difference looks like a real change. Settle time does not fix this and is not the variable. Use one worktree and one port per ref, and stop each server before the next.

Capture both themes: --theme dark,light. Without it sbshot shoots the story's own default and everything lands in a single default/ folder, so every regression in the other theme is invisible. Themes double the shot count, so scope with --stories or --title, never by dropping a theme.

Baseline is the merge-base, not origin/main. git merge-base origin/main <branch>. Against a moved main, every commit main gained since the branch's base shows up reversed, as though the branch reverted it.

The percentage sorts the list, it does not tell you what matters. A dialog that dims the page scores high for a one-line change, and a whole new form section can score low. Open the shots and say what changed on each screen. The biggest number is usually the least interesting one.

If you cannot explain a pair, assume the capture is at fault, not the code. Open it, crop both sides and compare them before calling it noise. A pixel count and a good guess are not evidence.

Noise, and the floor that proves it

The same story does not always render identically twice. Pairs often move for reasons that have nothing to do with the change:

  • a focus ring left on whatever a play function clicked last
  • a scrollbar appearing, or its thumb resting a few pixels off
  • a toast, tooltip or dialog caught mid-fade
  • a text caret blinking, or a selection highlight
  • an animation or spinner at a different frame
  • relative timestamps ("2 days ago") crossing a boundary
  • hover or active styling from where the pointer happened to rest
  • a late-loading font or image shifting a line of text

Do not argue about these one at a time. Measure them: shoot the same commit twice and diff those two runs against each other. Anything that moves there moved for no reason, so it is noise.

capture <storybook> --name-run noise-a
capture <storybook> --name-run noise-b     # same tree, its own fresh server
diff noise-a noise-b --name-diff noise
diff <baseline> <after> --noise noise      # marks the movers flaky

The noise run has to cover the same stories as the real diff. Do not

Câu hỏi thường gặp

So sánh trực quan là gì?

Đó là việc so sánh ảnh chụp màn hình của hai phiên bản giao diện, làm nổi bật những thay đổi về điểm ảnh.

Vì sao cần story?

Skill cho biết một màn hình không có story sẽ không được chụp nên không thể so sánh.

Có cài đặt qua gói không?

Không. Skill chạy sbshot qua npx, nên công cụ sẽ được tải khi cần.

Chi tiết

Mô tả gốc của tác giả

Shoot Storybook stories with sbshot at two git refs and produce a diff a reviewer can read. Use when asked for a visual diff, before/after screenshots, a screenshot comparison for a PR, or to prove a change did not alter screens it should not have.

repo: SigNoz/signoz

Độ phổ biến

Sao GitHub
33k
Vị trí xếp hạng
#9145
Giấy phép
—
Cập nhật
2/11/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự