react-docs-generator
Generate React component documentation for SEED Design System. Use when creating new React component docs in ./docs/content/react/components or updating existing implementation documentation. Helps document component APIs, props, installation, and usage examples.
$ Installieren
git clone https://github.com/daangn/seed-design /tmp/seed-design && cp -r /tmp/seed-design/.claude/skills/react-docs-generator ~/.claude/skills/seed-design// tip: Run this command in your terminal to install the skill
name: react-docs-generator description: Generate React component documentation for SEED Design System. Use when creating new React component docs in ./docs/content/react/components or updating existing implementation documentation. Helps document component APIs, props, installation, and usage examples. allowed-tools: Read, Write, Glob, Grep, Bash
React Component Documentation Generator
Generate comprehensive React component documentation following SEED Design patterns.
Purpose
์ด ์คํฌ์ SEED Design System์ React ์ปดํฌ๋ํธ ๊ตฌํ ๋ฌธ์๋ฅผ ์์ฑํฉ๋๋ค. ์ปดํฌ๋ํธ API, Props, ์ค์น ๋ฐฉ๋ฒ, ์ฌ์ฉ ์์ ๋ฑ์ ํ์คํ๋ ํ์์ผ๋ก ์์ฑํ ์ ์๋๋ก ๋์ต๋๋ค.
When to Use
๋ค์ ์ํฉ์์ ์ด ์คํฌ์ ์ฌ์ฉํ์ธ์:
- ์ React ์ปดํฌ๋ํธ ๋ฌธ์ ์์ฑ: ์๋ก์ด ์ปดํฌ๋ํธ์ React ๊ตฌํ ๋ฌธ์๋ฅผ ์ฒ์ ์์ฑํ ๋
- ๊ธฐ์กด ๋ฌธ์ ์ ๋ฐ์ดํธ: ์ปดํฌ๋ํธ API ๋ณ๊ฒฝ, ์๋ก์ด Props ์ถ๊ฐ, ์์ ์ ๋ฐ์ดํธ ์
- ์์ ์ฝ๋ ์ถ๊ฐ: ์๋ก์ด ์ฌ์ฉ ํจํด์ด๋ use case ์์๋ฅผ ์ถ๊ฐํ ๋
- ์ค์น ๊ฐ์ด๋ ์์ฑ: CLI ์ค์น ๋๋ ์๋ ์ค์น ๋ฐฉ๋ฒ์ ๋ฌธ์ํํ ๋
ํธ๋ฆฌ๊ฑฐ ํค์๋: "React ๋ฌธ์", "component docs", "implementation docs", "API documentation", "usage examples"
Key Features
- ComponentExample ํตํฉ:
doc-gen:file๊ตฌ๋ฌธ์ผ๋ก ์ค์ ์ฝ๋ ์์ ์๋ฒ ๋ - ์ค์น ๊ฐ์ด๋ ์๋ํ: CLI ๋ฐ ์๋ ์ค์น ๋ฐฉ๋ฒ ํ ํ๋ฆฟ ์ ๊ณต
- Props ๋ฌธ์ํ: TypeScript ํ์ ๊ณผ ํจ๊ป Props ํ ์ด๋ธ ์์ฑ
- Usage ํจํด: Import ๋ฌธ๋ถํฐ ์ปดํฌ๋ํธ ์ฌ์ฉ๊น์ง ๋จ๊ณ๋ณ ๊ฐ์ด๋
- MDX ์ปดํฌ๋ํธ ํ์ฉ: ์๋์ผ๋ก import๋๋ ํน์ ์ปดํฌ๋ํธ ์ฌ์ฉ
Documentation Structure
React ์ปดํฌ๋ํธ ๋ฌธ์๋ ๋ค์ ๊ตฌ์กฐ๋ฅผ ๋ฐ๋ฆ ๋๋ค:
---
title: {Component Name}
description: {ํ๊ตญ์ด ์ค๋ช
}
---
## Example # ์ปดํฌ๋ํธ ์ฌ์ฉ ์์
## Installation # CLI ๋๋ ์๋ ์ค์น ๋ฐฉ๋ฒ (Snippet ๋ ์ด์ด๊ฐ ์๋ ๊ฒฝ์ฐ)
## Usage # Import ๋ฐ ๊ธฐ๋ณธ ์ฌ์ฉ๋ฒ
## Props # Props API ๋ฌธ์ (์ ํ)
## Examples # ๋ค์ํ ์ฌ์ฉ ์ฌ๋ก
## Accessibility # ์ ๊ทผ์ฑ ๊ฐ์ด๋ (์ ํ)
## API Reference # ์์ธ API ๋ ํผ๋ฐ์ค (์ ํ)
Workflow
Step 1: ์ปดํฌ๋ํธ ์ ๋ณด ์์ง
์ฌ์ฉ์์๊ฒ ๋ค์ ์ ๋ณด๋ฅผ ์์ฒญํฉ๋๋ค:
ํ์ ์ ๋ณด:
- Component ID: ์)
alert-dialog,badge,button - Component Name: ์) "Alert Dialog", "Badge", "Button"
- Description: ํ๊ตญ์ด๋ก ์ปดํฌ๋ํธ ์ค๋ช (1-2๋ฌธ์ฅ)
์ ํ ์ ๋ณด:
- Has Snippet Layer: Snippet ๋ ์ด์ด ์กด์ฌ ์ฌ๋ถ (์์ผ๋ฉด Installation ์น์ ํฌํจ)
- Component Type:
- Composite: ์ฌ๋ฌ sub-component๋ก ๊ตฌ์ฑ (์: Alert Dialog)
- Simple: ๋จ์ผ ์ปดํฌ๋ํธ (์: Badge)
- Custom Sections: Props, Accessibility, API Reference ๋ฑ ์ถ๊ฐ ์น์
Step 2: Snippet ๋ ์ด์ด ํ์ธ
./docs/registry/ui/{component-id}.tsx ํ์ผ์ด ์๋์ง ํ์ธํฉ๋๋ค:
- Snippet ์์ โ Installation ์น์ ํฌํจ, Usage์์ Snippet import ์ฌ์ฉ
- Snippet ์์ โ
@seed-design/react์์ ์ง์ import, Usage๋ง ์์ฑ
# Snippet ๋ ์ด์ด ํ์ธ
ls docs/registry/ui/{component-id}.tsx
Step 3: ์ปดํฌ๋ํธ ๊ตฌ์กฐ ํ์
Composite ์ปดํฌ๋ํธ์ธ ๊ฒฝ์ฐ:
- Snippet ํ์ผ ๋๋
@seed-design/reactexport๋ฅผ ํ์ธํ์ฌ sub-component ๋ชฉ๋ก ์ถ์ถ - ์) Alert Dialog: AlertDialog, AlertDialogTrigger, AlertDialogContent, AlertDialogHeader, etc.
Simple ์ปดํฌ๋ํธ์ธ ๊ฒฝ์ฐ:
- ๋จ์ผ ์ปดํฌ๋ํธ๋ง ๋ฌธ์ํ
- ์) Badge: Badge๋ง
Step 4: ๋ฌธ์ ์์ฑ
Example Section
<ComponentExample> ์ปดํฌ๋ํธ๋ฅผ ์ฌ์ฉํ์ฌ ๋ํ ์์๋ฅผ ์์ฑํฉ๋๋ค.
## Example
<ComponentExample name="react/{component-id}/default">
```json doc-gen:file
{
"file": "examples/react/{component-id}/default.tsx",
"codeblock": true
}
์ฐธ๊ณ :
<ComponentExample>์ปดํฌ๋ํธ๋ mdx-components์์ ์๋ import๋จname์์ฑ:react/{component-id}/{example-name}ํจํดdoc-gen:file์ ์ฌ์ฉํ๋ฉด ์ค์ ํ์ผ ๋ด์ฉ์ด ์ฝ๋๋ธ๋ก์ผ๋ก ๋ ๋๋ง๋จ
Installation Section (Snippet ๋ ์ด์ด๊ฐ ์๋ ๊ฒฝ์ฐ๋ง)
Snippet ๋ ์ด์ด๊ฐ ์กด์ฌํ๋ ๊ฒฝ์ฐ CLI ์ค์น ๋ฐฉ๋ฒ์ ์๋ดํฉ๋๋ค:
## Installation
๋ค์ ๋ช
๋ น์ด๋ก ์ปดํฌ๋ํธ๋ฅผ ์ค์นํ ์ ์์ต๋๋ค:
```package-install
npx @seed-design/cli@latest add ui:{component-id}
์๋ ์ค์น
CLI๋ฅผ ์ฌ์ฉํ์ง ์๊ณ ์ง์ ์ค์นํ๋ ค๋ฉด ๋ค์ ๋ฐฉ๋ฒ์ ์ฌ์ฉํ์ธ์:
Snippet ๋ ์ด์ด๊ฐ ์๋ ๊ฒฝ์ฐ:
- Installation ์น์ ์๋ต
- Usage ์น์
์์ ๋ฐ๋ก
@seed-design/react์์ import ์๋ด
Usage Section
์ปดํฌ๋ํธ์ ๊ธฐ๋ณธ ์ฌ์ฉ๋ฒ์ ์๋ดํฉ๋๋ค.
Composite ์ปดํฌ๋ํธ ์์ (Alert Dialog):
## Usage
Alert Dialog๋ ๋ค์ sub-component๋ค๋ก ๊ตฌ์ฑ๋ฉ๋๋ค:
```tsx
import {
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
AlertDialogContent,
AlertDialogDescription,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
AlertDialogTrigger,
} from "@/components/ui/alert-dialog" // Snippet์ด ์๋ ๊ฒฝ์ฐ
// ๋๋
// } from "@seed-design/react" // Snippet์ด ์๋ ๊ฒฝ์ฐ
๊ธฐ๋ณธ ์ฌ์ฉ ์์:
<AlertDialog>
<AlertDialogTrigger>Open</AlertDialogTrigger>
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>Are you absolutely sure?</AlertDialogTitle>
<AlertDialogDescription>
This action cannot be undone. This will permanently delete your account
and remove your data from our servers.
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel>Cancel</AlertDialogCancel>
<AlertDialogAction>Continue</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
### Simple ์ปดํฌ๋ํธ ์์ (Badge):
```markdown
## Usage
Badge ์ปดํฌ๋ํธ๋ฅผ ์ฌ์ฉํ๋ ค๋ฉด ๋ค์๊ณผ ๊ฐ์ด importํฉ๋๋ค:
```tsx
import { Badge } from "@seed-design/react";
๊ธฐ๋ณธ ์ฌ์ฉ ์์:
<Badge>Badge</Badge>
**Usage ์์ฑ ๊ฐ์ด๋**:
1. **Import ๊ฒฝ๋ก ๋ช
ํํ**:
- Snippet ์์: `@/components/ui/{component-id}`
- Snippet ์์: `@seed-design/react`
2. **Sub-component ๋ชฉ๋ก**: Composite์ธ ๊ฒฝ์ฐ ๋ชจ๋ sub-component ๋์ด
3. **๊ธฐ๋ณธ ๊ตฌ์กฐ**: ์ปดํฌ๋ํธ์ ์ ํ์ ์ธ ๊ณ์ธต ๊ตฌ์กฐ ์์ ์ ๊ณต
4. **๊ฐ๊ฒฐํจ**: Usage๋ ๊ฐ์ฅ ๊ธฐ๋ณธ์ ์ธ ์ฌ์ฉ๋ฒ๋ง, ์์ธํ ์์๋ Examples ์น์
์
## Examples Section
๋ค์ํ ์ฌ์ฉ ์ฌ๋ก์ ํจํด์ ๋ณด์ฌ์ค๋๋ค.
```markdown
## Examples
### {Use Case 1}
<ComponentExample name="react/{component-id}/{example-name}">
```json doc-gen:file
{
"file": "examples/react/{component-id}/{example-name}.tsx",
"codeblock": true
}
{Use Case 2}
Examples ์์ฑ ๊ฐ์ด๋:
- ๊ฐ ์์๋ ๋ช ํํ use case๋ฅผ ๋ณด์ฌ์ค์ผ ํจ
- ์์ ์ด๋ฆ์ ์๋ฏธ ์๋ ์ผ๋ฐฅ์ผ์ด์ค ์ฌ์ฉ (์:
with-icon,loading-state,custom-variant) - ์ค์
examples/react/{component-id}/ํด๋์ ์์ ํ์ผ์ด ์์ด์ผ ํจ - ๋ณต์กํ ํจํด์ผ์๋ก ์์ธํ ์ค๋ช ์ถ๊ฐ
์ผ๋ฐ์ ์ธ Examples:
- Default: ๊ธฐ๋ณธ ์ฌ์ฉ
- With Icon: ์์ด์ฝ ํฌํจ
- Variants: ๋ค์ํ variant ์กฐํฉ
- Sizes: ๋ค์ํ size ์กฐํฉ
- States: disabled, loading ๋ฑ ์ํ ๋ณํ
- Custom Styling: ์ปค์คํ ์คํ์ผ ์ ์ฉ
- Composition: ๋ค๋ฅธ ์ปดํฌ๋ํธ์ ์กฐํฉ
Props Section (์ ํ)
์ปดํฌ๋ํธ์ Props API๋ฅผ ๋ฌธ์ํํฉ๋๋ค.
## Props
### {ComponentName}
| Prop | Type | Default | Description |
|------|------|---------|-------------|
| variant | `'default' \| 'primary' \| 'secondary'` | `'default'` | ์ปดํฌ๋ํธ์ ์๊ฐ์ ์คํ์ผ์ ์ง์ ํฉ๋๋ค. |
| size | `'small' \| 'medium' \| 'large'` | `'medium'` | ์ปดํฌ๋ํธ์ ํฌ๊ธฐ๋ฅผ ์ง์ ํฉ๋๋ค. |
| disabled | `boolean` | `false` | ์ปดํฌ๋ํธ๋ฅผ ๋นํ์ฑํํฉ๋๋ค. |
| children | `React.ReactNode` | - | ์ปดํฌ๋ํธ์ ์์ ์์์
๋๋ค. |
Props ์์ฑ ๊ฐ์ด๋:
- TypeScript ํ์
์ ์ ํํ ํ๊ธฐ (Union ํ์
์ ๋ฐฑํฑ ๋ด์์
\|์ฌ์ฉ) - Default ๊ฐ์ด ์์ผ๋ฉด ๋ช
์, ์์ผ๋ฉด
- - Description์ ํ๊ตญ์ด๋ก ๋ช ํํ๊ฒ
- Composite ์ปดํฌ๋ํธ๋ ๊ฐ sub-component๋ง๋ค Props ํ ์ด๋ธ ์์ฑ
File Paths
๋ฌธ์ ํ์ผ:
docs/content/react/components/{component-id}.mdx
์์ ํ์ผ:
examples/react/{component-id}/default.tsx
examples/react/{component-id}/with-icon.tsx
examples/react/{component-id}/variants.tsx
Snippet ํ์ผ (์๋ ๊ฒฝ์ฐ):
docs/registry/ui/{component-id}.tsx
์๋ ์ค์น ์์ (Snippet์ด ์๋ ๊ฒฝ์ฐ):
examples/react/{component-id}/manual-installation.tsx
Special MDX Components
React ๋ฌธ์์์ ์ฌ์ฉ ๊ฐ๋ฅํ ํน์ ์ปดํฌ๋ํธ๋ค:
1. ComponentExample
์ปดํฌ๋ํธ ์์๋ฅผ ํ์ํ๋ ์ปจํ ์ด๋์ ๋๋ค.
<ComponentExample name="react/component-id/example-name">
```json doc-gen:file
{
"file": "examples/react/component-id/example-name.tsx",
"codeblock": true
}
name: ์์์ ๊ณ ์ ID (react/{component-id}/{example-name})doc-gen:file: ์ค์ ํ์ผ ๋ด์ฉ์ ๊ฐ์ ธ์ ์ฝ๋๋ธ๋ก์ผ๋ก ๋ ๋๋งcodeblock: true: ์ฝ๋๋ธ๋ก์ผ๋ก ํ์
2. ManualInstallation
์๋ ์ค์น ๋ฐฉ๋ฒ์ ์๋ดํ๋ ์ปดํฌ๋ํธ์ ๋๋ค.
<ManualInstallation name="component-id">
```json doc-gen:file
{
"file": "examples/react/component-id/manual-installation.tsx",
"codeblock": true
}
- Snippet ๋ ์ด์ด๊ฐ ์๋ ์ปดํฌ๋ํธ์๋ง ์ฌ์ฉ
- CLI ๋์ ์๋์ผ๋ก ์ค์นํ๋ ๋ฐฉ๋ฒ ์ ๊ณต
3. package-install
ํจํค์ง ์ค์น ๋ช ๋ น์ด๋ฅผ ํ์ํ๋ ์ฝ๋๋ธ๋ก์ ๋๋ค.
```package-install
npx @seed-design/cli@latest add ui:component-id
- Snippet ๋ ์ด์ด ์ค์น ๋ช
๋ น์ด์ ์ฌ์ฉ
- ์๋์ผ๋ก ํจํค์ง ๋งค๋์ ๋ณ ๋ช
๋ น์ด ๋ณํ (npm, yarn, pnpm, bun)
## Checklist
๋ฌธ์ ์์ฑ ํ ๋ค์ ์ฌํญ์ ํ์ธํฉ๋๋ค:
- [ ] Frontmatter์ title๊ณผ description์ด ์ ํํ๊ฐ?
- [ ] Snippet ๋ ์ด์ด ์กด์ฌ ์ฌ๋ถ์ ๋ฐ๋ผ Installation/Usage ์น์
์ด ์ฌ๋ฐ๋ฅธ๊ฐ?
- [ ] Import ๊ฒฝ๋ก๊ฐ ์ ํํ๊ฐ? (`@/components/ui/*` vs `@seed-design/react`)
- [ ] ComponentExample์ name ์์ฑ์ด `react/{component-id}/{example-name}` ํจํด์ธ๊ฐ?
- [ ] ๋ชจ๋ ์์ ํ์ผ ๊ฒฝ๋ก๊ฐ ์ค์ ํ์ผ๊ณผ ์ผ์นํ๋๊ฐ?
- [ ] Composite ์ปดํฌ๋ํธ์ ๋ชจ๋ sub-component๊ฐ ๋ฌธ์ํ๋์๋๊ฐ?
- [ ] Props ํ
์ด๋ธ์ ํ์
์ด ์ ํํ๊ฒ ํ๊ธฐ๋์๋๊ฐ?
- [ ] ํ๊ตญ์ด ์ค๋ช
์ด ๋ช
ํํ๊ณ ์ผ๊ด๋๊ฐ?
## Reference Files
**์ฐธ์กฐํ ๊ธฐ์กด ๋ฌธ์**:
- Composite ์์: `/docs/content/react/components/alert-dialog.mdx`
- Simple ์์: `/docs/content/react/components/badge.mdx`
- Snippet ๋ ์ด์ด: `/docs/registry/ui/*.tsx`
- ์์ ์ฝ๋: `/examples/react/*/*.tsx`
## Tips
1. **Snippet vs Direct Import**:
- Snippet์ด ์์ผ๋ฉด ์ฌ์ฉ์๊ฐ ์ปค์คํฐ๋ง์ด์ง ๊ฐ๋ฅ
- Snippet์ด ์์ผ๋ฉด `@seed-design/react`์์ ์ง์ ์ฌ์ฉ
- Installation ์น์
์ Snippet์ด ์์ ๋๋ง ์์ฑ
2. **Example ํ์ผ ์์ฑ**:
- ์์ ํ์ผ์ ์ค์ ๋ก ๋์ํ๋ ์ฝ๋์ฌ์ผ ํจ
- TypeScript๋ก ์์ฑํ๊ณ ํ์
์์ ์ฑ ํ๋ณด
- ํ์ํ import๋ฅผ ๋ชจ๋ ํฌํจ
3. **MDX ์ปดํฌ๋ํธ ํ์ฉ**:
- `<ComponentExample>`, `<ManualInstallation>`์ ์๋ import๋จ
- Import ๋ฌธ ๋ถํ์
4. **ํ๊ตญ์ด ์์ฑ**:
- Description, Props ์ค๋ช
์ ํ๊ตญ์ด๋ก
- ์ฝ๋ ์์์ ๊ธฐ์ ์ฉ์ด๋ ์์ด ์ ์ง
5. **๋ฌธ์ ์
๋ฐ์ดํธ**:
- ๊ธฐ์กด ๋ฌธ์๋ฅผ ๋จผ์ ์ฝ์ด์ ๋ด์ฉ ๋ณด์กด
- ๋ณ๊ฒฝ์ด ํ์ํ ๋ถ๋ถ๋ง ์์
- ์์ ์ถ๊ฐ ์ Examples ์น์
๋ง ์
๋ฐ์ดํธ
Repository
