storybook

Storybook UI component development and testing. Use for component testing.

7 stars

Best use case

storybook is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Storybook UI component development and testing. Use for component testing.

Teams using storybook should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/storybook/SKILL.md --create-dirs "https://raw.githubusercontent.com/G1Joshi/Agent-Skills/main/skills/testing/storybook/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/storybook/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How storybook Compares

Feature / AgentstorybookStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Storybook UI component development and testing. Use for component testing.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Storybook

Storybook is a frontend workshop for building UI components and pages in isolation. It enables you to develop UI components without running your entire app (and logic/APIs).

## When to Use

- **Component Libraries**: Building a Design System.
- **Visual Testing**: Visualizing all states of a component (Loading, Error, Empty).
- **Documentation**: Auto-generating docs for your team.

## Quick Start

```bash
npx storybook@latest init
npm run storybook
```

Snippet:

```tsx
// Button.stories.tsx
import type { Meta, StoryObj } from "@storybook/react";
import { Button } from "./Button";

const meta: Meta<typeof Button> = {
  component: Button,
};
export default meta;

type Story = StoryObj<typeof Button>;

export const Primary: Story = {
  args: {
    primary: true,
    label: "Button",
  },
};
```

## Core Concepts

### Stories

A capture of a component in a specific state. A file can have multiple stories (Primary, Secondary, Disabled).

### Controls

Auto-generated UI knobs that allow you to modify props (Change color, change text) live in the browser.

### Addons

Plugins that extend functionality. Key ones:

- `Actions`: Log events (`onClick`).
- `A11y`: Check accessibility compliance.
- `Interactions`: Run small tests inside the story (`play` function).

## Best Practices (2025)

**Do**:

- **Use the `play` function**: Allows interactive testing within Storybook (powered by Testing Library).
- **Use "Autodocs"**: Enable `tags: ['autodocs']` to generate automatic documentation pages.
- **Visual Regression**: Integrate with Chromatic (by Storybook maintainers) to detect visual changes in CI.

**Don't**:

- **Don't mix business logic**: Components in Storybook should be "dumb" (Presentational). If they need data, pass it via args (mocks), don't fetch from APIs inside the component if possible.

## References

- [Storybook Documentation](https://storybook.js.org/)