生成符合项目规范的 React 组件。当用户要求创建组件、新建 React 组件或生成组件文件时使用
Scanned 2/12/2026
Install to Claude Code
npx -y skills add einverne/dotfiles --skill react-component-generator --agent claude-codeInstalls into .claude/skills of the current project.
Are you the author of React Component Generator?
Add the live security badge to your README — it updates automatically with every re-scan.
[](https://www.skillsdirectory.com/skills/einverne-react-component-generator)More formats (shields.io, HTML) on the badges page.
---
name: react-component-generator
description: 生成符合项目规范的 React 组件。当用户要求创建组件、新建 React 组件或生成组件文件时使用
---
# React 组件生成器
## 组件规范
项目使用以下约定:
- TypeScript + React
- 函数式组件 + Hooks
- CSS Modules 样式
- 完整的 JSDoc 注释
- 配套的测试文件
## 生成流程
1. 确认组件信息
- 组件名称(PascalCase)
- 组件类型(基础组件、容器组件、页面组件)
- 所需 props
2. 创建文件结构
```
src/components/{ComponentName}/
├── index.tsx
├── {ComponentName}.module.css
└── {ComponentName}.test.tsx
```
3. 生成组件文件
index.tsx 模板:
```typescript
import React from 'react';
import styles from './{ComponentName}.module.css';
interface {ComponentName}Props {
// 定义 props 类型
}
/**
* {组件描述}
* @param props - 组件属性
*/
export const {ComponentName}: React.FC<{ComponentName}Props> = (props) => {
return (
<div className={styles.container}>
{/* 组件内容 */}
</div>
);
};
```
4. 生成样式文件
{ComponentName}.module.css 模板:
```css
.container {
/* 组件样式 */
}
```
5. 生成测试文件
{ComponentName}.test.tsx 模板:
```typescript
import { render, screen } from '@testing-library/react';
import { {ComponentName} } from './index';
describe('{ComponentName}', () => {
it('renders correctly', () => {
render(<{ComponentName} />);
// 添加断言
});
});
```
## 质量检查
生成后自动运行:
1. TypeScript 类型检查:`npm run type-check`
2. ESLint 检查:`npm run lint`
3. 测试:`npm test -- {ComponentName}`
如有错误,显示错误信息并提供修复建议。
Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.
No comments yet. Be the first to comment!
Use this skill when developing or maintaining browser extension code in the `browser/` directory, including Chrome/Firefox/Edge compatibility, content scripts, background scripts, or i18n updates.
SEO optimization with keyword analysis, readability assessment, technical validation, content quality. Use for search rankings, blog posts, content audits, or encountering keyword density, readability scores, meta tags, schema markup errors.
Python backend development expertise for FastAPI, security patterns, database operations, Upstash integrations, and code quality. Use when: (1) Building REST APIs with FastAPI, (2) Implementing JWT/OAuth2 authentication, (3) Setting up SQLAlchemy/async databases, (4) Integrating Redis/Upstash caching, (5) Refactoring AI-generated Python code (deslopification), (6) Designing API patterns, or (7) Optimizing backend performance.
Drive the full internationalization journey for a project — detect the stack, recommend a library, set up the chosen library, wrap existing strings, and optionally connect a translation platform. Use when the user asks to add or configure i18n, internationalization, localization, multi-language support, or translations — including when they explicitly mention LinguiJS, Lingui, next-intl, "wrap strings", "find hardcoded text", "make my app translatable", or "set up translations". Triggers on g...
PTES-aligned adversarial security audit for backend, frontend, and mobile applications. Produces a CVSS-scored Hacker Report with verified PoCs and phased remediation.