Agent skill
angular-storybook-setup
Install, repair, or verify Storybook in Angular 20 applications that already use Tailwind CSS, including required addons (`@storybook/addon-themes`, `@storybook/addon-designs`, `@storybook/addon-a11y`) and optional Chromatic setup. Use when users ask to add Storybook, make Tailwind styles visible in stories, enable theme/design/a11y panels, fix broken Storybook config, or validate setup end to end.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/angular-storybook-setup
SKILL.md
Angular 20 Storybook Tailwind Addons
Goal
Install, repair, or verify Storybook for Angular 20 + Tailwind projects. Ensure stories render with the app's global Tailwind styles and that themes, designs, and a11y addons are configured. Optionally set up Chromatic CLI when explicitly requested.
Inputs
projectRoot(string, default: current working directory)globalStylePath(string, default: auto-detect fromangular.jsonstyles list; fallbacksrc/styles.cssthensrc/styles.scss)installChromaticCli(boolean, default:false, install only on explicit request)runVerification(boolean, default:true)
Preconditions
angular.jsonexists inprojectRoot.- The project already has Tailwind configured in a global stylesheet. If not, use $angular-tailwind-setup to install and configure Tailwind CSS.
- Use the repo package manager; examples below use
npm.
Success Criteria
- Storybook is installed and
npm run storybookstarts. .storybook/preview.tsimports the global stylesheet used by the Angular app..storybook/main.tsincludes all required addons:@storybook/addon-a11y@storybook/addon-themes@storybook/addon-designs
- Theme switching works with class-based Tailwind dark mode.
- At least one story shows a
parameters.designexample. - If
installChromaticCli=true,chromaticcan be invoked fromnpm run chromatic.
Workflow
-
Validate workspace and detect versions
- Read
package.jsonand confirm Angular major version (@angular/core) is close to20. - Abort with an error if major is not exactly
20. - Detect Storybook version if already installed (for addon compatibility checks).
- Resolve the global style file from
angular.json > build.options.styles; fallback tosrc/styles.cssorsrc/styles.scss.
- Read
-
Install Storybook (Angular preset)
- Run from
projectRoot:
bashnpx storybook@latest init- Keep Angular framework defaults from the installer.
- Ensure
.storybook/main.tsand.storybook/preview.tswere created. - Run once after installation:
bashnpm run storybook - Run from
-
Install required addons
bashnpm i -D @storybook/addon-themes @storybook/addon-designs @storybook/addon-a11y- Check
@storybook/addon-designscompatibility with the installed Storybook major. - If needed, pin
@storybook/addon-designsto the matching major range. - If
installChromaticCli=true, run:
bashnpm i -D chromatic - Check
-
Configure
.storybook/main.ts- Ensure
framework.nameis@storybook/angular. - Ensure
storiesincludes both MDX and stories globs. - Ensure
addonsincludes all required addons exactly once. - Merge with existing config instead of destructive overwrite.
tsimport type { StorybookConfig } from '@storybook/angular'; const config: StorybookConfig = { framework: { name: '@storybook/angular', options: {}, }, stories: ['../src/**/*.mdx', '../src/**/*.stories.@(ts|tsx)'], addons: [ '@storybook/addon-a11y', '@storybook/addon-themes', '@storybook/addon-designs', ], }; export default config; - Ensure
-
Configure
.storybook/preview.ts- Import the Angular global stylesheet used by Tailwind.
- Add themes decorator for class-based switching (
light-> empty class,dark->darkclass). - Keep existing parameters and decorators when present.
tsimport '../src/styles.css'; import type { Preview } from '@storybook/angular'; import { withThemeByClassName } from '@storybook/addon-themes'; const preview: Preview = { decorators: [ withThemeByClassName({ themes: { light: '', dark: 'dark' }, defaultTheme: 'light', }), ], }; export default preview;- Use
styles.scssimport when the project global style file is SCSS.
-
Add a minimal design-panel example
- Add or update a story with
parameters.designso the Designs panel is visible.
tsexport const Primary = { args: { label: 'Button' }, parameters: { design: { type: 'figma', url: 'https://www.figma.com/file/XXXX/YourFile?node-id=123-456', }, }, }; - Add or update a story with
-
Verify
- Run
npm run storybookand confirm no startup errors. - Confirm Tailwind classes render in stories.
- Confirm A11y panel appears in Storybook UI.
- Confirm theme switcher toggles classes on the preview root.
- Confirm Design panel appears for stories with
parameters.design. - If
installChromaticCli=true, runnpm run chromatic -- --helpand confirm CLI is available.
- Run
Guardrails
- Do not replace existing Storybook config wholesale; merge settings safely.
- Do not assume
src/styles.css; detect and import the actual configured global style file. - Keep addon entries unique; avoid duplicate addon registrations.
- If Tailwind styles are not visible, check style import path first, then verify Tailwind directives in the imported file.
- Do not install Chromatic unless explicitly requested.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?