skills/barissozen/pitfalls-react/SKILL.md
React component patterns, forms, accessibility, and responsive design. Use when building React components, handling forms, or ensuring accessibility. Triggers on: React component, useEffect, form validation, a11y, responsive, Error Boundary.
npx skillsauth add aiskillstore/marketplace pitfalls-reactInstall 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.
Common pitfalls and correct patterns for React development.
Verify loading/error states and data checks.
Ensure Zod schemas and proper error display.
Verify ARIA labels and keyboard navigation.
// ✅ Define helpers before use or as exports
function formatPrice(price: number) { ... }
export default function Component() {
// ✅ Check data exists before accessing
if (!data) return <Loading />;
// ✅ useEffect for side effects only
useEffect(() => {
fetchData();
}, []);
// ✅ data-testid on interactive elements
return <button data-testid="submit-btn">Submit</button>;
}
// ❌ WRONG: Defining function in render
return <button onClick={() => {
function doSomething() { } // Don't define here
doSomething();
}}>
// ✅ Navigation with router, not window
import { Link, useLocation } from 'wouter';
<Link to="/dashboard">Go</Link>
// ❌ window.location.href = '/dashboard'
// ✅ Wrap major components in error boundaries
class ErrorBoundary extends React.Component {
state = { hasError: false, error: null };
static getDerivedStateFromError(error) {
return { hasError: true, error };
}
componentDidCatch(error, info) {
logError({ error, componentStack: info.componentStack });
}
render() {
if (this.state.hasError) {
return <ErrorFallback onRetry={() => this.setState({ hasError: false })} />;
}
return this.props.children;
}
}
// ✅ Graceful degradation
function Dashboard() {
const { data, error, isLoading } = useQuery(...);
if (isLoading) return <Skeleton />;
if (error) return <ErrorCard message="Unable to load" onRetry={refetch} />;
if (!data) return <EmptyState />;
return <DashboardContent data={data} />;
}
// ✅ Zod schemas for all forms
const createStrategySchema = z.object({
name: z.string().min(1, 'Name required').max(100),
type: z.enum(['cross-exchange', 'triangular']),
minProfit: z.number().positive('Must be positive'),
});
// ✅ React Hook Form with Zod
const form = useForm<z.infer<typeof createStrategySchema>>({
resolver: zodResolver(createStrategySchema),
});
// ✅ Show errors inline
{errors.name && <span className="text-red-500">{errors.name.message}</span>}
// ✅ Disable submit while validating/submitting
<button disabled={isSubmitting || !isValid}>Submit</button>
/* ✅ Mobile-first breakpoints */
.container { padding: 1rem; }
@media (min-width: 768px) {
.container { padding: 2rem; }
}
/* ✅ Touch-friendly button sizes (min 44px) */
.btn { min-height: 44px; min-width: 44px; }
/* ✅ Horizontal scroll for data tables on mobile */
.table-container { overflow-x: auto; }
// ✅ Semantic HTML
<nav>...</nav>
<main>...</main>
<button>Click me</button> // Not <div onClick>
// ✅ ARIA labels
<button aria-label="Close dialog">×</button>
// ✅ Keyboard navigation
<button onKeyDown={(e) => e.key === 'Enter' && handleClick()}>
// ✅ Focus indicators
button:focus { outline: 2px solid blue; outline-offset: 2px; }
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.