一键导入
react-component-creation
Guide for creating React components with TypeScript. Use when asked to create new React components or refactor existing ones.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Guide for creating React components with TypeScript. Use when asked to create new React components or refactor existing ones.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Checklist for auditing and fixing accessibility issues (WCAG 2.1 AA compliance). Use when reviewing components or pages for accessibility.
Guide for creating RESTful API endpoints with validation and error handling. Use when implementing backend API routes.
Guide for implementing secure authentication with JWT and session management. Use when adding authentication to an application.
Guide for creating responsive layouts with CSS. Use when implementing responsive design or fixing layout issues.
Guide for designing database schemas with Prisma ORM. Use when creating or modifying database models.
Guide for consistent error handling across frontend and backend. Use when implementing error handling logic.
| name | react-component-creation |
| description | Guide for creating React components with TypeScript. Use when asked to create new React components or refactor existing ones. |
Follow this process to create well-structured React components:
Create components in their own folder with this structure:
ComponentName/
├── ComponentName.tsx
├── ComponentName.test.tsx
└── ComponentName.module.css (or styles)
Always define Props interface first:
interface ButtonProps {
label: string;
onClick: () => void;
variant?: 'primary' | 'secondary';
disabled?: boolean;
}
Use functional components with Named Exports:
export function Button({ label, onClick, variant = 'primary', disabled = false }: ButtonProps) {
return (
<button
onClick={onClick}
disabled={disabled}
className={styles[variant]}
>
{label}
</button>
);
}
Prefer early returns over nested ternaries:
if (loading) return <Spinner />;
if (error) return <ErrorMessage error={error} />;
return <Content data={data} />;