workflows/workflows/agent-environment-setup/platforms/antigravity/skills/react/SKILL.md
Use when building user interfaces with React 19+. Invoke for Server Components, the use() hook, Suspense, Actions, concurrent features, ref callbacks, and component architecture.
npx skillsauth add cubetiq/cubis-foundry 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.
Senior frontend engineer specializing in React 19+ patterns including Server Components, the use() hook, Actions, Suspense for data fetching, concurrent rendering, and scalable component architecture.
Provide authoritative guidance on building production React 19+ applications. This skill covers the Server Components model, the use() hook for reading promises and context, Actions for form handling and mutations, useOptimistic for instant UI feedback, useActionState for form state management, Suspense-driven data fetching, concurrent features like transitions, and modern component architecture patterns.
use() hookuseActionState, and useOptimisticref as a regular prop (no forwardRef)Identify the rendering environment (client-only SPA, framework with RSC like Next.js, or hybrid) before writing components, because React 19 Server Components require a framework integration and using RSC APIs in a client-only setup causes import errors.
Default components to Server Components when using a framework that supports them, and only add 'use client' when the component needs hooks, event handlers, or browser APIs, because Server Components run on the server with zero client JavaScript and dramatically reduce bundle size.
Use the use() hook to read promises and context instead of useEffect + useState for data fetching or useContext for context consumption, because use() integrates with Suspense for automatic loading states, can be called conditionally, and reduces boilerplate.
Wrap promise-consuming components in <Suspense> with a fallback to define loading boundaries, because use() suspends rendering until the promise resolves and without a Suspense boundary the entire tree would suspend to the nearest parent boundary.
Handle form submissions with Actions by passing an async function to the <form action> prop or using useActionState, because Actions provide built-in pending states, progressive enhancement, and automatic form reset without manual event handling.
Use useActionState for forms that display results or errors, because it encapsulates the action function, pending state, and previous result in a single hook call that works with both client and server actions.
Apply useOptimistic for instant feedback on mutations, passing the current state and an update function, because optimistic updates make the UI feel responsive while the server processes the actual mutation, and React automatically reverts on failure.
Use useTransition to mark non-urgent state updates that should not block user input, because transitions allow React to interrupt expensive re-renders to keep the UI responsive and show pending indicators without blocking interactions.
Pass ref as a regular prop instead of using forwardRef, because React 19 supports ref as a standard prop on function components, eliminating the forwardRef wrapper and simplifying component APIs.
Use <Suspense> boundaries strategically to create independent loading zones, because each boundary defines a unit of streaming and a separate hydration island -- too few boundaries block the whole page, too many cause visual thrashing.
Colocate related state and lift shared state to the nearest common ancestor or a context provider, because scattered state creates synchronization bugs and prop-drilling through many levels makes components brittle and hard to refactor.
Use React.memo and useMemo/useCallback only after measuring with React DevTools Profiler, because premature memoization adds complexity and memory overhead and React 19's compiler (React Compiler) may handle it automatically.
Define Error Boundaries as class components (or use a library like react-error-boundary) to catch rendering errors, because there is no hook equivalent for componentDidCatch and unhandled errors in a component tree crash the entire application.
Type all component props with TypeScript interfaces or type aliases and avoid any, because explicit prop types serve as documentation, catch integration errors at compile time, and enable IDE autocompletion across the codebase.
Write tests with Vitest and React Testing Library querying by role, label, and text rather than implementation details, because user-centric queries produce resilient tests that survive refactors and encourage accessible markup.
Keep custom hooks focused on a single concern and prefix them with use, because single-purpose hooks compose cleanly, are independently testable, and their naming convention enables React to enforce the Rules of Hooks.
../web-testing/SKILL.md for live browser QA, real-page evidence, accessibility snapshots, and Playwright-MCP-driven validation.When delivering React 19+ code:
.tsx files with explicit 'use client' directive only when requireduse-*.ts or hooks/ directory with focused responsibilitiesactions.ts with 'use server' or client-side action functions.test.tsx files co-located with componentsLoad detailed guidance based on context:
| Topic | Reference | Load When |
|-------|-----------|-----------|
| Server Components | references/server-components.md | RSC model, client/server boundaries, serialization rules |
| use() Hook | references/use-hook.md | Reading promises, context, conditional calls, Suspense integration |
| Actions & Forms | references/actions-forms.md | useActionState, useOptimistic, form action prop, progressive enhancement |
| Concurrent Features | references/concurrent-features.md | useTransition, useDeferredValue, Suspense streaming, selective hydration |
| Component Patterns | references/component-patterns.md | Composition, ref forwarding, Error Boundaries, performance optimization |
| Testing | references/testing.md | React Testing Library patterns, hook tests, action/server-component test seams, or browser QA handoff rules |
tools
Use when investigating latest vendor behavior, comparing tools or platforms, verifying claims beyond the repo, or gathering external evidence before implementation.
documentation
Use when designing database schemas, normalization strategies, indexing plans, query optimization, and migration workflows for relational, document, or hybrid data stores.
development
Use when writing, reviewing, or refactoring modern C#/.NET code, including minimal APIs, records, async streams, pattern matching, DI lifetimes, and memory-efficient performance tuning.
development
Use when conducting code reviews, building review checklists, calibrating review depth, providing structured feedback, or establishing team review practices. Covers review methodology, feedback patterns, automated checks, and batch review strategies.