Agent skill

Storybook Visual Testing

by igrlk in igrlk/storybook-addon-test-codegen

Make Storybook stories deterministic for UI Verify so captures stop coming back "changed" without a real change (flaky diffs).

MITAuto-check passedFrontend & Design

Install Storybook Visual Testing

skills CLI
$ npx skills add igrlk/storybook-addon-test-codegen --skill storybook-visual-testing -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install igrlk/storybook-addon-test-codegen storybook-visual-testing --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/igrlk/storybook-addon-test-codegen.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/storybook-visual-testing .claude/skills/storybook-visual-testing && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
storybook-visual-testing
GitHub stars
154
Token cost
~1.9k tokens
SKILL.md length
894 words
Files
1
Skills in repo
5
Repo updated
First seen
Licence
MIT

At a glance

Make Storybook stories deterministic for UI Verify so captures stop coming back "changed" without a real change (flaky diffs).

  • Works in 5 steps: Freeze the data — the one that actually… → Freeze the clock → Infinite JS animations → …
  • Setting up story-level visual tests
  • SKILL.md covers Mental model — Storybook…, The checklist (only what the… and Anti-patterns
  • Calls npm

What it does

Storybook Visual Testing is an agent skill from igrlk/storybook-addon-test-codegen. Make Storybook stories deterministic for UI Verify so captures stop coming back "changed" without a real change (flaky diffs). Use when setting up story-level visual tests or debugging a story that diffs every run. Focuses only on the run-to-run variation the capturer can't neutralize from outside your app — the clock, infinite JS animations, live data, and non-Math.random randomness — and deliberately skips what UI Verify already handles for you.

Its SKILL.md is about 1.9k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Frontend & Design, covering Visual regression testing. It works with Storybook and React. The repository describes itself as: Addon for Storybook that generates test code for your stories. The licence is MIT.

When your agent uses it

  • Setting up story-level visual tests
  • Debugging a story that diffs every run

Example prompts

  • “changed”
  • “/storybook-visual-testing”

Workflow steps

5 steps, taken from the step headings in SKILL.md.

  1. Freeze the data — the one that actually matters
  2. Freeze the clock
  3. Infinite JS animations
  4. Non-Math.random randomness
  5. Dynamic layout

What it can do on your machine

Read from SKILL.md and the folder at commit cdfbf4e. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • npm

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • storybook.js.org
    • npmjs.com
    • github.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Storybook Visual Testing loads about 1.9k tokens when it runs. Until then it costs about 119 tokens; SKILL.md has 894 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~119
When it runs · the whole SKILL.md, loaded when a task matches
~1.9k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from igrlk/storybook-addon-test-codegen at commit cdfbf4e, republished under its MIT licence (© igrlk). 894 words, ~1,859 tokens.

Download SKILL.mdSave it as .claude/skills/storybook-visual-testing/SKILL.md (or your agent's skills folder).
name
storybook-visual-testing
description
Make Storybook stories deterministic for UI Verify so captures stop coming back "changed" without a real change (flaky diffs). Use when setting up story-level visual tests or debugging a story that diffs every run. Focuses only on the run-to-run variation the capturer can't neutralize from outside your app — the clock, infinite JS animations, live data, and non-Math.random randomness — and deliberately skips what UI Verify already handles for you.

Deterministic Storybook stories

Mental model — Storybook already removed most of the flake

UI Verify renders each story as a baseline. Because a story is an isolated component in a controlled harness, you get for free the things that make real-page capture hard: no page scroll, no A/B / analytics / chat / consent scripts, no lazy-load-on-scroll races. That isolation is the point — the determinism work here is narrow. If you reach for scroll-settling or third-party stubbing, you're fighting a problem Storybook already removed; that's a real-page concern (see playwright-visual-testing).

UI Verify's capturer also neutralizes these automatically — do NOT hand-fix them:

  • CSS animations & transitions (killed at render), and the Web Animations API (disabled).
  • prefers-reduced-motion: reduce — emulated, so any component that honors it renders its calm state.
  • Math.random — seeded before your app code runs (a shuffle/jitter driven by Math.random is already stable).
  • Web fonts and <img> loading — waited for before capture.
  • Finite JS animations (a Recharts entry draw, react-smooth) — captured at their settled final frame. You don't need to disable these.

So the checklist below is only the remainder — what lives inside your app and can't be fixed from outside it. And like Vitest browser mode (vitest-visual-testing) and unlike a real page, a story has no SSR — no server-rendered random pick to reconcile.

The headline: freeze the data. Once the list above is off the table, the one thing left that floods a story suite with false "changes" is live/dynamic data — star counts, follower counts, contributor lists, tiles, timestamps. Give every story static args / fixtures and that entire class disappears at the source: static data can't churn run-to-run, so there is nothing to diff. This is the single highest-value determinism step here — do it first (step 1), and most stories need nothing else.

Point UI Verify at your built stories:

bash
npm run build-storybook && uiverify upload --static-dir storybook-static

The checklist (only what the tool can't do for you)

1. Freeze the data — the one that actually matters

A story fed live/dynamic data is flaky by construction: the stars, followers, contributor list, tile order, and timestamps move between runs, so the diff lights up with no code change. Give every story static args/fixtures and the whole class is gone. Never let a story hit a real backend.

Concrete — fixed, ordered, complete data:

  • fixed counts (stars, followers, downloads) — literal args, not a live fetch;
  • a fixed contributor/author list: fixed names and avatar URLs (or inlined avatars), in a fixed order;
  • a fixed set of tiles/rows in a fixed order (a live "trending" sort reorders every run);
  • fixed timestamps (pair with the clock, step 2).

Two ways to inject them, both fine:

  • args — the Storybook-native path: pass the component's data as fixed args on the story;
  • mock the fetch — when a story fetches internally, MSW via msw-storybook-addon returns the same response every time.

One component per story file, every variant × state in one story where you can — cheaper and easier to eyeball than N near-identical stories. Keep each in its own file so --only-changed carries the untouched ones forward, and add a path filter so the visual job only runs on UI PRs.

Show full SKILL.md (410 more words)Show less
2. Freeze the clock

The one thing the capturer deliberately does not do (freezing time breaks entry animations). Any component that reads the clock — a relative timestamp, a date picker defaulting to "today", a chart's day axis — drifts every run. Pin it with storybook-addon-mock-date (Storybook 10+), which mocks Date per story:

ts
// .storybook/main.ts
addons: ['storybook-addon-mock-date'],
ts
// .storybook/preview.ts — a fixed date for every story (meta- or story-level overrides it)
export default { parameters: { mockingDate: new Date('2020-01-01T00:00:00Z') } };

Pass a Date, a millisecond timestamp, or an ISO string as mockingDate; the most specific value (story > meta > preview) wins, so a single story can pin its own "today". On older Storybook, install @sinonjs/fake-timers in a decorator instead (install({ now: FROZEN_NOW })) — it covers Date, Date.now, and timers in one call.

3. Infinite JS animations

A CSS/WAAPI/finite animation is handled for you (above). What's left is an infinite JS loop that never has a final frame — framer-motion pulsing dots, a Lottie loop, an autoplay spinner, or a <canvas> / requestAnimationFrame loop (which no media query can reach). Two fixes:

  • Preferred — honor reduced motion. The capturer emulates prefers-reduced-motion: reduce, so make the component respect it. framer-motion ignores it by default (reducedMotion: "never"); opt in:

    tsx
    // .storybook/preview.tsx decorator
    <MotionConfig reducedMotion="user"><Story /></MotionConfig>

    or gate the loop yourself with useReducedMotion(). One line, and it's good app behavior anyway.

  • Escape hatch — detect the capture and render the end state. UI Verify flags every capture with a UIVerify marker on the user-agent and a window.__UI_VERIFY__ global, so a component can branch:

    ts
    export const isUIVerify = () =>
      (typeof navigator !== 'undefined' && navigator.userAgent.includes('UIVerify')) ||
      (typeof window !== 'undefined' && '__UI_VERIFY__' in window);
    tsx
    <RadarChart isAnimationActive={!isUIVerify()} />

    Prefer pausing at the end frame, not the start. For a hand-rolled <canvas> rAF loop the same branch applies: if (isUIVerify()) drawOneStaticFrame(); else startRaf(); in the component's effect.

4. Non-Math.random randomness

Math.random is seeded for you, but crypto.randomUUID(), a uuid library, or faker are not. Use fixed fixtures for anything that ends up on screen (an id in the DOM, a faker name), or set a fixed faker seed.

5. Dynamic layout

A JS-measured layout that reflows or reorders on its own (packing driven by measured size, a shuffled list) can vary run-to-run even with identical content. Force a deterministic variant in the story (a fixed order/size), or mask the region.

Anti-patterns

  • A story that fetches live data → mock it (MSW).
  • Disabling CSS animations / seeding Math.random / waiting on fonts by hand → wasted effort; the capturer already does all three. Spend the effort on the clock and infinite loops.
  • Unseeded crypto/uuid/faker or a bare Date.now() → fixtures + freeze the clock.
  • Reaching for scroll-settle / A-B stubbing → wrong path; that's a real-page concern.

© igrlk, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .agents/skills/storybook-visual-testing of igrlk/storybook-addon-test-codegen.

Open the folder on GitHubat commit cdfbf4e

Compare with similar skills

Storybook Visual Testing next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Storybook Visual Testing compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Storybook Visual Testing this skilligrlk/storybook-addon-test-codegen154—~1.9kAutomated safety check: PassMIT
Storybook Checkrstackjs/storybook-rsbuild156—~2.5kAutomated safety check: PassMIT
Wonder BlocksKhan/wonder-blocks163—~3.2kAutomated safety check: PassMIT
Vrtmarigold-ui/marigold146—~787Automated safety check: PassMIT
DaleuiDaleStudy/daleui119—~675Automated safety check: PassMIT
Storybook Syncrstackjs/storybook-rsbuild156—~5.2kAutomated safety check: PassMIT

Similar skills

  • Storybook Check

    rstackjs/storybook-rsbuild

    Audit ported storybook-rsbuild source files against the CURRENT upstream Storybook source, grouped by the local package that owns each port, independent of commit history.

    156 GitHub stars~2.5k tokensUpdated 9 days ago
    Frontend & DesignAuto-check passed
  • Wonder Blocks

    Khan/wonder-blocks

    Implements user interfaces using the Wonder Blocks (WB) design system — Khan Academy's React component library.

    163 GitHub stars~3.2k tokensUpdated today
    Frontend & DesignAuto-check passed
  • Vrt

    marigold-ui/marigold

    DST — Trigger the Visual-Regression-Tests (Chromatic) GitHub Actions workflow on the current or a given branch.

    146 GitHub stars~787 tokensUpdated today
    Frontend & DesignAuto-check passed
  • Daleui

    DaleStudy/daleui

    Use the daleui React design system with semantic Panda CSS tokens and accessible components.

    119 GitHub stars~675 tokensUpdated 2 days ago
    Frontend & DesignAuto-check passed
  • Storybook Sync

    rstackjs/storybook-rsbuild

    Check and analyze upstream Storybook repository changes that may need to be synced to storybook-rsbuild.

    156 GitHub stars~5.2k tokensUpdated 9 days ago
    Frontend & DesignAuto-check passed
  • Qovery UI

    Qovery/console

    Design review and implementation guidance for the Qovery Console.

    227 GitHub stars~2k tokensUpdated today
    Frontend & DesignAuto-check passed

More from igrlk/storybook-addon-test-codegen

  • Check Visual Changes

    igrlk/storybook-addon-test-codegen

    Check the visual impact of an edit mid-task with uiverify check — render just the components you're touching on the UI Verify fleet and diff them against the real CI baseline, without opening a PR…

    154 GitHub starsUsed in 1 repo~1.4k tokens
    Auto-check passed
  • Economical Visual Tests

    igrlk/storybook-addon-test-codegen

    Author economical visual tests — full visual coverage in the fewest billable snapshots.

    154 GitHub starsUsed in 1 repo~1.1k tokens
    Auto-check passed
  • Triage Visual Changes

    igrlk/storybook-addon-test-codegen

    Triage a UI Verify build from your coding agent via the UI Verify MCP — bucket a build's changed stories into real regressions vs cosmetic reflow vs rendering noise, summarize the real regressions…

    154 GitHub starsUsed in 1 repo~2.9k tokens
    Auto-check passed
  • Making UI Changes

    igrlk/storybook-addon-test-codegen

    Read before changing any component, page, or styles. An agent skill from igrlk/storybook-addon-test-codegen.

    154 GitHub starsUsed in 1 repo~493 tokens
    Auto-check passed

Works with

Questions about Storybook Visual Testing

What does Storybook Visual Testing do?

Make Storybook stories deterministic for UI Verify so captures stop coming back "changed" without a real change (flaky diffs). Storybook Visual Testing is an agent skill from igrlk/storybook-addon-test-codegen. Make Storybook stories deterministic for UI Verify so captures stop coming back "changed" without a real change (flaky diffs).

When should I use Storybook Visual Testing?

Storybook Visual Testing fits situations like: setting up story-level visual tests; debugging a story that diffs every run.

How do I install Storybook Visual Testing in Claude Code?

Run `npx skills add igrlk/storybook-addon-test-codegen --skill storybook-visual-testing -a claude-code`. Or copy the skill folder (.agents/skills/storybook-visual-testing in igrlk/storybook-addon-test-codegen) into .claude/skills/storybook-visual-testing in your project. Claude Code loads it when a task matches its description.

How do I install Storybook Visual Testing in Codex?

Run `npx skills add igrlk/storybook-addon-test-codegen --skill storybook-visual-testing -a codex`. Or copy the skill folder (.agents/skills/storybook-visual-testing in igrlk/storybook-addon-test-codegen) into .agents/skills/storybook-visual-testing in your project. Codex loads it when a task matches its description.

Can I use Storybook Visual Testing in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add igrlk/storybook-addon-test-codegen --skill storybook-visual-testing -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/storybook-visual-testing, .gemini/skills/storybook-visual-testing, .github/skills/storybook-visual-testing and .opencode/skills/storybook-visual-testing in your project.

What does Storybook Visual Testing need to run?

Going by SKILL.md and its folder, Storybook Visual Testing needs the command-line tools its instructions call (npm).

Does Storybook Visual Testing access the network?

SKILL.md names 3 domains. As links in the text: storybook.js.org, npmjs.com and github.com. This is read from the text; nothing was executed.

Is Storybook Visual Testing safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Storybook Visual Testing use?

Storybook Visual Testing is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Storybook Visual Testing use?

About 1.9k tokens (SKILL.md is roughly 7.4k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Storybook Visual Testing?

Skills that share tags, products or a category with Storybook Visual Testing: Storybook Check (rstackjs/storybook-rsbuild, 156 stars), Wonder Blocks (Khan/wonder-blocks, 163 stars), Vrt (marigold-ui/marigold, 146 stars) and Daleui (DaleStudy/daleui, 119 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Storybook Visual Testing?

igrlk (a GitHub user) maintains it in igrlk/storybook-addon-test-codegen, which has 154 GitHub stars. The repository holds 5 skills in this directory. The repository was last updated on September 13, 2026.

Source: igrlk/storybook-addon-test-codegen on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.