react-component-generator
React Component Generator
This skill provides templates and best practices for generating high-quality React components using TypeScript, Tailwind CSS, and Zustand for state management.
Purpose
Generate production-ready React components that follow industry best practices and maintain consistency across the codebase. The skill includes pre-built templates for common component patterns and comprehensive best practices documentation.
When to Use This Skill
Use this skill when:
- The user requests creating a new React component
- The user asks for UI elements like forms, buttons, cards, lists, or modals
- The user mentions component generation or scaffolding
- The user needs a component with Zustand state management
- The user wants to follow React best practices
Available Component Templates
The skill provides the following templates in the assets/ directory:
1. BasicComponent.tsx
A simple presentational component template for UI elements without complex state.
When to use:
- Simple UI elements (headers, footers, containers)
- Presentational components that receive data via props
- Reusable layout components
Key features:
- TypeScript interface for props
- JSDoc documentation
- Tailwind CSS styling
- Children support
2. StatefulComponent.tsx
A component with integrated Zustand store for state management.
When to use:
- Components requiring complex local state
- Components with multiple related state values
- Components with state that might be shared across instances
- Components with async operations
Key features:
- Complete Zustand store setup
- State and actions separation
- TypeScript interfaces for store
- Loading state handling
3. FormComponent.tsx
A form component with validation, error handling, and submission logic.
When to use:
- Login/registration forms
- Contact forms
- Data entry forms
- Any form with validation requirements
Key features:
- Built-in validation logic
- Error state management
- Form submission handling
- Accessible form inputs with labels
- Loading state during submission
4. ListComponent.tsx
A reusable list component for displaying collections of items.
When to use:
- Todo lists
- User lists
- Product catalogs
- Any itemized data display
Key features:
- Generic item type support
- Item click handlers
- Delete functionality
- Empty state handling
- Responsive design
5. CardComponent.tsx
A flexible card component for content display.
When to use:
- Product cards
- User profile cards
- Content previews
- Dashboard widgets
Key features:
- Optional image section
- Header and footer sections
- Click handling
- Flexible content area
6. ButtonComponent.tsx
A versatile button component with multiple variants and states.
When to use:
- Any button needs in the application
- Call-to-action buttons
- Form submission buttons
- Action buttons
Key features:
- Multiple variants (primary, secondary, danger, success, outline)
- Multiple sizes (sm, md, lg)
- Loading state with spinner
- Disabled state
- Full-width option
7. ModalComponent.tsx
A modal/dialog component with backdrop and accessibility features.
When to use:
- Confirmation dialogs
- Content detail views
- Settings panels
- Any overlay UI
Key features:
- ESC key handling
- Backdrop click to close
- Body scroll prevention
- Multiple sizes
- Accessible markup
How to Use Templates
When generating a component:
-
Identify the component type - Determine which template best fits the user's requirements.
-
Read the appropriate template - Load the template file from the
assets/directory:Read assets/BasicComponent.tsx -
Customize the template - Replace placeholder names and add specific functionality:
- Replace
ComponentNamewith the actual component name (PascalCase) - Update the interface name from
ComponentNamePropsto match - If using Zustand, update
useComponentNameStoreto match - Modify props to match requirements
- Adjust Tailwind classes for styling
- Add or remove features as needed
- Replace
-
Follow naming conventions - Refer to
references/best-practices.mdfor:- Component naming (PascalCase)
- Props interface naming (ComponentName + "Props")
- Store naming (use + ComponentName + "Store")
- File organization
-
Apply best practices - Consult
references/best-practices.mdfor guidance on:- TypeScript patterns
- Zustand store structure
- Tailwind CSS class organization
- Accessibility requirements
- Performance optimization
- Error handling
Component Naming Guidelines
Apply these naming rules when generating components:
-
Component name: Use PascalCase based on the user's description
- "login form" →
LoginForm - "user profile card" →
UserProfileCard - "data table" →
DataTable
- "login form" →
-
Props interface: ComponentName + "Props"
LoginForm→LoginFormPropsUserProfileCard→UserProfileCardProps
-
Zustand store: "use" + ComponentName + "Store"
LoginForm→useLoginFormStoreDataTable→useDataTableStore
-
File name: Match the component name exactly
LoginForm→LoginForm.tsxUserProfileCard→UserProfileCard.tsx
Best Practices Reference
For detailed guidance, consult references/best-practices.md which covers:
- Component structure and file organization
- TypeScript best practices
- Zustand state management patterns
- Tailwind CSS organization and responsive design
- Component composition patterns
- Event handler naming
- Performance optimization (memoization, lazy loading)
- Accessibility (semantic HTML, ARIA, keyboard navigation)
- Error handling and boundaries
- Testing considerations
Example Workflow
User request: "Create a user login form component"
Steps:
- Identify that this requires a form component
- Read
assets/FormComponent.tsxtemplate - Customize for login use case:
- Rename to
LoginForm - Update
LoginFormPropsinterface - Modify form fields (username/email, password)
- Add appropriate validation
- Update styling with Tailwind classes
- Rename to
- Place in appropriate directory (e.g.,
components/auth/LoginForm.tsx) - Verify accessibility and best practices
User request: "Create a product card with image and price"
Steps:
- Identify that this requires a card component
- Read
assets/CardComponent.tsxtemplate - Customize for product use case:
- Rename to
ProductCard - Update
ProductCardPropsto include price, product details - Adjust image section for product photos
- Add price display in content or footer
- Style with Tailwind for product display
- Rename to
- Place in
components/products/ProductCard.tsx
User request: "Create a todo list with Zustand"
Steps:
- Identify that this requires a stateful list component
- Read both
assets/StatefulComponent.tsxandassets/ListComponent.tsx - Combine patterns:
- Create Zustand store for todo state management
- Use list display pattern for rendering todos
- Add todo-specific actions (add, toggle, delete)
- Integrate form for adding new todos
- Name as
TodoListwithuseTodoListStore - Place in
components/todos/TodoList.tsx
Notes
- Always use TypeScript with proper type definitions
- Follow Tailwind's mobile-first responsive design approach
- Include proper JSDoc comments for better IDE support
- Ensure components are accessible (ARIA labels, keyboard navigation)
- Consider performance (memoization for expensive operations)
- Keep components focused and composable
- Export both named and default exports for flexibility
More from staruhub/claudeskills
geek-skills-a-share-analyst
A股专业分析师助手,提供每日股价分析、选股策略和投资建议。适用于:(1) 获取A股实时行情和历史数据,(2) 技术面分析(K线形态、MACD、KDJ、RSI、布林带等),(3) 基本面分析(财务指标、估值分析),(4) 板块热点追踪,(5) 选股策略筛选,(6) 量化因子分析,(7) 生成每日股市分析报告。当用户询问"帮我分析股票"、"今日选股"、"A股行情分析"、"技术分析"、"基本面分析"、"量化选股"等相关问题时触发。
71geek-skills-product-manager
资深产品经理助手,提供PRD文档创作与评审、产品策略咨询、留存增长分析、竞品研究、功能优先级排序等全方位产品管理支持。适用于创作或评审PRD/MRD/BRD/用户故事等产品文档;诊断产品问题(留存低、转化差、增长瓶颈)并给出可执行策略;进行竞品分析和市场研究;设计功能方案和用户体验优化。当用户提到"PRD"、"需求文档"、"产品规划"、"用户留存"、"功能设计"、"竞品分析"、"产品指标"、"增长策略"、"用户体验优化"、"功能优先级"等产品管理相关话题时,使用此skill。即使用户没有明确说"产品",但在讨论App功能设计、用户增长、商业模式、需求分析等话题时也应触发。
41request-analyzer
Proactively analyze user requests at the start of conversations to determine task type, assess prompt quality, and intelligently recommend which skills to activate. Should activate for ALL user requests to ensure optimal workflow. Evaluates clarity, specificity, and completeness to suggest prompt-optimizer when needed. Identifies UI design tasks for ui-analyzer and component requests for react-component-generator. Acts as intelligent skill coordinator.
40geek-skills-c-drive-cleaner
Windows C盘清理和磁盘空间管理工具。当用户需要清理C盘、释放磁盘空间、查找大文件、分析磁盘占用、删除临时文件、清理缓存、管理Windows系统垃圾文件时使用此skill。适用于以下场景:(1)C盘空间不足需要清理;(2)查找和删除大文件;(3)分析磁盘空间占用;(4)清理系统临时文件和缓存;(5)清理浏览器缓存;(6)清理回收站;(7)清理系统日志;(8)优化Windows磁盘空间。
37geek-skills-gaokao-expert
资深高考命题专家助手,提供专业的命题指导和评审服务。适用于创作高考试题、评审试题质量、分析试卷结构、了解命题趋势等场景。结合文档工具提取解压文件,使用网络搜索了解最新命题趋势,使用分析工具评估题目质量和试卷结构。涵盖"一核四层四翼"评价体系、2025年命题趋势、题型规范、评分标准、命题流程等多个维度,符合高考命题最佳实践。
36geek-skills-mineru-pdf-parser
PDF解析工具,将复杂PDF文档转换为LLM友好的Markdown/JSON格式。适用于:(1) 将PDF转换为Markdown或JSON格式,(2) 提取PDF中的文本、表格、公式、图像,(3) 处理学术论文、技术文档、商业报告的PDF解析,(4) 为RAG应用准备高质量文档数据,(5) 批量处理PDF文件。触发关键词包括:"PDF解析"、"PDF转Markdown"、"PDF转JSON"、"提取PDF表格"、"提取PDF公式"、"MinerU"、"文档解析"、"PDF extraction"、"convert PDF"、"parse PDF"等。
34