When designing and implementing web interfaces to ensure they are usable by everyone.
中文简介正在准备中。当前显示原文说明。
When building or refactoring React UI components to ensure reusability and maintainability.
中文简介正在准备中。当前显示原文说明。
查看安装方法安装前可以查看交给 AI 代理的指令内容。
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>
);
};
还没有评价。欢迎分享你的使用感受。
无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。
还没有评论。来写第一条吧。
When designing and implementing web interfaces to ensure they are usable by everyone.
中文简介正在准备中。当前显示原文说明。
When creating or extending an HTTP API for client consumption.
中文简介正在准备中。当前显示原文说明。
When improving read performance and reducing database load.
中文简介正在准备中。当前显示原文说明。
When configuring automated build, test, and deployment workflows for a repository.
中文简介正在准备中。当前显示原文说明。
When asynchronously reviewing peer code before merging into the main branch.
中文简介正在准备中。当前显示原文说明。
When addressing slow application endpoints, high database CPU usage, or standardizing data access patterns.
中文简介正在准备中。当前显示原文说明。