Published: May 10, 2026
Category: Guides
React projects have enormous variation in conventions. Two React codebases might use completely different state management, styling, file structure, and testing approaches. Without a skill, Claude Code defaults to generic React patterns that probably don't match yours.
> Quick Answer: Claude Code's generic React component generation often requires extensive cleanup to match specific project conventions, including export types, state management, styling, testing, and file structure; a custom skill resolves this by enforcing project-specific patterns.
Ask Claude Code to create a component and you'll get something functional but generic:
- Functional components only, never class components
- Named exports from index.ts barrel file
- Props defined as TypeScript interface, not inline type
- Destructure props in function signature
- Use React.FC only when children are accepted
Components follow this structure:
ComponentName/
index.ts (re-export)
ComponentName.tsx (component)
ComponentName.test.tsx (tests)
ComponentName.module.css (styles)
- Local state: useState for simple, useReducer for complex
- Global state: Zustand stores in src/stores/
- Server state: TanStack Query (React Query) for all API calls
- Never use Redux or Context for server-cached data
- Tailwind CSS utility classes
- No inline styles except for dynamic values
- Use cn() utility for conditional classes
- Design tokens from tailwind.config for colors and spacing
- Custom hooks go in src/hooks/
- Name: use[Feature] (e.g., useAuth, useProducts)
- Return typed objects, not arrays
- Handle loading, error, and data states
If you use Next.js, your skill needs to cover:
"use client")A React testing skill defines:
Start with this template and customize for your project:
---
name: react-standards
description: Enforces React component conventions when creating, editing, or reviewing React components and hooks.
React Standards
Components
- Functional components with TypeScript
- Named exports via index.ts barrel
- Props as interface, destructured in signature
- Co-located tests and styles
Styling
- Tailwind CSS, no inline styles
- cn() for conditional classes
State
- useState/useReducer for local
- Zustand for global
- TanStack Query for server state
Testing
- Vitest + React Testing Library
- Test behavior, not implementation
- One test file per component
Drop this in ~/.claude/skills/react-standards/SKILL.md and every React component Claude generates will match your patterns.
Find React and frontend skills at Agensi.