npx skills add ...
npx skills add davila7/claude-code-templates --skill react-dev
This skill should be used when building React components with TypeScript, typing hooks, handling events, or when React TypeScript, React 19, Server Components are mentioned. Covers type-safe patterns for React 18-19 including generic components, proper event typing, and routing integration (TanStack Router, React Router).
npx skills add davila7/claude-code-templates --skill react-dev
Type-safe React = compile-time guarantees = confident refactoring.
<when_to_use>
NOT for: non-React TypeScript, vanilla JS React
</when_to_use>
<react_19_changes>
React 19 breaking changes require migration. Key patterns:
ref as prop - forwardRef deprecated:
useActionState - replaces useFormState:
use() - unwraps promises/context:
See react-19-patterns.md for useOptimistic, useTransition, migration checklist.
</react_19_changes>
<component_patterns>
Props - extend native elements:
Children typing:
Discriminated unions for variant props:
</component_patterns>
<event_handlers>
Use specific event types for accurate target typing:
See event-handlers.md for focus, drag, clipboard, touch, wheel events.
</event_handlers>
<hooks_typing>
useState - explicit for unions/null:
useRef - null for DOM, value for mutable:
useReducer - discriminated unions for actions:
Custom hooks - tuple returns with as const:
useContext - null guard pattern:
See hooks.md for useCallback, useMemo, useImperativeHandle, useSyncExternalStore.
</hooks_typing>
<generic_components>
Generic components infer types from props - no manual annotations at call site.
Pattern - keyof T for column keys, render props for custom rendering:
Constrained generics for required properties:
See generic-components.md for Select, List, Modal, FormField patterns.
</generic_components>
<server_components>
React 19 Server Components run on server, can be async.
Async data fetching:
Server Actions - 'use server' for mutations:
Client + Server Action:
use() for promise handoff:
See server-components.md for parallel fetching, streaming, error boundaries.
</server_components>
Both TanStack Router and React Router v7 provide type-safe routing solutions.
TanStack Router - Compile-time type safety with Zod validation:
React Router v7 - Automatic type generation with Framework Mode:
See tanstack-router.md for TanStack patterns and react-router.md for React Router patterns.
ALWAYS:
NEVER: