Generates React components that follow the project's conventions. Use when the user requests creating a component, adding a new React component, or generating component files.
项目使用以下约定:
确认组件信息
创建文件结构
src/components/{ComponentName}/
├── index.tsx
├── {ComponentName}.module.css
└── {ComponentName}.test.tsx
生成组件文件
index.tsx 模板:
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>
);
};
{ComponentName}.module.css 模板:
.container {
/* 组件样式 */
}
{ComponentName}.test.tsx 模板:
import { render, screen } from '@testing-library/react';
import { {ComponentName} } from './index';
describe('{ComponentName}', () => {
it('renders correctly', () => {
render(<{ComponentName} />);
// 添加断言
});
});
生成后自动运行:
npm run type-checknpm run lintnpm test -- {ComponentName}如有错误,显示错误信息并提供修复建议。
npx skills add einverne/react-component-generator下载完整 Skill 目录,包含 SKILL.md 及所有相关文件
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer