storybook

storybook is a cursor rule for coding agents from nedcodes-ok/cursorrules-collection. It costs 466 tokens per session, scanned A, original, MIT.

A set of coding rules for Storybook, a tool for developing and documenting interface components in isolation. It covers story files, interactive controls, wrappers for shared context, and component organization.

In plain words
What is it for?
Use it when writing component stories, adding controls for different states, applying themes or providers, and organizing UI documentation.
Why use it?
It helps keep component examples predictable and makes their states easier to inspect, test, and document.

Cursor rule

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/nedcodes-ok/cursorrules-collection/storybook
Clone the repo
git clone --depth 1 https://github.com/nedcodes-ok/cursorrules-collection

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for storybook

README.md
[![agentmods](https://agentmods.dev/badge/rules/nedcodes-ok/cursorrules-collection/storybook.svg)](https://agentmods.dev/rules/nedcodes-ok/cursorrules-collection/storybook)
Your own site
<a href="https://agentmods.dev/rules/nedcodes-ok/cursorrules-collection/storybook"><img src="https://agentmods.dev/badge/rules/nedcodes-ok/cursorrules-collection/storybook.svg" alt="Measured on agentmods" height="20"></a>
Per session 466 This file is loaded in full into every session.
When invoked 466 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00466 $0.00466
Opus 5 $0.00233 $0.00233
Sonnet 5 $0.00093 $0.00093
Haiku 4.5 $0.00047 $0.00047

Measured yesterday against content hash 50c3510d0ea2, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

storybook scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

Copies of this mod

1 near-identical copy found in the catalogue:

  • storybook — 100% identical, 0 lines differ
rules-mdc/tools/storybook.mdc · 46 lines

What it actually says

Storybook Cursor Rules

You are an expert in Storybook component development. Follow these rules:

Story Format (CSF3)

  • Use Component Story Format 3 — export default meta object, export named story objects
  • Type meta with satisfies Meta for full type safety
  • Each story is a plain object: export const Primary: Story = { args: { ... } }
  • Never use CSF2 render functions unless args alone can't express the story

Args & Controls

  • Define default args in meta.args — override per-story only what changes
  • Use argTypes to customize controls: argTypes: { size: { control: "select", options: ["sm", "md", "lg"] } }
  • Map enum props to select/radio controls explicitly
  • Use args for all dynamic props — never hardcode values inside render functions

Decorators

  • Use decorators for wrapping context: themes, providers, layout containers
  • Apply global decorators in .storybook/preview.ts, story-specific in meta.decorators
  • Keep decorators pure — no side effects, no API calls
  • Use the Story function parameter: decorators: [(Story) => ]

Organization

  • Co-locate stories with components: Button.tsx + Button.stories.tsx
  • Use title hierarchy for grouping: title: "Components/Forms/Button"
  • Name stories by variant: Primary, Secondary, Disabled, Loading, WithIcon
  • Write one story per meaningful visual state

Documentation

  • Add component description in meta.parameters.docs.description.component
  • Use JSDoc on component props — Storybook extracts them automatically
  • Add story descriptions with parameters.docs.description.story
  • Use autodocs tag for automatic documentation pages: tags: ["autodocs"]

Interaction Tests

  • Use play functions for interaction testing: play: async ({ canvasElement }) => { ... }
  • Import from @storybook/test: expect, within, userEvent, fn
  • Use fn() for action args — enables assertion on callback invocations
  • Test user flows in play functions: click, type, verify DOM changes
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 46 lines · 466 tokens per session scan A 50c3510d0ea2

Subscribe to this mod's changes

storybook is a cursor rule published in the GitHub repository nedcodes-ok/cursorrules-collection (37 stars, last pushed 6mo ago), licensed MIT. It adds 466 tokens to every session, about $0.0023 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.