ワンクリックで
storybook-code-tab
Add or update parameters.docs.source.code on Storybook stories to provide clean JSX code snippets in the Code tab
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Add or update parameters.docs.source.code on Storybook stories to provide clean JSX code snippets in the Code tab
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Migrate a design-system component off Ant Design to a DS-native styled-components implementation. Encodes the playbook + refinements from the Badge/Typography migrations so each subsequent component is faster. Use when removing antd from a `@synerise/ds-*` package (the antd-removal initiative).
End-to-end DS release — publish bumped packages with lerna, generate a changelog from GitLab MRs, create a Jira release task plus a GitLab release, post a two-audience release changelog to the Teams releases channel, and optionally open DS-upgrade branches/MRs in the portal-ui-bridge and portal-next consumer repos
Add or update an MDX overview documentation page for a component in Storybook, detailing usage patterns, API surface, and implementation guidance.
Audit a design system package for code quality, test coverage, Storybook completeness, and code hygiene issues. Produces a severity-ranked report and a fix plan for critical/important issues.
Verify a component package is ready for publishing by checking documentation, stories, argTypes, code tabs, overview page, unit tests, and interaction tests.
Generate a CLAUDE.md file for a design system component package that documents its structure, API, sub-components, and implementation details for AI-assisted development.
| name | storybook-code-tab |
| description | Add or update parameters.docs.source.code on Storybook stories to provide clean JSX code snippets in the Code tab |
Generate developer-friendly JSX code strings for the parameters.docs.source.code field on each exported story in a component's *.stories.tsx file. These strings appear in the custom Code panel (packages/storybook/addon-code-panel/CodePanel.tsx) and serve as copy-paste references for developers.
The user must provide:
ActionArea, Badge, ToastThe user may optionally provide:
Find the story file at the standard path:
packages/storybook/stories/components/<ComponentName>/<ComponentName>.stories.tsx
If not found, search with:
packages/storybook/stories/components/**/<ComponentName>.stories.tsx
Also check for associated data/constants files in the same directory (e.g., <ComponentName>.data.tsx, <ComponentName>.constants.ts) — these may contain helpers referenced by stories.
Skip any .test.stories.tsx or .tests.stories.tsx files — those are visual/interaction test stories.
Read the complete story file. Identify:
Meta/default export — extract:
component field (the primary component name for JSX tags)render function at the meta level (default render for all stories)args at the meta level (default args inherited by all stories)argTypes (to understand prop types)All named story exports — for each, extract:
args (including spread references like ...Default.args)render function (story-level override)parameters.docs.source.code (updating vs adding)...Default, ...Simple)Imports — note which components and icons are imported, as the code snippet should reference the same names. Prefer direct named imports (e.g., Expander) over deprecated compound component syntax (e.g., Button.Expander).
Existing code snippets — if a story already has parameters.docs.source.code, still verify it matches the current imports, args, and render. Update it if the component name, props, or structure have changed.
Category A: Args-only (no custom render, or meta-level render that just does <Component {...args} />)
→ Generate <Component prop1="value" prop2={123} />
Category B: Simple custom render → Read the render JSX, substitute args values, produce concrete example
Category C: Showcase/map render (renders multiple component instances, maps over arrays) → Generate a simplified representative snippet showing the pattern
Category D: Visual test / matrix — SKIP
Stories named *Matrix*, *MatrixHover*, *MatrixFocus*, or with tags: ['visualtests'].
Do not add parameters.docs.source.code to these.
For each non-skipped story, compute the final args by resolving:
args — base defaults from the default export...Default.args, ...WithTotal.args, etc. by looking up the referenced story. Chain through multiple levels if needed.args — override everything above...Default (spreading the entire story object, not just args), it inherits render, args, parameters, etc.| Value type | Output |
|---|---|
String 'Label' | prop="Label" |
Boolean true | prop (shorthand) |
Boolean false | prop={false} |
Number 123 | prop={123} |
Function fn() | prop={fn()} |
Object { key: 'value' } | prop={{ key: 'value' }} |
| JSX expression | Inline as-is |
Theme ref theme.palette['green-600'] | Keep as-is |
<ComponentName
prop1="stringValue"
prop2={123}
prop3
prop4={fn()}
/>
If args include children, use closing tag form:
<ComponentName prop1="value">
{children}
</ComponentName>
Prop completeness: Include ALL props from the resolved args in the code snippet. Do not selectively omit props. The only exceptions are:
children (rendered as JSX children, not a prop)undefined value'') — omit these as they represent "no value"false where the prop defaults to false — omit these as they are redundantInclude prop={false} ONLY when the prop defaults to true (i.e., the false is an intentional override). To determine defaults, check the component's defaultProps, the meta-level args, or the argTypes configuration. When in doubt about the default, include the prop.
Prop order: Follow the order they appear in the story's args object. Spread args first, then overrides.
Read the render function's JSX. Substitute args values to produce a concrete example. Replace {...args} spread with the actual resolved prop values. Ensure ALL args that are passed via {...args} spread appear as explicit props in the code snippet — do not omit any.
Example: render ({ status }) => <Badge status={status} text="test" /> with args { status: 'active' } → <Badge status="active" text="test" />
Show the pattern with a literal array:
<>
{['success', 'warning', 'error'].map(type => (
<Alert message="Message" type={type} />
))}
</>
Use multiline backtick template literals (the majority convention in this codebase):
parameters: {
docs: {
source: {
code: `<ComponentName
prop1="value"
prop2={123}
/>`
}
}
}
Consistency rule: If the file already has stories with parameters.docs.source.code using escaped \n strings (like ActionArea), match that format. Otherwise use the multiline backtick format.
Updating the file with Edit tool:
parameters.docs.source.code → replace the existing code valueparameters but no docs.source.code → add docs: { source: { code: ... } } inside existing parametersparameters → add the entire parameters block as the first field in the story object (before args, render, etc.)After all edits:
parameters.docs.source.codeOutput:
pnpm run storybook