一键导入
enhance-component-docs
Enhance React component documentation with JSDoc, improved Storybook stories, and autodoc configuration.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Enhance React component documentation with JSDoc, improved Storybook stories, and autodoc configuration.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Bump version to next alpha and update dependencies after release.
Create a release branch, tag, and GitHub release for Backend.AI WebUI.
Create or Update BUI Component Story (project)
Update React components with JSDoc and enhanced Storybook stories with autodoc functionality.
Generate Relay-based Nodes components with BAITable integration following established patterns (BAIUserNodes, SessionNodes, BAISchedulingHistoryNodes, BAIRouteNodes). Automatically creates component file with GraphQL fragment, type definitions, column configurations, and customization patterns. Minimal user input required - just provide GraphQL type name and the skill generates a complete starting template.
Use when creating a new React component under `react/src/` or `packages/backend.ai-ui/src/`, or refactoring one's file layout, import order, `'use memo'` placement, hook call order, or prop interface. Covers naming conventions (`BAI*`, `*Nodes`, `*Page`) and React 19 rules.
| name | enhance-component-docs |
| description | Enhance React component documentation with JSDoc, improved Storybook stories, and autodoc configuration. |
| argument-hint | <component-files...> |
| model | sonnet |
| disable-model-invocation | true |
Automatically enhance React component documentation with JSDoc comments, improved Storybook stories, and autodoc configuration.
/enhance-component-docs <component-files...>
This command replicates the comprehensive documentation enhancement process:
For each component file, add documentation following these patterns:
/**
* Configuration interface for component settings
* Extends base props with custom functionality
*/
export interface ComponentProps extends BaseProps {
/** Whether the component should be visible */
visible?: boolean;
/** Callback function called when state changes */
onStateChange?: (newState: State) => void;
/** Configuration object for advanced features */
config?: ComponentConfig;
}
/**
* Array type for component items
*/
export type ComponentItems<T = any> = ComponentItem<T>[];
/**
* Utility function to determine component visibility
* Takes into account multiple factors and overrides
*
* @param item - The component item to check
* @param key - Unique identifier for the item
* @param overrides - Override settings to apply
* @returns Whether the item should be visible
*/
export const isItemVisible = (
item: ComponentItem,
key: string,
overrides?: OverrideSettings,
): boolean => {
// implementation
};
/**
* ComponentName - Brief description of what it does
*
* A comprehensive component that provides:
* - Feature 1 with detailed explanation
* - Feature 2 with use cases
* - Feature 3 with configuration options
*
* Key capabilities:
* - List important capabilities
* - Explain complex behaviors
* - Document integration patterns
*
* @param props - ComponentProps configuration
* @returns React element
*
* @example
* ```tsx
* <ComponentName
* visible={true}
* config={{
* feature1: true,
* feature2: 'advanced'
* }}
* onStateChange={handleStateChange}
* />
* ```
*/
const ComponentName = (props: ComponentProps): React.ReactElement => {
// implementation
};
ComponentName.displayName = 'ComponentName';
Important: Due to version compatibility issues, use this simplified approach:
Update .storybook/main.ts:
import type { StorybookConfig } from '@storybook/react-vite';
const config: StorybookConfig = {
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
addons: [
'@storybook/addon-docs',
'@storybook/addon-onboarding',
],
framework: {
name: '@storybook/react-vite',
options: {},
},
docs: {
defaultName: 'Documentation',
},
typescript: {
reactDocgen: false, // Disable to prevent "Cannot convert a symbol to a string" errors
},
};
export default config;
Update .storybook/preview.tsx (note .tsx extension):
import type { Preview } from '@storybook/react-vite';
import { ConfigProvider } from 'antd';
import React from 'react';
const preview: Preview = {
tags: ['autodocs'],
decorators: [
(Story) => (
<ConfigProvider>
<div style={{ padding: '16px' }}>
<Story />
</div>
</ConfigProvider>
),
],
parameters: {
docs: {
extractComponentDescription: (_component: any, { notes }: any) => {
return notes?.markdown || notes?.text || null;
},
},
layout: 'padded',
},
};
export default preview;
Create comprehensive stories with this template:
import type { Meta, StoryObj } from '@storybook/react-vite';
import { ComponentName, ComponentProps } from './ComponentName';
const meta: Meta<typeof ComponentName> = {
title: 'Components/ComponentName',
component: ComponentName,
tags: ['autodocs'], // Enable autodocs
parameters: {
layout: 'padded',
docs: {
description: {
component: `
ComponentName provides [brief description].
## Key Features
### Feature 1
Detailed explanation of the feature and its benefits.
### Feature 2
How this feature works and when to use it.
### Integration
How to integrate with other components or systems.
## Usage Patterns
### Basic Usage
Simple examples for common use cases.
### Advanced Configuration
Examples of complex configurations and edge cases.
`,
},
},
},
argTypes: {
// Manual argTypes definition (since TypeScript docgen is disabled)
visible: {
control: { type: 'boolean' },
description: 'Control component visibility',
table: {
type: { summary: 'boolean' },
defaultValue: { summary: 'true' },
},
},
config: {
control: { type: 'object' },
description: 'Advanced configuration options',
table: {
type: { summary: 'ComponentConfig' },
},
},
onStateChange: {
action: 'stateChanged',
description: 'Called when component state changes',
table: {
type: { summary: '(newState: State) => void' },
},
},
children: {
control: false, // Non-interactive prop
description: 'Component children content',
table: {
type: { summary: 'ReactNode' },
},
},
},
};
export default meta;
type Story = StoryObj<typeof ComponentName>;
export const Default: Story = {
parameters: {
docs: {
description: {
story: 'Basic usage with default settings. Shows the component in its simplest form.',
},
},
},
args: {
visible: true,
config: {
// default config
},
},
};
export const Interactive: Story = {
parameters: {
docs: {
description: {
story: 'Interactive example with state management. Demonstrates callbacks and dynamic behavior.',
},
},
},
render: () => {
const [state, setState] = useState(initialState);
return (
<ComponentName
visible={state.visible}
config={state.config}
onStateChange={(newState) => {
setState(newState);
console.log('State changed:', newState);
}}
/>
);
},
};
export const ConfigurationVariants: Story = {
parameters: {
docs: {
description: {
story: 'Different configuration options showing component flexibility.',
},
},
},
args: {
visible: true,
config: {
// specific configuration
},
},
};
For complex components with sub-components, create dedicated story files:
// SubComponent.stories.tsx
const meta: Meta<typeof SubComponent> = {
title: 'Components/ComponentName/SubComponent',
component: SubComponent,
tags: ['autodocs'],
parameters: {
docs: {
description: {
component: 'SubComponent documentation focusing on its specific functionality.',
},
},
},
};
After enhancement:
For each component, ensure these files are created/updated:
Component.tsx - JSDoc comments addedComponent.stories.tsx - Enhanced stories with descriptionsSubComponent.stories.tsx - Sub-component stories (if applicable).storybook/main.ts - Autodoc configuration enabled.storybook/preview.ts - Global autodoc settingsreactDocgen: false@storybook/* packages are the same version.tsx extension for preview filesimport React from 'react'