chromatic
FreeNo executable scriptsNot checkedChromatic is a visual testing service from the Storybook team that snapshots every story in a cloud browser and shows visual diffs for review on each pull…
by TerminalSkills★ 221 GitHub starsAbout this skill
Chromatic
Overview
Chromatic is a hosted visual testing and review platform made by the maintainers of Storybook. The chromatic CLI builds and publishes your Storybook, Chromatic captures a snapshot of every story in cloud browsers, compares it with the accepted baseline, and lists the differences in a web UI where designers and developers accept or deny them. The same service also snapshots Playwright, Cypress and Vitest tests through the @chromatic-com/playwright, @chromatic-com/cypress and @chromatic-com/vitest packages. This skill covers the Storybook workflow.
Instructions
Initial assessment
- Which Storybook version, and which framework package (
@storybook/react-vite,@storybook/nextjs, ...)? - Does it build locally (
npm run build-storybook)? Chromatic needs a working static build. - Which CI provider, and who reviews visual changes?
Setup
npm install --save-dev chromatic
export CHROMATIC_PROJECT_TOKEN=chpt_... # from the project's Manage page on chromatic.com
npx chromatic
The CLI reads CHROMATIC_PROJECT_TOKEN from the environment (preferred over the --project-token flag, which leaks into shell history and CI logs). The first build becomes the baseline; later builds are compared with it and marked "unreviewed" until someone accepts or denies the changes. The CLI needs Node 22 or newer.
Story parameters
Set parameters.chromatic at the project (.storybook/preview.ts), component (meta) or story level:
delay: 300waits that many milliseconds before the snapshot.diffThreshold: 0.063is the default sensitivity (0 most sensitive, 1 least); raise it to ignore anti-aliasing noise.disableSnapshot: trueskips a story, for example one that is purely animated.ignoreSelectors: ['.product-price']ignores pixels in matching elements. Equivalent markup:data-chromatic="ignore"or thechromatic-ignoreclass. A size change of the ignored element still counts as a change.modescaptures a story under several viewport/theme combinations (see Modes below). The olderviewportsparameter is legacy; use modes.
Interaction tests
Chromatic runs each story's play function and takes the snapshot after it finishes. In Storybook 9 and 10, import the test utilities from storybook/test; the old @storybook/testing-library and @storybook/jest packages are deprecated.
Configuration file
chromatic.config.json in the project root (JSON, not a JS module) holds a subset of CLI options. Keys: buildScriptName, storybookBuildDir, onlyChanged, externals, skip, autoAcceptChanges, exitZeroOnChanges, exitOnceUploaded. Boolean-or-glob options accept branch globs, for example "autoAcceptChanges": "main". Keep the token out of this file.
TurboSnap
onlyChanged: true snapshots only stories affected by the changed files, using the bundler's dependency graph (Webpack or Vite) and full git history, so CI must fetch with fetch-depth: 0. Changes to .storybook/preview, static files, a mismatched lockfile, or paths listed in externals (fonts, global CSS, images) force a full rebuild.
CI (GitHub Actions)
Chromatic recommends triggering on push; pull_request builds a synthetic merge commit that can produce wrong baselines. The official workflow uses chromaui/action@latest with a CHROMATIC_PROJECT_TOKEN repository secret and fetch-depth: 0 on checkout (see Example 2).
Modes
Define modes once in .storybook/modes.ts and reuse them across stories. Modes set at project (.storybook/preview.ts), component and story level are stacked, not overridden: a story is snapshotted under every mode from all three levels, each with its own baseline and approval. Name the mode keys clearly, because the name becomes the badge in the review UI.
Examples
Example 1: Snapshot a Button across themes and sizes
User request: "Make Chromatic capture our Button in light and dark, on mobile and desktop."
// .storybook/modes.ts
export const allModes = {
"light mobile": { theme: "light", viewport: 375 },
"dark mobile": { theme: "dark", viewport: 375 },
"light desktop": { theme: "light", viewport: 1200 },
"dark desktop": { theme: "dark", viewport: 1200 },
} as const;
// src/components/Button.stories.jsx
import { allModes } from "../../.storybook/modes";
import { Button } from "./Button";
export default {
component: Button,
parameters: { chromatic: { modes: allModes, diffThreshold: 0.063 } },
};
export const Primary = {
args: { variant: "primary", children: "Checkout" },
};
The theme key only changes anything if your preview defines a global of that name (for example through a theme decorator); viewport accepts a pixel width or a named viewport.
Result: the next build shows four snapshots per story, named after the mode; accept them to set the baselines.
Example 2: Open dropdown and run Chromatic in CI
User request: "Snapshot the
Install chromatic in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
Allowed tools
Tools this skill is permitted to call.
No restriction — this skill can use any tool.
Bundled files
FAQ
What does the chromatic skill do?
Chromatic is a visual testing service from the Storybook team that snapshots every story in a cloud browser and shows visual diffs for review on each pull request. Use when the user wants visual regression testing with Storybook, or mentions "chromatic," "visual regression," "Storybook testing," "UI review," "visual diff," or "component snapshot testing." For general screenshot comparison, see percy.
How do I install the chromatic skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the chromatic skill run scripts?
No, this skill is instructions only (SKILL.md) with no executable scripts.
Related skills
frontend-design
Guidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making…
by Anthropicwebapp-testing
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing…
by Anthropicbrand-guidelines
Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand…
by Anthropicweb-artifacts-builder
Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui). Use…
by Anthropic