Automates visual regression testing for Storybook components using cloud-based snapshot comparison. Use when setting up visual testing, catching UI regressions, or reviewing component changes.
Automates visual regression testing for Storybook components using cloud-based snapshot comparison. Use when setting up visual testing, catching UI regressions, or reviewing component changes.
/plugin marketplace add mgd34msu/goodvibes-plugin/plugin install goodvibes@goodvibes-marketThis skill inherits all available tools. When active, it can use any tool Claude has access to.
references/ci-integration.mdreferences/configuration.mdCloud-based visual testing platform that captures screenshots of every Storybook story and detects visual changes.
# Install Chromatic
npx storybook add chromatic
# Or install manually
npm install --save-dev chromatic
# Run visual tests (first time creates baselines)
npx chromatic --project-token=<token>
{
"projectToken": "chpt_xxxxxxxxxxxx",
"buildScriptName": "build-storybook",
"storybookBuildDir": "storybook-static",
"zip": true,
"autoAcceptChanges": "main",
"exitOnceUploaded": false,
"exitZeroOnChanges": false,
"onlyChanged": true,
"externals": ["public/**"],
"skip": "dependabot/**"
}
{
"scripts": {
"chromatic": "chromatic --exit-zero-on-changes",
"chromatic:ci": "chromatic --auto-accept-changes=main"
}
}
// Skip specific story
export const Loading: Story = {
parameters: {
chromatic: { disableSnapshot: true }
}
};
// Skip all stories in file
export default {
title: 'Components/Spinner',
parameters: {
chromatic: { disableSnapshot: true }
}
};
export const Responsive: Story = {
parameters: {
chromatic: {
viewports: [320, 768, 1200]
}
}
};
export const Animated: Story = {
parameters: {
chromatic: {
delay: 300, // Wait 300ms before snapshot
pauseAnimationAtEnd: true
}
}
};
export const SubtleChanges: Story = {
parameters: {
chromatic: {
diffThreshold: 0.2 // 0-1, higher = more tolerant
}
}
};
// Test in multiple browsers
export default {
title: 'Components/Button',
parameters: {
chromatic: {
modes: {
chrome: { viewport: 1200 },
firefox: { viewport: 1200 },
safari: { viewport: 1200 },
edge: { viewport: 1200 }
}
}
}
};
// .storybook/modes.ts
export const allModes = {
light: { theme: 'light' },
dark: { theme: 'dark' },
mobile: { viewport: { width: 375, height: 667 } },
desktop: { viewport: { width: 1200, height: 800 } }
};
// Component story
export const Button: Story = {
parameters: {
chromatic: {
modes: {
'light desktop': allModes['light'],
'dark desktop': { ...allModes['dark'], ...allModes['desktop'] },
'light mobile': { ...allModes['light'], ...allModes['mobile'] }
}
}
}
};
name: Chromatic
on: push
jobs:
chromatic:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Required for accurate baselines
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm ci
- uses: chromaui/action@latest
with:
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
autoAcceptChanges: main
onlyChanged: true
chromatic:
stage: test
image: node:20
script:
- npm ci
- npx chromatic --project-token=$CHROMATIC_PROJECT_TOKEN
only:
- merge_requests
- main
Only test stories affected by code changes:
npx chromatic --only-changed
Configure in CI:
- uses: chromaui/action@latest
with:
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
onlyChanged: true
traceChanged: expanded # Track changes across files
export const WithTimestamp: Story = {
parameters: {
chromatic: {
diffIncludeAntiAliasing: false
}
},
decorators: [
(Story) => (
<>
<Story />
<span data-chromatic="ignore">
{new Date().toISOString()}
</span>
</>
)
]
};
export const UserProfile: Story = {
parameters: {
chromatic: { delay: 500 }
},
loaders: [
async () => ({
user: { name: 'Test User', avatar: '/mock-avatar.png' }
})
]
};
# Auto-accept on main branch
npx chromatic --auto-accept-changes=main
# Accept specific branches
npx chromatic --auto-accept-changes="main|release/*"
# Skip CI for specific patterns
npx chromatic --skip="dependabot/**"
# Skip with commit message
git commit -m "docs: update readme [skip chromatic]"
// Increase delay for async content
parameters: {
chromatic: {
delay: 1000,
diffThreshold: 0.1
}
}
// Wait for fonts in preview.js
export const decorators = [
(Story) => {
const [fontsLoaded, setFontsLoaded] = useState(false);
useEffect(() => {
document.fonts.ready.then(() => setFontsLoaded(true));
}, []);
return fontsLoaded ? <Story /> : null;
}
];
{
"externals": [
"public/fonts/**",
"public/images/**"
]
}
See references/configuration.md for complete CLI options and references/ci-integration.md for advanced CI setups.
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.