Agent Skillsluxury-yacht/app › new-story

new-story

GitHub

为指定组件生成Storybook故事文件,遵循真实组件渲染、使用项目CSS类、仅模拟数据等规则,利用现有装饰器和Mock,覆盖多种状态并验证编译。

.agents/skills/new-story/SKILL.md luxury-yacht/app

触发场景

需要为新组件创建Storybook展示用例 需要补充或更新现有组件的Storybook故事

安装

npx skills add luxury-yacht/app --skill new-story -g -y
更多选项

非标准路径

npx skills add https://github.com/luxury-yacht/app/tree/main/.agents/skills/new-story -g -y

不安装直接使用

npx skills use luxury-yacht/app@new-story

指定 Agent (Claude Code)

npx skills add luxury-yacht/app --skill new-story -a claude-code -g -y

安装 repo 全部 skill

npx skills add luxury-yacht/app --all -g -y

预览 repo 内 skill

npx skills add luxury-yacht/app --list

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

  1. Use real components. Import and render the actual component. Never approximate with inline styles.
  2. Use real CSS classes. If you need wrapper markup, use the project's actual CSS classes — never inline styles that mimic them.
  3. Mock only data, not rendering. Mock Go backend calls via window.__storybookGoOverrides, mock props with realistic data. Never mock the component's visual output.
  4. 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.
  5. Use existing decorators. Check frontend/.storybook/decorators/ for providers:
    • SidebarProvidersDecorator — KubeconfigProvider + NamespaceProvider
    • AppearanceModeProviderDecorator — appearance mode context
    • KeyboardProviderDecorator — keyboard shortcuts
    • KubeconfigProviderDecorator — kubeconfig only
    • ZoomProviderDecorator — zoom context
  6. Use existing mocks. Check frontend/.storybook/mocks/ for Go backend mocks (wailsBackendApp.ts, wailsBackendSettings.ts, wailsModels.ts).
  7. Story file location. Place the .stories.tsx file next to the component it tests.
  8. 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.

版本历史

  • ee846a6 当前 2026-08-20 13:02

同 Skill 集合

.agents/skills/add-resource/SKILL.md
.agents/skills/app-review/SKILL.md
.agents/skills/app-shell/SKILL.md
.agents/skills/branch-review/SKILL.md
.agents/skills/browse-tables/SKILL.md
.agents/skills/cluster-auth-lifecycle/SKILL.md
.agents/skills/draft-release-notes/SKILL.md
.agents/skills/improve-backend/SKILL.md
.agents/skills/improve-frontend/SKILL.md
.agents/skills/make-impossible-states-impossible/SKILL.md
.agents/skills/object-map/SKILL.md
.agents/skills/object-panel/SKILL.md
.agents/skills/operations-workflows/SKILL.md
.agents/skills/permissions-capabilities/SKILL.md
.agents/skills/refresh-subsystem/SKILL.md
.agents/skills/shared-resource-model/SKILL.md

元信息

文件数
0
版本
6f0d98f
Hash
0459fdf1
收录时间
2026-08-20 13:02

首页 - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-09-09 10:36
浙ICP备14020137号-1 $访客地图$