Agent Skills
› luxury-yacht/app
› new-story
new-story
GitHub为指定组件生成Storybook故事文件,遵循真实组件渲染、使用项目CSS类及Mock数据规则,自动追踪Hook依赖并应用现有Decorators,最终验证类型检查通过。
Trigger Scenarios
需要为新组件创建Storybook测试用例
请求生成前端组件的故事文件
Install
npx skills add luxury-yacht/app --skill new-story -g -y
SKILL.md
Frontmatter
{
"name": "new-story",
"description": "Generate a Storybook story for a component using real components and project CSS classes"
}
New Story
Generate a Storybook story for a given component.
Arguments
/new-story <ComponentPath> — path to the component (e.g. frontend/src/ui/modals/MyModal.tsx)
Rules
- Use real components. Import and render the actual component. Never approximate with inline styles.
- Use real CSS classes. If you need wrapper markup, use the project's actual CSS classes — never inline styles that mimic them.
- Mock only data, not rendering. Mock Go backend calls via
window.__storybookGoOverrides, mock props with realistic data. Never mock the component's visual output. - Trace ALL hook dependencies before writing. Read the component and every hook it uses. Identify which providers are needed. Don't discover them one crash at a time.
- Use existing decorators. Check
frontend/.storybook/decorators/for providers:SidebarProvidersDecorator— KubeconfigProvider + NamespaceProviderAppearanceModeProviderDecorator— appearance mode contextKeyboardProviderDecorator— keyboard shortcutsKubeconfigProviderDecorator— kubeconfig onlyZoomProviderDecorator— zoom context
- Use existing mocks. Check
frontend/.storybook/mocks/for Go backend mocks (wailsBackendApp.ts,wailsBackendSettings.ts,wailsModels.ts). - Story file location. Place the
.stories.tsxfile next to the component it tests. - Multiple stories per file. Create stories for the main states: default, loading, error, empty, and any interesting prop variations.
Template
/**
* <file path>
*
* Storybook stories for the <ComponentName> component.
*/
import type { Meta, StoryObj } from '@storybook/react';
import <ComponentName> from './<ComponentName>';
// import decorators as needed
const meta: Meta<typeof <ComponentName>> = {
title: '<Category>/<ComponentName>',
component: <ComponentName>,
// decorators: [SidebarProvidersDecorator],
};
export default meta;
type Story = StoryObj<typeof <ComponentName>>;
/** Default state. */
export const Default: Story = {
args: {
// realistic props
},
};
Verification
After creating the story, run
mise exec -- npm run typecheck --prefix frontend to confirm it compiles without
errors.
Version History
- ee846a6 Current 2026-08-20 13:02


