chromatic-setup-ci
Chromatic CI Setup
Set up Chromatic visual testing automation in CI/CD pipelines.
This skill is the single source of truth for:
- detecting which CI provider the project uses
- fetching the current Chromatic docs for that provider
- generating CI configuration files for Chromatic
- setting up the project token secret
Quick start
- Read
reference/ci-detection.mdto identify the CI provider from existing config files. - If no CI config is found, ask the user which CI provider they use.
- Read
reference/package-manager.mdand detect the package manager from lockfiles. - Look up the provider's docs URL in
reference/docs-map.mdand fetch it with WebFetch. - For non-GitHub-Actions providers: check
package.jsonfor achromaticdevDependency and script — add them if missing. Skip this step for GitHub Actions. - Generate or update the CI configuration using the fetched docs and the detected package manager.
- Render the setup checklist using
reference/output-contract.md.
Required workflow
1) Detect CI provider
Check for existing CI config files using reference/ci-detection.md.
If no CI files exist or detection is ambiguous, ask: "Which CI provider are you using? (GitHub Actions, GitLab, Bitbucket Pipelines, CircleCI, Jenkins, Azure Pipelines, or other)"
Never assume GitHub Actions unless evidence supports it.
2) Detect package manager
Use reference/package-manager.md to identify the package manager from lockfiles. Use its install command and run command throughout the generated config. If an existing CI config is already present, match whatever install command it already uses.
3) Read existing CI config
If a CI config file already exists, read it before generating any changes. Understand the existing job structure, Node.js setup steps, and caching approach — match the project's existing patterns when adding Chromatic.
4) Fetch the provider docs
Look up the docs URL in reference/docs-map.md and fetch it with WebFetch. Use the fetched content as the authoritative source for configuration examples and requirements.
If the fetch fails, fall back to the CI overview doc: https://www.chromatic.com/docs/llms/ci.txt
5) Verify package.json (skip for GitHub Actions)
GitHub Actions: The chromaui/action runs Chromatic internally — do not add a chromatic script or devDependency to package.json.
All other providers: Check package.json for a chromatic devDependency and script. If missing, add both:
"devDependencies": {
"chromatic": "^12.0.0"
},
"scripts": {
"chromatic": "chromatic --exit-zero-on-changes"
}
6) Output setup checklist
Always return the setup checklist from reference/output-contract.md, then show complete generated file content for copy-paste.
Boundaries
- Do not commit or push files — only generate and show the configuration.
- Do not expose the project token value — always reference it as a secret/environment variable.
- Keep configurations minimal — do not add TurboSnap, monorepo flags, or Playwright/Cypress unless the user asks.
References
reference/ci-detection.mdreference/package-manager.mdreference/docs-map.mdreference/output-contract.md
More from chromaui/chromatic-skills
turbosnap-debug
Diagnose TurboSnap behavior using logs, config, git context, support-shareable hosted metadata references, and targeted trace commands. Use when you need to classify why TurboSnap is enabled, disabled, unavailable, or tracing the wrong stories, then recommend the smallest valid next step.
8chromatic-themes
Configure Chromatic to capture visual test snapshots across multiple themes (light/dark mode, design tokens, branded variants) using the Modes API and @storybook/addon-themes. Use when the user wants to test components with different themes in Chromatic, set up light/dark mode visual testing, configure @storybook/addon-themes with Chromatic, or apply theme modes at the project, component, or story level.
6chromatic-viewports
Configure Chromatic to capture visual test snapshots at multiple viewport sizes using the Modes API. Use when the user wants to test responsive components at different screen sizes, set up viewport breakpoints for Chromatic visual testing, apply viewports to individual stories or globally, control snapshot height with cropToViewport, or migrate from the legacy chromatic.viewports API to the new Modes API.
6chromatic-turbosnap-debug
Diagnose TurboSnap behavior using logs, config, git context, support-shareable hosted metadata references, and targeted trace commands. Use when you need to classify why TurboSnap is enabled, disabled, unavailable, or tracing the wrong stories, then recommend the smallest valid next step.
6chromatic-workflow-debug
Diagnose Chromatic workflow issues involving git history, baselines, pull request event shape, merge queues, merge-base failures, replacement builds, and patch builds. Use when builds compare against the wrong baseline, an ancestor build is not found, pull request comparisons look wrong, or CI git context does not match Chromatic's expectations.
5chromatic-monorepo-config
Recommend Chromatic best practices for Nx and Turborepo monorepos, including one-project versus multi-project topology, workingDir, buildCommand or outputDir, storybookBaseDir, storybookConfigDir, onlyChanged, externals, untraced, shared lockfile behavior, and TurboSnap-safe CI patterns. Use when a monorepo needs an initial setup recommendation or an audit of an existing Chromatic configuration.
5