$ recombobulate _
home / tips / ask-claude-to-write-storybook-stories-for-your-react-components
0

Ask Claude to Write Storybook Stories for Your React Components

bagwaa @bagwaa · Mar 26, 2026 · Workflows
ask-claude-to-write-storybook-stories-for-your-react-components

Writing Storybook stories by hand is tedious and easy to skip — ask Claude to generate them from your existing components and it'll have your whole library covered in minutes.

Point Claude at your component file and ask it to write stories:

claude "Read src/components/Button.tsx and write a complete Storybook 8 story file with stories for every prop variant, including hover and disabled states. Use CSF3 format with TypeScript."

Claude reads the component's prop types and renders meaningful variants — not just default and secondary, but edge cases like long labels, loading states, and icon-only buttons you might have forgotten.

For a component library, batch the work across all your components at once:

claude "Read every component in src/components/ and generate a .stories.tsx file next to each one. Use the same naming conventions as the existing stories in src/components/Card.stories.tsx."

Pointing Claude at an existing story file is key — it mirrors your project's story structure rather than inventing its own.

You can also ask Claude to add interaction tests using @storybook/test play functions:

// Claude will generate play functions like this
export const SubmitsForm: Story = {
  play: async ({ canvasElement }) => {
    const canvas = within(canvasElement);
    await userEvent.click(canvas.getByRole('button', { name: /submit/i }));
    await expect(canvas.getByText('Success')).toBeInTheDocument();
  },
};

Let Claude bootstrap your entire Storybook library in one session — then keep it up to date the same way.

~/recombobulate $ tip --comments --count=0

Log in to leave a comment.

~/recombobulate $ tip --related --limit=3
0
Scan Pending Changes for Security Issues with /security-review

The /security-review command scans your uncommitted changes for injection vectors, auth gaps, hardcoded secrets, and other common vulnerabilities.

bagwaa @bagwaa · 1 hour ago
0
Run Setup Scripts on Every Session with the SessionStart Hook

The SessionStart hook fires when any session begins or resumes, making it ideal for loading environment variables and running one-time setup scripts.

bagwaa @bagwaa · 1 hour ago
0
Write Property-Based Tests with fast-check and Claude

Ask Claude to write property-based tests for your functions using fast-check — it identifies the mathematical invariants in your code and generates tests that cover inputs you'd never enumerate by hand.

bagwaa @bagwaa · 2 hours ago