skills/awais68/react-component/SKILL.md
Use when creating UI components in React - functional components, hooks, custom hooks, or component composition patterns. NOT when backend logic, API routes, or non-React frameworks are involved. Triggers: "create component", "build widget", "KPI card", "form", "modal", "custom hook", "useContext", "useState", "useEffect".
npx skillsauth add aiskillstore/marketplace react-componentInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Expert guidance for building React functional components, hooks, and composition patterns. Focuses on TypeScript, performance, accessibility, and modern React best practices.
This skill triggers when users request:
// ✅ GOOD: Functional component with TypeScript
interface StudentKPICardProps {
studentName: string;
attendance: number;
loading?: boolean;
}
export const StudentKPICard = React.memo(({ studentName, attendance, loading = false }: StudentKPICardProps) => {
const [isHovered, setIsHovered] = useState(false);
if (loading) return <LoadingSkeleton />;
return <div>{/* content */}</div>;
});
Requirements:
React.memo for components receiving same props frequentlyReact.forwardRef when ref forwarding is needed// ✅ GOOD: Proper hook usage with cleanup
export const AttendanceMonitor = ({ studentId }: { studentId: string }) => {
const [data, setData] = useState(null);
const [error, setError] = useState<string | null>(null);
useEffect(() => {
let isMounted = true;
const fetchAttendance = async () => {
try {
const result = await api.getAttendance(studentId);
if (isMounted) setData(result);
} catch (err) {
if (isMounted) setError(err.message);
}
};
fetchAttendance();
return () => {
isMounted = false;
};
}, [studentId]);
return /* JSX */;
};
Requirements:
useState: For local component state onlyuseEffect: For side-effects with proper cleanup functionsuseContext: For global state (theme, auth, language)useCallback/useMemo for expensive operations in lists// ✅ GOOD: Custom hook with proper types
interface UseAttendanceResult {
data: AttendanceData | null;
loading: boolean;
error: string | null;
refetch: () => Promise<void>;
}
export const useAttendance = (studentId: string): UseAttendanceResult => {
const [data, setData] = useState<AttendanceData | null>(null);
const [loading, setLoading] = useState(true);
const [error, setError] = useState<string | null>(null);
const fetchAttendance = useCallback(async () => {
setLoading(true);
try {
const result = await api.getAttendance(studentId);
setData(result);
setError(null);
} catch (err) {
setError(err.message);
} finally {
setLoading(false);
}
}, [studentId]);
useEffect(() => {
fetchAttendance();
}, [fetchAttendance]);
return { data, loading, error, refetch: fetchAttendance };
};
Requirements:
use prefix// ✅ GOOD: Composition via children prop
interface CardProps {
title: string;
children: React.ReactNode;
footer?: React.ReactNode;
}
export const Card = ({ title, children, footer }: CardProps) => (
<div className="card">
<h2>{title}</h2>
<div className="card-content">{children}</div>
{footer && <div className="card-footer">{footer}</div>}
</div>
);
// Usage
<Card title="Student Info" footer={<Button>Save</Button>}>
<StudentDetails />
</Card>
// ✅ GOOD: Higher-order component pattern
export const withLoading = <P extends object>(WrappedComponent: React.ComponentType<P>) => {
return (props: P & { loading?: boolean }) => {
const { loading = false, ...rest } = props;
if (loading) return <LoadingSpinner />;
return <WrappedComponent {...(rest as P)} />;
};
};
Requirements:
children prop for flexible contentComponent file (ComponentName.tsx):
Test file (ComponentName.test.tsx):
Storybook file (ComponentName.stories.tsx):
Understand Requirements
Design Props Interface
?Implement Component
Test Component
Create Stories
Before completing any component:
any typesuseCallback/useMemo for expensive operations in listsexport const StudentList = () => {
const { data: students, loading, error } = useStudents();
if (loading) return <LoadingSkeleton count={5} />;
if (error) return <ErrorState message={error} />;
return (
<ul>
{students?.map((student) => (
<StudentItem key={student.id} student={student} />
))}
</ul>
);
};
interface FormValues {
name: string;
email: string;
}
export const StudentForm = () => {
const { register, handleSubmit, formState: { errors } } = useForm<FormValues>();
const onSubmit = async (data: FormValues) => {
await api.createStudent(data);
};
return (
<form onSubmit={handleSubmit(onSubmit)}>
<Input {...register('name', { required: true })} error={errors.name} />
<Input {...register('email', { required: true })} error={errors.email} />
<Button type="submit">Save</Button>
</form>
);
};
development
Apple Human Interface Guidelines for content display components. Use this skill when the user asks about charts component, collection view, image view, web view, color well, image well, activity view, lockup, data visualization, content display, displaying images, rendering web content, color pickers, or presenting collections of items in Apple apps. Also use when the user says how should I display charts, what's the best way to show images, should I use a web view, how do I build a grid of items, what component shows media, or how do I present a share sheet. Cross-references: hig-foundations for color/typography/accessibility, hig-patterns for data visualization patterns, hig-components-layout for structural containers, hig-platforms for platform-specific component behavior.
tools
Automate HelpDesk tasks via Rube MCP (Composio): list tickets, manage views, use canned responses, and configure custom fields. Always search tools first for current schemas.
testing
Expert Haskell engineer specializing in advanced type systems, pure functional design, and high-reliability software. Use PROACTIVELY for type-level programming, concurrency, and architecture guidance.
tools
GraphQL gives clients exactly the data they need - no more, no less. One endpoint, typed schema, introspection. But the flexibility that makes it powerful also makes it dangerous. Without proper controls, clients can craft queries that bring down your server. This skill covers schema design, resolvers, DataLoader for N+1 prevention, federation for microservices, and client integration with Apollo/urql. Key insight: GraphQL is a contract. The schema is the API documentation. Design it carefully.