本文へ移動
cccskills
無料GitHub で公開

component-stories

Use when creating or editing Storybook stories (*.stories.tsx, React or React Native) — story layout, docs source type, controls, and export naming conventions.

インストール方法を見る

含まれるファイル(1)

  • SKILL.md4.4 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

Storybook Story Guidelines

When creating or modifying Storybook stories, follow these conventions strictly:

Meta typing

const meta = {
  component: Component,
} satisfies Meta<typeof Component>;

export default meta;
type Story = StoryObj<typeof Component>;

Use satisfies Meta<typeof Component> (not a Meta<…> annotation) and StoryObj<typeof Component> (not typeof meta — that makes args required on every story).

Story Layout Configuration

Centering and Background

All stories must include these parameters:

export const Base: Story = {
  parameters: {
    layout: 'centered',
    backgrounds: { default: 'light' },
  },
  args: {
    // Component props
  },
};
  • Layout: Stories should be centered.
  • Background: Stories should use white background.

Docs source type

Set dynamic docs source once on the story meta. Every story inherits it, including showcases and feature stories that have no args. Storybook extracts the snippet from the render function, so <Source of={…} /> in the MDX stays in sync with the story.

const meta = {
  component: Component,
  parameters: {
    docs: {
      source: {
        language: 'tsx',
        format: true,
        type: 'dynamic',
      },
    },
  },
} satisfies Meta<typeof Component>;
  • Do not set docs.source.type to 'code'.
  • Do not hand-write parameters.docs.source.code. A second copy of the JSX drifts from the render.
  • Do not override the meta source on an individual story.

Controls

Prefer controls inferred from component prop types (react-docgen-typescript is configured in Storybook). Do not duplicate argTypes for basic props already described in types.ts (unions, booleans, strings).

  • Add a Base story with args and a render that consumes them — required for Controls to appear in docs.
  • Add manual argTypes only for overrides docgen cannot express (actions, select mappings, hiding props).

Story Export Names

To maintain consistency across our Storybook documentation, follow these naming rules:

1. Base Story

The default, most basic usage of the component.

  • Use: Base
  • Do not use: Default, Primary, Basic

2. Showcase Stories

Showcase stories demonstrate variations of a single property.

  • Use the pattern: {Property}Showcase
  • Do not use: States, AllStates, StatesShowcase

3. Feature-Specific Stories

Stories highlighting specific features.

  • Use: With{Feature} (e.g., WithIcon, WithTooltip)

4. Truncation / Responsiveness Stories

Stories that demonstrate how a component truncates or adapts to constrained space.

  • Use: ResponsivenessShowcase
  • Do not use: TruncateShowcase, Truncation, LongLabel

Comments

Do not add comments in *.stories.tsx — no JSDoc above stories, no // or /* */ explanations. Story intent belongs in MDX or the export name. Keep only a required lint directive (e.g. eslint-disable-next-line) when a suppression is unavoidable.

General Principles

  1. Consistency over creativity: Follow the patterns even if you think another name might be clearer
  2. Singular property names: Use SizeShowcase not SizesShowcase
  3. PascalCase: All story names use PascalCase (e.g., WithTooltip)
  4. Avoid ambiguity: Don't use generic names like Example1, Test, Demo

Review checks

Rules verifiable from a diff.

CheckApplies toDetectSkip
Base story named Default/Primary/Basic instead of Baseall storiesexport name—
Showcase/feature story off-conventionall storiesnot {Property}Showcase / With{Feature} / ResponsivenessShowcase—
Missing layout: 'centered' + backgrounds: { default: 'light' }all storiesBase parameters—
type: 'code' or a hand-written docs.source.codeall storiesdocs.source.type: 'code' or a source.code stringmeta type: 'dynamic' with no source.code
argTypes duplicated for props docgen already infersall storiesmanual argTypes for plain unions/booleans/stringsoverrides docgen can't express (actions, select mappings, hiding)

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

Creates and maintains Figma Code Connect files (`*.figma.tsx`) that map Figma components to code via the parser-based `figma.connect()` API. Use when the user mentions Code Connect, Figma component mapping, design-to-code translation, or asks to create/update .figma.tsx files.

日本語の概要は準備中です。原文の説明を表示しています。

LedgerHQ/lumen232026年10月10日 更新

Use when creating, naming, or placing a file or folder in libs/*, or when modifying or adding a file to an existing component (even when the barrel isn't touched) — component vs utility naming, the one-responsibility-per-file layout, when a folder needs an `index.ts` barrel (public API only), and the required set of files a component needs per lib. Load this before scaffolding or restructuring a component so the layout matches the codebase.

日本語の概要は準備中です。原文の説明を表示しています。

LedgerHQ/lumen232026年10月10日 更新

Use when designing or changing a component's public API, its composition, or its state model in libs/ui-react or libs/ui-rnative — layering (core vs internal vs primitives), BaseProps/Props splits, converting a component to compound / changing its composition with createSafeContext, controlled/uncontrolled state, prop-naming conventions, and cross-platform API parity. Load this before shaping a new component, changing its props, or refactoring its composition.

日本語の概要は準備中です。原文の説明を表示しています。

LedgerHQ/lumen232026年10月10日 更新

Use when writing or editing Storybook MDX docs (*.mdx) — the two-tab Overview/Implementation structure, story-backed `<Source>` examples, and doc table guidelines.

日本語の概要は準備中です。原文の説明を表示しています。

LedgerHQ/lumen232026年10月10日 更新

Use when building or styling a component in libs/ui-react or libs/ui-rnative — the cross-platform styling principles, plus routing to the platform mechanics: Tailwind + cva + cn on web, useStyleSheet + themeJS + lx on React Native. Load this before writing component styles.

日本語の概要は準備中です。原文の説明を表示しています。

LedgerHQ/lumen232026年10月10日 更新

Use when writing or editing component tests in libs/ui-react or libs/ui-rnative — shared structure and coverage conventions, plus the per-platform runner: Vitest + React Testing Library on web, Jest + React Native Testing Library on RN. Load this before writing tests.

日本語の概要は準備中です。原文の説明を表示しています。

LedgerHQ/lumen232026年10月10日 更新

LedgerHQ のスキルをすべて見る

このスキルの問題を報告する