chromaui/chromatic-skills/chromatic-viewports
Claude Code and agent skill by chromaui/chromatic-skills
- community
Checking that the SKILL.md file is still in the repository.
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.
Install
npx vskill@latest install chromaui/chromatic-skills/chromatic-viewportsSKILL.md
Chromatic Viewports
Configure responsive visual testing across multiple screen sizes using Chromatic's Modes API.
This skill covers:
- Setting up viewport modes in
.storybook/modes.ts - Applying modes at project, component, and story levels
- Controlling snapshot height with
cropToViewport - Migrating from the legacy
chromatic.viewportsAPI
Quick start
- Scan the project for existing viewport config: look for
chromatic.viewports(legacy) or amodes.ts/modesimport (new API). - Fetch the relevant docs from
reference/docs-map.md. - Determine whether this is a fresh setup, an extension, or a migration.
- Generate configuration files and output the checklist from
reference/output-contract.md.
Required workflow
1) Detect existing configuration
Check story files, .storybook/preview.ts, and existing modes.ts:
chromatic.viewportsfound → legacy API in use, offer migration to Modes API.storybook/modes.tsorchromatic.modesfound → already on Modes API, help extend or fix- Neither found → fresh setup, proceed with Modes API
2) Fetch current docs
Use the URLs in reference/docs-map.md and fetch with WebFetch. Use fetched content as the authoritative source — do not rely on remembered examples.
3) Configure viewports
Fresh setup or extension (Modes API):
Create or update .storybook/modes.ts:
Apply in a story file:
Apply globally in .storybook/preview.ts:
Control height — by default snapshots use the component's intrinsic height. To crop to the specified viewport height:
Migration from legacy:
Replace chromatic.viewports arrays with named modes. See reference/docs-map.md for the migration guide URL.
4) Output checklist
Always render the checklist from reference/output-contract.md, then show the complete content of every file to create or modify.
Key constraints
- Viewport values must be integers or
px-suffixed strings (800or"800px") — no other CSS units - Valid range: 200–2560px per side; max 25,000,000 pixels per snapshot
- Default size when unspecified: 1200 × 900px
- Legacy
chromatic.viewportsand the Modes API cannot coexist in the same story — using both throws an error - Modes stack across project → component → story levels; they do not override each other
- Renaming a mode creates a new baseline; the old baseline is retired
Boundaries
- Do not commit or push files — generate and show configuration only
- Do not add both APIs to the same file — pick one
- Do not suggest themes, locales, or other globals unless the user asks
References
reference/docs-map.mdreference/output-contract.md
Security
- Security scanPassed, 98 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/chromatic-viewports/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/chromaui/chromatic-skills/chromatic-viewports)