storybook
Skill275 starsChanged 35 days agoApache-2.0View on GitHub
Best practices for building and documenting component libraries with Storybook
11 other projects use a version of this.
Adopted by
Most recently taken up by
- primer/reacttheir own version, first seen Nov 1, 2026
- DaleStudy/skillstheir own version, first seen Nov 1, 2026
- mthines/agent-skillstheir own version, first seen Oct 30, 2026
- humanlayer/humanlayertheir own version, first seen Oct 25, 2026
- monegit/agent-skillstheir own version, first seen Oct 13, 2026
- G1Joshi/Agent-Skillstheir own version, first seen Oct 13, 2026
Other versions11 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 11
- langfuse/langfuse★ 37ksame name
- humanlayer/humanlayer★ 13ksame name
- primer/react★ 3.9ksame name
- microsoft/scope★ 78same name
- dylantarre/design-system-skills★ 50same name
- mthines/agent-skills★ 20same name
- G1Joshi/Agent-Skills★ 15same name
- DaleStudy/skills★ 4same name
- gabriellst/codm★ 4same name
- FelipeAngeli/skills★ 2same name
1 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository264 other files it gives its agents.
- accessibility-a11ySkill
- alpine-jsSkill
- analytics-data-analysisSkill
- android-developmentSkill
- angular-developmentSkill
- angularSkill
- anime-jsSkill
- anthropic-claude-developmentSkill
- api-developmentSkill
- apollo-graphqlSkill
- aspnet-coreSkill
- astroSkill
- auth0-authenticationSkill
- autogen-developmentSkill
- automl-hyperparameter-optimizationSkill
- aws-developmentSkill
- azureSkill
- backend-developmentSkill
- bash-scriptingSkill
- beautifulsoup-parsingSkill
- bitbucket-workflowSkill
- blazorSkill
- blender-python-addonSkill
- blockchainSkill
- bootstrapSkill
- business-central-developmentSkill
- cheerio-parsingSkill
- chrome-extension-developmentSkill
- ci-cd-best-practicesSkill
- clean-architectureSkill
- clean-codeSkill
- clerk-authenticationSkill
- cloudflare-developmentSkill
- computer-vision-opencvSkill
- convexSkill
- cppSkill
- c-sharpSkill
- cssSkill
- cypressSkill
- data-analysis-jupyterSkill
- data-analystSkill
- data-jupyter-pythonSkill
- deep-learning-pythonSkill
- deep-learning-pytorchSkill
- deep-learningSkill
- deno-typescriptSkill
- design-systemsSkill
- devopsSkill
- django-pythonSkill
- django-rest-api-developmentSkill
- dockerSkill
- dotnetSkill
- drizzle-ormSkill
- drupal-developmentSkill
- elasticsearch-best-practicesSkill
- electron-developmentSkill
- elixirSkill
- embedded-stm32Skill
- esbuild-bundlerSkill
- ethereumSkill
- The first 60 shown.
The file
Show its rules and text
We split this skill into the rules it gives an agent
29 rules. 0 are common, 28 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 9 edited versions we read keep these.
28
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 17
Place stories alongside component files (Component.stories.tsx)
- Distinctive: line 18
Use consistent naming conventions for story files
- Distinctive: line 24
Use PascalCase for component story files
- Distinctive: line 27
Use descriptive story names that explain the variant
- Distinctive: line 67
Create a Default story showing primary usage
- Distinctive: line 68
Add stories for each significant variant
- Distinctive: line 70
Document interactive states (hover, focus, disabled)
- Distinctive: line 78
Write clear JSDoc comments for components and props
- Distinctive: line 79
Document prop types, defaults, and requirements
- Distinctive: line 84
Add MDX files for complex documentation needs
- Distinctive: line 118
Use meaningful default values
- Distinctive: line 137
Use decorators for consistent story wrappers
- Distinctive: line 139
Add layout containers when needed
- Distinctive: line 140
Keep decorators simple and reusable
- Distinctive: line 183
Test theme variations (light/dark mode)
- Distinctive: line 184
Document visual test coverage
- Distinctive: line 190
Test keyboard navigation in stories
- Distinctive: line 226
Import design tokens from your token system
- Distinctive: line 228
Document token usage in component docs
- Distinctive: line 234
Create stories for each theme variant
- Distinctive: line 235
Test components across all supported themes
- Distinctive: line 242
Use lazy loading for large story collections
- Distinctive: line 249
Avoid heavy computations in stories
- Distinctive: line 250
Use mock data efficiently
- Distinctive: line 256
Write stories that serve as living documentation
- Distinctive: line 257
Test components in isolation before integration
- Distinctive: line 258
Keep stories simple and focused
- Distinctive: line 260
Update stories when components change
- Distinctive: line 261
Use stories for design review and QA
“Common” is measured: kept by at least 6 in 10 of the 9 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Storybook Best Practices
You are an expert in building and documenting component libraries with Storybook. Apply these guidelines when creating stories, organizing components, and maintaining design systems.
Project Structure
Directory Organization
- Place stories alongside component files (Component.stories.tsx)
- Use consistent naming conventions for story files
- Organize stories by feature or component type
- Maintain a clear hierarchy matching your component library
File Naming
- Use PascalCase for component story files
- Follow pattern:
ComponentName.stories.tsx - Group related stories in the same file
- Use descriptive story names that explain the variant
Writing Stories
Story Structure
import type { Meta, StoryObj } from '@storybook/react';
import { Component } from './Component';
const meta: Meta<typeof Component> = {
title: 'Category/Component',
component: Component,
parameters: {
layout: 'centered',
},
tags: ['autodocs'],
argTypes: {
// Define arg types here
},
};
export default meta;
type Story = StoryObj<typeof meta>;
export const Default: Story = {
args: {
// Default props
},
};
export const Variant: Story = {
args: {
variant: 'secondary',
},
};Story Best Practices
- Create a Default story showing primary usage
- Add stories for each significant variant
- Include edge cases and error states
- Document interactive states (hover, focus, disabled)
- Show responsive behavior when relevant
Component Documentation
Autodocs
- Enable autodocs for automatic documentation generation
- Write clear JSDoc comments for components and props
- Document prop types, defaults, and requirements
- Include usage examples in component comments
Custom Documentation
- Add MDX files for complex documentation needs
- Include design rationale and usage guidelines
- Document accessibility considerations
- Provide code examples for common use cases
Args and Controls
ArgTypes Configuration
argTypes: {
variant: {
control: 'select',
options: ['primary', 'secondary', 'tertiary'],
description: 'Visual style variant',
table: {
defaultValue: { summary: 'primary' },
},
},
size: {
control: 'radio',
options: ['sm', 'md', 'lg'],
},
disabled: {
control: 'boolean',
},
onClick: {
action: 'clicked',
},
}Args Best Practices
- Use meaningful default values
- Group related args logically
- Provide descriptions for complex props
- Set up actions for callback props
Decorators and Parameters
Decorators
decorators: [
(Story) => (
<ThemeProvider theme={defaultTheme}>
<Story />
</ThemeProvider>
),
],- Use decorators for consistent story wrappers
- Apply theme providers at the appropriate level
- Add layout containers when needed
- Keep decorators simple and reusable
Parameters
parameters: {
layout: 'centered', // or 'fullscreen', 'padded'
backgrounds: {
default: 'light',
values: [
{ name: 'light', value: '#ffffff' },
{ name: 'dark', value: '#1a1a1a' },
],
},
viewport: {
defaultViewport: 'responsive',
},
},Testing with Storybook
Interaction Testing
import { within, userEvent } from '@storybook/testing-library';
import { expect } from '@storybook/jest';
export const Clickable: Story = {
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
const button = canvas.getByRole('button');
await userEvent.click(button);
await expect(button).toHaveFocus();
},
};Visual Testing
- Configure visual regression testing
- Capture stories at multiple viewports
- Test theme variations (light/dark mode)
- Document visual test coverage
Accessibility Testing
- Enable a11y addon for accessibility checks
- Address all accessibility violations
- Test keyboard navigation in stories
- Document ARIA requirements
Addons and Configuration
Essential Addons
- @storybook/addon-essentials (docs, controls, actions, viewport)
- @storybook/addon-a11y for accessibility testing
- @storybook/addon-interactions for interaction testing
- @storybook/addon-designs for design spec integration
Configuration
// .storybook/main.ts
const config: StorybookConfig = {
stories: ['../src/**/*.stories.@(js|jsx|ts|tsx)'],
addons: [
'@storybook/addon-essentials',
'@storybook/addon-a11y',
'@storybook/addon-interactions',
],
framework: {
name: '@storybook/react-vite',
options: {},
},
};
export default config;Design System Integration
Design Tokens
- Import design tokens from your token system
- Apply tokens consistently in stories
- Document token usage in component docs
- Show token variations in dedicated stories
Theme Support
- Configure theme provider in preview.js
- Create stories for each theme variant
- Test components across all supported themes
- Document theme-specific behavior
Performance
Build Optimization
- Use lazy loading for large story collections
- Optimize static assets
- Configure proper caching
- Monitor and improve build times
Story Performance
- Avoid heavy computations in stories
- Use mock data efficiently
- Lazy load complex dependencies
- Profile and optimize slow stories
Best Practices Summary
- Write stories that serve as living documentation
- Test components in isolation before integration
- Keep stories simple and focused
- Maintain consistency across all stories
- Update stories when components change
- Use stories for design review and QA
- Make accessibility testing part of the workflow
- Integrate with your CI/CD pipeline
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

