/anukkrit-skills-cloud:storybook-builderfrom anukkrit-skills-cloud
End-to-end Storybook builder for any repo. Sets up branding (logo, colors, fonts, design tokens), primitives (Button/Input/Label), components (Cards/Forms/Headers/Sidebars), layouts (AppShell/LandingShell/SplitShell/EmptyState/LoadingShell), screens (full route compositions), and mock infrastructure (MSW + React Query + MemoryRouter decorators). Use when the user says "add storybook", "set up storybook", "build design system in storybook", "create screen stories", "turn routes into stories", "mock data for stories", "port components to ui package", "set up brand tokens", or wants a complete design-system Storybook. Includes a curated addon index so you pick the right plugin per use case.
Ships in anukkrit-skills-cloud. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
A complete playbook for building a design-system Storybook from scratch. Outputs every layer of a UI package:
This skill encodes patterns from a real port of a fiddle-factory monorepo: 5 layout primitives, 5 screen components, MSW + MemoryRouter + QueryClient decorators, and a full 1776-line community module port from apps/web to packages/ui.
The full workflow is a 6-phase pipeline. Run phases in order; phases 3-7 can run in parallel via agents.
Before writing any code:
find apps/*/app/routes -type f -o -name "_index.*" -o -name "pages/*"packages/ui, packages/design-system, or packages/componentsls packages/*/.storybook/ 2>/dev/null~/services, ~/lib/e2b, ~/store, singletons, or React Query hooks is mock-required.If packages/ui/.storybook/ doesn't exist:
# In the target package directory (NOT repo root)
pnpm --filter @your-scope/ui dlx storybook@latest init --type react
After init, immediately add:
pnpm --filter @your-scope/ui add -D \
msw msw-storybook-addon \
@tanstack/react-query \
react-router-dom \
@storybook/test
Then initialize the MSW worker (writes public/mockServiceWorker.js):
pnpm --filter @your-scope/ui exec msw init public/ --save
Note on remix-react-router addon: [email protected] targets react-router v7 + storybook v10. If the host repo uses react-router v6 + storybook v9, install it but don't register it in main.ts — write a thin MemoryRouter decorator instead (see references/mock-router-template.tsx).
Create packages/ui/src/test-utils/:
mock-query-client.tsx — withQueryClient decorator. Fresh QueryClient per render with retry: false, gcTime: 0, staleTime: 0. Override via parameters.queryClient.defaultOptions.mock-router.tsx — withRouter decorator using MemoryRouter. Override initialEntries, initialIndex, path via parameters.router.mock-handlers.ts — exports defaultHandlers: RequestHandler[] = []. Stories compose: [...defaultHandlers, http.get(...)].index.ts — barrel.Wire into .storybook/preview.ts:
import { initialize, mswLoader } from 'msw-storybook-addon'
import { withQueryClient } from '../src/test-utils/mock-query-client'
import { withRouter } from '../src/test-utils/mock-router'
initialize({ onUnhandledRequest: 'bypass' })
const preview: Preview = {
loaders: [mswLoader],
decorators: [withQueryClient, withRouter, /* existing theme decorator */],
parameters: { msw: { handlers: [] } /* ... */ },
}
Add screens/** glob to .storybook/main.ts:
stories: [
'../src/primitives/**/*.stories.@(ts|tsx)',
'../src/components/**/*.stories.@(ts|tsx)',
'../src/screens/**/*.stories.@(ts|tsx)', // ← add this
]
Add .storybook/types.d.ts to type-augment Parameters for IDE autocomplete (see references/types-augmentation.ts).
Full code templates for all 4 test-util files: see references/mock-infrastructure.md.
Create 5 framework-free primitives in packages/ui/src/components/layout/:
| Primitive | Props | Purpose |
|---|---|---|
AppShell | header?, children, className? | Top-level page shell (vertical flex, header + content) |
LandingShell | navLinks[], logo?, children, interactive? | Auth/marketing chrome (dot-grid + nav + centered card) |
SplitShell | sidebar, main, sidebarSide?, sidebarWidth?, hideSidebar? | Sidebar + main pane |
EmptyState | title, description?, action?, icon?, compact? | Empty/no-data state |
LoadingShell | logoSrc?, message? | Full-screen loading w/ spinner (role="status") |
Rules:
bg-fiddle-elements-* or whatever the host repo uses)app-shell/index.tsx + app-shell.stories.tsxcomponents/layout/index.tsFull code: see references/layout-primitives.md.
For each route, pick ONE strategy:
| Strategy | When to use | Cost | Fidelity |
|---|---|---|---|
| A. Refactor route → use screen | Route is mostly state + form (signup, simple forms) | Low | Identical |
| B. Presentational twin | Route renders an existing complex component (HomePage, dashboard) | Med | Same JSX structure, fixture data |
| C. Port module to UI pkg | Heavy custom rendering (framer-motion canvas, custom SVG, themed sub-components) | High | Pixel-identical |
| D. Slot-based shell | Route wires 3+ heavy children (canvas + chat + panels) | Med | Visual scaffold, no real children |
Strategy A example — signup screen:
// packages/ui/src/screens/signup.screen.tsx
export function SignupScreen(props: SignupScreenProps) { /* form JSX */ }
// apps/web/app/routes/signup.tsx (refactored)
function SignUp() {
const [email, setEmail] = useState('')
// ... state + handlers
return <SignupScreen email={email} ... />
}
Strategy C example — port a module:
# Find all files
find apps/web/app/modules/community -type f
# Copy each file to packages/ui/src/components/community/, replacing:
# ~/modules/community/X → relative ../X
# ~/shared/hooks/useViewportSize → ../../../hooks/useViewportSize (move it too)
# Keep public-net hooks (polling/preload) in apps/web; they don't go to UI pkg.
Full decision tree + code patterns: see references/screen-strategies.md.
Every screen story should have:
args: for each meaningful state (default, loading, error, empty, submitting)useState-driven local component so users can actually type/clickfunction InteractiveSignup() {
const [email, setEmail] = useState('')
// ...
return <SignupScreen email={email} onEmailChange={setEmail} ... />
}
export const Default: Story = { render: () => <InteractiveSignup /> }
export const WithError: Story = { args: { /* static error state */ } }
Storybook hygiene checklist:
title: 'Screens/X' (or Layout/X for primitives)parameters: { layout: 'fullscreen' } for full-page screensMeta<typeof Component> typeddocs.description.component explains what the screen mirrorsFull templates: see references/story-templates.md.
Before declaring done, walk this list (also runnable as 2 parallel review agents):
Story quality:
useState-driven variant per stateful screen#040404 for community → document)button not div), aria-label on icon-only buttons, role="status" on spinners, h1 for page titlesMock pipeline:
initialize({ onUnhandledRequest: 'bypass' }) — or 'warn' in dev / 'error' in CIMemoryRouter not BrowserRouterstaticDirs includes itparameters.msw.handlers override pattern works across storiesTypecheck + boot:
pnpm --filter @your-scope/ui typecheck cleanpnpm --filter @your-scope/ui storybook boots, HTTP 200 on assigned portWhen stories need a capability, check this index before writing custom code. Categories link to the upstream tag pages.
| Use case | Addon | npm |
|---|---|---|
| Mock HTTP fetch/XHR (recommended default) | Mock Service Worker | msw-storybook-addon |
| Mock fetch only (lighter) | Mock fetch() | storybook-addon-fetch-mock |
| Mock arbitrary API responses | Mock API Request | storybook-addon-mock |
Freeze JS Date per story | Mocking Date | storybook-addon-mock-date |
| Apollo GraphQL queries | Apollo Client | storybook-addon-apollo-client |
| urql GraphQL queries | urql | @urql/storybook-addon |
| Manipulate React Context | storybook-react-context | storybook-react-context |
| Mock Next.js router | Next.js router | storybook-addon-next-router |
Set document.cookie | Cookie | storybook-addon-cookie |
| Mock backend with MirageJS | MirageJS | storybook-mirage |
| Event-tracking visualization | walkerOS | @walkeros/storybook-addon |
Default for new repos: msw-storybook-addon covers ~95% of HTTP needs.
| Use case | Addon | npm |
|---|---|---|
| Embed Figma frame in addon panel | Designs (official) | @storybook/addon-designs |
| Embed Figma frame (community) | Designs | storybook-addon-designs |
| Show design tokens (DTCG) | Swatchbook | @unpunnyfuns/swatchbook-addon |
| Design token tables in docs | Design token tables | @etchteam/storybook-addon-design-token-tables |
| Manipulate CSS custom props live | CSS Custom Properties | @ljcl/storybook-addon-cssprops |
| Inspect CSS box-model | Measure | @junk-temporary-prototypes/addon-measure |
| Column grid overlay | Column Guides | storybook-addon-grid |
| Responsive breakpoint preview | Breakpoints | storybook-addon-breakpoints |
| Pixel-perfect Figma overlay | Pixel Perfect | @lagosta/pixel-perfect-storybook-addon |
| Resize iframe with handles | Resizr | @liip/storybook-addon-resizr |
| Color picker palette | Color picker | storybook-color-picker |
| Theme switcher (CSS vars) | CSS Variables Theme | @etchteam/storybook-addon-css-variables-theme |
| Tailwind config → docs | Tailwind Autodocs | storybook-addon-tailwind-autodocs |
| Zeplin integration | storybook-zeplin | storybook-zeplin |
| Configure styling (Tailwind/Emotion/etc.) | Styling | @storybook/addon-styling |
| AI-powered Figma diff | UI Review | @uicopilot/storybook-addon |
Default for new repos: @storybook/addon-designs for Figma + @storybook/addon-styling for Tailwind/Emotion.
| Use case | Addon | npm |
|---|---|---|
| Dark/light mode toggle (community-maintained) | storybook-dark-mode | storybook-dark-mode |
| Highlight DOM nodes | Highlight (official) | @storybook/addon-highlight |
| Tailwind dark mode toggle | Tailwind dark mode | (search npm — multiple forks) |
| Theme + provider + true dark | Facelift | storybook-facelift |
| Pixel-perfect overlay | Pixel Perfect | storybook-addon-pixel-perfect |
| Visual regression (commercial) | Applitools Eyes | @applitools/eyes-storybook-addon |
| Embed iframe inside story | iFrame | storybook-addon-iframe |
| Render component permutations as table | Permutation | storybook-addon-permutation |
| Toolbar action buttons | Toolbar actions | (community) |
| Render CSS outlines on elements | Outline | storybook-addon-outline |
Default for new repos: @storybook/addon-highlight (built-in in Essentials in v8+) + dark-mode addon if your design system has both themes.
| Use case | Addon | npm |
|---|---|---|
| Auto-generate component docs | Docs (official, in Essentials) | @storybook/addon-docs |
| Link stories together | Links (official) | @storybook/addon-links |
| Tag badges in sidebar | Tag Badges | storybook-addon-tag-badges |
| Component status (draft/stable/deprecated) | Status | @etchteam/storybook-addon-status |
| Story badges (e.g. "WIP") | Badges | storybook-addon-badges |
| Open component source in VS Code | storybook-vscode-component | storybook-vscode-component |
| TOC for MDX docs | Table of contents | storybook-docs-toc |
| Switch git branches in Storybook | Branch switcher | storybook-branch-switcher |
| Full-text search across MDX | Text Search | @tchwrks/storybook-text-search |
| Browse dependency tree of stories | Component dependency tree | storybook-addon-dependencies |
| Folder-based config | Storybook include | storybook-include |
| Markdown docs alongside stories | storybook-addon-markdown-docs | storybook-addon-markdown-docs |
Default for new repos: @storybook/addon-docs + storybook-addon-tag-badges if you have multiple statuses per component.
Storybook 8+ ships @storybook/addon-essentials bundling: @storybook/addon-docs, @storybook/addon-controls, @storybook/addon-actions, @storybook/addon-viewport, @storybook/addon-backgrounds, @storybook/addon-toolbars, @storybook/addon-measure, @storybook/addon-outline, @storybook/addon-highlight.
In Storybook 9 these are folded into core. Don't install separately unless on v7 or earlier.
When adding Storybook to a fresh repo, walk this checklist. Tick each item as covered.
dlx storybook@latest initreact-vite, nextjs, sveltekit, etc.)staticDirs: ['../public'] settailwind-preset.css / design-token CSS imported in preview.tssrc/styles/tokens.css — all design tokens definedsrc/styles/tailwind-preset.css — Tailwind mappingsrc/styles/fonts.css — self-hosted fonts loadedpublic/logo.svg (+ mark / wordmark variants)src/brand/logo/ component + storyBrand/Colors palette storyBrand/Typography scale storypublic/withQueryClient decorator (fresh client per render)withRouter decorator (MemoryRouter; correct version of react-router)mock-handlers.ts with defaultHandlers: [] composition pattern documentedparameters.msw.handlers override pattern worksbeforeEach)data-theme attribute set on documentElementbackgrounds parameter mirrors theme colorsInteractiveX variant using useState~/ aliasespnpm typecheck clean in UI pkgpnpm typecheck clean in app pkg (route refactors don't break)msw-storybook-addon (always)@storybook/addon-designs if Figma is in use@storybook/addon-docs (always)agent-browser CLI (lightest) / Chrome DevTools MCP / Playwright MCPstorybook-addon-remix-react-router peer-dep mismatch — install but don't register; use a plain MemoryRouter wrapper.
MSW bypass masks real fetches — for CI/Chromatic snapshots, switch to 'warn' or 'error'.
as any on ctx.parameters — type-augment @storybook/react-vite Parameters interface in .storybook/types.d.ts. Catches typos like parameters.routes vs parameters.router.
Decorator order reads backwards — array [A, B, C] applies as A(B(C(Story))). Provider-style decorators (Query, Router) go first; theme/styling decorators go last.
Module port forgets ~/ imports — when copying files into UI pkg, replace every ~/modules/X with relative path. Run grep -r "from '~/" packages/ui/src/ after porting; should return zero results.
Production sub-component imports app-only services — when porting, follow imports one level deep. If a component imports useViewportSize from ~/shared/hooks/, that hook moves too. If it imports e2bSessionManager, you have a problem — that's a sign Strategy D (slot-based shell) is the right pick instead of C.
unable to find package.json for radix-ui — harmless Storybook 9 warning when radix-ui umbrella package is in deps. Ignore.
When invoked, this skill produces:
references/branding-system.md — tokens, colors, fonts, logo, theme switcherreferences/components-catalog.md — what components to build per category + worked ProjectCard examplereferences/layout-primitives.md — full code for AppShell, LandingShell, SplitShell, EmptyState, LoadingShellreferences/mock-infrastructure.md — full code for mock-query-client, mock-router, mock-handlers, preview.ts, types.d.tsreferences/screen-strategies.md — decision tree + worked examples for strategies A, B, C, Dreferences/story-templates.md — interactive vs static story patterns, hygiene checklistreferences/visual-sync.md — agent-browser CLI, Chrome DevTools MCP, Playwright MCP for prod-vs-storybook comparisonreferences/agent-workflows.md — parallel agent dispatching patternreferences/case-handlers.md — symptom → fix lookup for edge casesreferences/coverage-checklist.md — exhaustive coverage checklistreferences/troubleshooting.md — error message → resolution lookupreferences/examples.md — real worked examples (signup, home, community, playground)references/addon-index.json — machine-readable addon index tableAfter running this skill, the user should be able to:
cd packages/ui && pnpm storybook
And see at minimum: Layout/* (5 stories), Screens/* (one per route), plus all the existing primitive/component stories. Every screen story should render without console errors and reflect the production route visually.
references/addon-index.json (opens in a new tab)references/agent-workflows.md (opens in a new tab)references/branding-system.md (opens in a new tab)references/case-handlers.md (opens in a new tab)references/components-catalog.md (opens in a new tab)references/coverage-checklist.md (opens in a new tab)references/examples.md (opens in a new tab)references/layout-primitives.md (opens in a new tab)references/mock-infrastructure.md (opens in a new tab)references/screen-strategies.md (opens in a new tab)references/story-templates.md (opens in a new tab)references/troubleshooting.md (opens in a new tab)references/visual-sync.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
105 skills in this plugin
/agentationAdd Agentation visual feedback toolbar to a Next.js project/agent-md-refactorRefactor bloated AGENTS.md, CLAUDE.md, or similar agent instruction files to follow progressive disclosure principles. Splits monolithic files into organized, linked documentation./ai-agents-architectExpert in designing and building autonomous AI agents. Masters tool use, memory systems, planning strategies, and multi-agent orchestration. Use when: build agent, AI agent, autonomous agent, tool use, function calling.npx claudepluginhub anukkrit149/anukkrit-skills --plugin anukkrit-skills-cloud