一键导入
react-component-design
When building or refactoring React UI components to ensure reusability and maintainability.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
When building or refactoring React UI components to ensure reusability and maintainability.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
When improving read performance and reducing database load.
When designing loosely coupled systems that react to state changes asynchronously.
When setting up telemetry, debugging distributed systems, or standardizing application output.
When creating or extending an HTTP API for client consumption.
When addressing slow application endpoints, high database CPU usage, or standardizing data access patterns.
When designing how a system recovers from and reports failures.
| name | react-component-design |
| description | When building or refactoring React UI components to ensure reusability and maintainability. |
| version | 2.0.0 |
| category | frontend |
| tags | ["frontend","react","ui","components"] |
| skill_type | workflow |
| author | skiLLM |
| license | MIT |
| compatible_agents | ["claude-code","cursor","copilot","codex"] |
| estimated_context_tokens | 1800 |
| dangerous | false |
| requires_review | false |
| security_level | safe |
| dependencies | [] |
| triggers | ["component","jsx","tsx","ui","reusable"] |
| permissions | {"filesystem":{"read":true,"write":true},"network":{"outbound":false},"shell":{"execute":false}} |
| input_requirements | ["existing React codebase","TypeScript project setup"] |
| output_contract | ["pure functional components","strict TypeScript interfaces","no prop drilling beyond 2 levels","CSS classes only"] |
| failure_conditions | ["component exceeds 200 lines","props interface not exported","side effects in render"] |
| last_updated | "2026-05-15T00:00:00.000Z" |
React components MUST be pure, composable, and reusable abstractions. This skill enforces TypeScript-first design, separation of concerns, and deterministic rendering to ensure maintainable, testable UI code that works reliably across different contexts.
className prop. NEVER use inline style={{...}}.[ComponentName]Propsstyle={{...}})className prop for customizationstyle={{...}} objects instead of CSS classesuseState(props.val)[ComponentName]Propsstyle={{...}} objects anywhereclassName prop for customizationany).tsx file (+ additional files if refactored)dangerouslySetInnerHTML (violates DOM Security Hardening)❌ Anti-pattern (Prop drilling, inline styles, state mirroring):
// Bad: mirrors props, inline styles, multiple responsibilities
export const Modal = ({ title, onClose, userId, userName, isOpen }) => {
const [name, setName] = useState(userName); // ANTI-PATTERN: state from props
return (
<div style={{ position: 'fixed', top: 0 }} onClick={onClose}>
<h1>{title}</h1>
<input value={name} onChange={(e) => setName(e.target.value)} />
<UserProfile userId={userId} name={name} /> {/* 2 levels */}
</div>
);
};
export const UserProfile = ({ userId, name }) => {
return <UserBio userId={userId} name={name} />; {/* 3 levels: VIOLATION */}
};
✅ Correct pattern (Pure, CSS classes, no drilling):
interface ModalProps {
title: string;
onClose: () => void;
isOpen: boolean;
children: React.ReactNode;
}
export const Modal = ({ title, onClose, isOpen, children }: ModalProps) => {
if (!isOpen) return null;
return (
<div className="modal-overlay" onClick={onClose}>
<div className="modal-content">
<h1>{title}</h1>
{children}
</div>
</div>
);
};
interface UserProfileProps {
userId: string;
}
export const UserProfile = ({ userId }: UserProfileProps) => {
const user = useUser(userId); // Use hook, not props
return (
<div>
<h2>{user?.name}</h2>
<p>{user?.bio}</p>
</div>
);
};