add-component
새 React 컴포넌트를 생성합니다. shadcn/ui 스타일과 프로젝트 컨벤션을 준수합니다. 사용법: /add-component ComponentName [directory]
When & Why to Use This Skill
This Claude skill automates the creation of React components following shadcn/ui design patterns and specific project conventions. It streamlines frontend development by generating standardized boilerplate code, managing directory structures, and ensuring consistent use of utility classes like 'cn' for styling, which helps maintain a clean and scalable codebase.
Use Cases
- Rapidly scaffolding new UI components with pre-defined props and styling templates to accelerate the development cycle.
- Enforcing project-wide architectural standards by automatically placing components in the correct directories and following PascalCase naming conventions.
- Automating the export management process by updating index.ts files whenever a new component is added to a directory.
- Ensuring design system consistency by generating components that are natively compatible with shadcn/ui and Tailwind CSS utilities.
| name | add-component |
|---|---|
| description | 새 React 컴포넌트를 생성합니다. shadcn/ui 스타일과 프로젝트 컨벤션을 준수합니다. 사용법: /add-component ComponentName [directory] |
Add Component
새 React 컴포넌트를 프로젝트 컨벤션에 맞게 생성합니다.
Instructions
- 사용자로부터 컴포넌트 이름(PascalCase)과 선택적으로 디렉토리를 받습니다
- 기본 디렉토리는
src/components/common/입니다 - 다음 파일을 생성합니다:
src/components/{directory}/{ComponentName}.tsx
- 해당 디렉토리에
index.ts가 있으면 export를 추가합니다
Template
import { cn } from "@/lib/utils";
interface ${ComponentName}Props {
className?: string;
children?: React.ReactNode;
}
export function ${ComponentName}({ className, children }: ${ComponentName}Props) {
return (
<div className={cn("", className)}>
{children}
</div>
);
}
Checklist
- Props 인터페이스 정의
cn()유틸리티 사용- className prop 지원
- named export 사용
Examples
/add-component UserAvatar common
→ src/components/common/UserAvatar.tsx 생성