React (professional)
Skill text is English; answer in the user’s preferred language when rules or the conversation specify it.
Use official React docs for API truth; this skill encodes rendering discipline, effect correctness, accessibility defaults, and SSR/hydration awareness — not framework-specific routing or server cache (see nextjs-pro). Confirm React major, meta-framework (Vite/Next/Remix), and SSR vs SPA when known.
Boundary
react-pro owns React component model (hooks, JSX, composition, web DOM semantics, client-side performance patterns, hydration on the web). nextjs-pro owns Next.js App Router, RSC, fetch caching, middleware, and deployment-shaped React. react-native-pro owns React Native / Expo platform APIs. testing-pro owns test pyramid and CI beyond component examples.
Related skills (this repo)
| Skill |
When to combine |
nextjs-pro |
RSC, "use client", Server Actions, Next data/cache |
react-native-pro |
RN lists, native modules, EAS |
testing-pro |
RTL, Vitest/Jest, Playwright, CI |
typescript-pro |
TSX types, generics, strictness |
security-pro |
XSS, CSP, sanitization policy |
design-system-pro |
Tokens and design consistency |
performance-tuning-pro |
LCP/INP with CDN/API factors |
When to use
- Components, hooks, context, forms, and data-fetching boundaries on the web.
- Effect correctness, memoization scope, list keys, stale closures, Strict Mode surprises.
- Hydration mismatches, concurrent rendering assumptions, Error Boundaries + Suspense.
- Semantic HTML, keyboard flows, modals, responsive and accessible UI.
When not to use
- Next.js-specific routing,
fetch revalidation, middleware — nextjs-pro.
- React Native screens and native build issues —
react-native-pro.
- Pure backend API design —
api-design-pro / nestjs-pro (pair for client consumption).
Required inputs
react + react-dom major (from package.json or user).
- Bundler/framework when SSR, code splitting, or RSC boundaries matter.
Expected output
Follow Suggested response format strictly — system model through residual risks.
Workflow
Apply Karpathy principles throughout: Think Before Coding, Simplicity First, Surgical Changes, Goal-Driven Execution.
- Confirm React version, framework, and SSR/RSC context → verify: [context documented].
- State assumptions about requirements, constraints (Think Before Coding).
- Apply minimum solution first; escalate only when justified (Simplicity First).
- Make surgical changes — only touch code directly related to the request (Surgical Changes).
- Define success criteria; loop until verified (Goal-Driven Execution).
- Respond using Suggested response format; note main risks.
Operating principles
- Think Before Coding — State React version, SSR/RSC context, and framework before proposing any solution. Ask when unknown.
- Simplicity First — Minimum hook or component that solves the problem; no premature abstraction (HOCs, context, portals) unless justified.
- Surgical Changes — Only change the component or hook directly related to the request. No opportunistic refactors of unrelated effects or memoization.
- Goal-Driven Execution — Done = no infinite update loops, no Rules of Hooks violations, no hydration mismatches in the changed subtree.
- Rules of Hooks always — Verify call-count consistency first; hooks called conditionally or in loops are bugs regardless of the apparent behavior.
- Effect as external sync —
useEffect is for synchronizing with external systems; state derivation and event handling are not effects.
- Keys as stable identity — List keys must be stable, unique, and content-derived — never array index for mutable lists.
- Accessibility by default — Every interactive element gets role + keyboard + focus management; a11y is not a post-implementation task.
Rendering and effects system model (summary)
Render phase (pure) → commit phase (DOM mutations) → layout effects → passive effects. Strict Mode double-invokes both to surface side effects in render. Concurrent rendering may suspend and resume; effects only run after commit.
Details: references/react-rendering-and-effects-system-model.md
Failure modes and mitigation (summary)
Infinite update loops, stale closures in effects, hydration mismatches, list identity (index keys), unsafe JSX spread — detection and fixes.
Details: references/failure-modes-detection-mitigation.md
Decision framework and trade-offs (summary)
Derived vs stored state, server vs client state, controlled inputs, transitions, state colocation vs store.
Details: references/decision-framework-and-trade-offs.md
Suggested response format
- Context — React version, framework (Vite/Next/Remix), SSR vs SPA.
- System model — Which render/effect phase applies; concurrent vs legacy mode relevance.
- Root issue — What's broken and why (stale closure, Rules of Hooks violation, hydration mismatch, etc.).
- Solution — Minimum code change; annotate why each hook or pattern is correct.
- Failure modes addressed — What this fix prevents and what it doesn't.
- Residual risks — Edge cases remaining (Strict Mode double-fire, RSC boundary, memoization trap).
Resources in this skill
| Topic |
File |
| Rendering and effects system model |
references/react-rendering-and-effects-system-model.md |
| Components and JSX patterns |
references/components-and-jsx.md |
| Failure modes and mitigation |
references/failure-modes-detection-mitigation.md |
| Decision framework and trade-offs |
references/decision-framework-and-trade-offs.md |
| Decision tree |
references/decision-tree.md |
| Anti-patterns |
references/anti-patterns.md |
| UI/UX design integration |
references/ui-ux-design.md |
| Tips and tricks |
references/tips-and-tricks.md |
| Edge cases |
references/edge-cases.md |
| Quality guardrails |
references/quality-validation-and-guardrails.md |
| Integration map |
references/integration-map.md |
| Version notes |
references/versions.md |
Quick example
Input: "My useEffect runs twice in development."
- React Strict Mode intentionally double-invokes effects to surface missing cleanup. This is expected in dev, not a bug.
- Fix: Add cleanup function if the effect has side effects; verify the behavior is idempotent.
- Verify: Effect cleanup correctly cancels subscriptions, timers, or requests.
Input (tricky): "I get a hydration mismatch — client renders different content than server."
- Root cause: Server and client render produce different HTML (Date.now(), Math.random(), window checks, missing
suppressHydrationWarning).
- Fix: Guard browser-only code with
typeof window !== 'undefined' inside useEffect, not in render. Use suppressHydrationWarning only for intentionally dynamic attributes (timestamps, ad slots).
- Verify: No
Warning: Text content did not match in browser console.
Input (cross-skill): "Server Component fetches data but I need client interactivity."
- Boundary: Keep data fetching in the Server Component; pass data as props to a
"use client" child that owns the interactive state.
- Pair
nextjs-pro for RSC/Actions specifics, typescript-pro for typed props across the boundary.
- Verify: RSC payload in Network tab, no unnecessary client bundle increase.
Checklist before calling the skill done
Source: truongnat/skills — distributed by TomeVault.
1---2name: truongnat-skills-react-pro3description: React (professional)4---56# React (professional)78Skill text is **English**; answer in the user’s preferred language when rules or the conversation specify it.910Use official [React](https://react.dev/) docs for API truth; this skill encodes **rendering discipline**, **effect correctness**, **accessibility defaults**, and **SSR/hydration awareness** — not framework-specific routing or server cache (see **`nextjs-pro`**). Confirm **React major**, **meta-framework** (Vite/Next/Remix), and **SSR vs SPA** when known.1112## Boundary1314**`react-pro`** owns **React component model** (hooks, JSX, composition, web DOM semantics, client-side performance patterns, hydration on the web). **`nextjs-pro`** owns **Next.js App Router**, **RSC**, **`fetch` caching**, **middleware**, and **deployment-shaped** React. **`react-native-pro`** owns **React Native / Expo** platform APIs. **`testing-pro`** owns **test pyramid and CI** beyond component examples.1516## Related skills (this repo)1718| Skill | When to combine |19|-------|----------------|20| **`nextjs-pro`** | RSC, `"use client"`, Server Actions, Next data/cache |21| **`react-native-pro`** | RN lists, native modules, EAS |22| **`testing-pro`** | RTL, Vitest/Jest, Playwright, CI |23| **`typescript-pro`** | TSX types, generics, strictness |24| **`security-pro`** | XSS, CSP, sanitization policy |25| **`design-system-pro`** | Tokens and design consistency |26| **`performance-tuning-pro`** | LCP/INP with CDN/API factors |2728## When to use2930- Components, hooks, context, forms, and data-fetching **boundaries** on the web.31- Effect correctness, memoization scope, list keys, stale closures, Strict Mode surprises.32- Hydration mismatches, concurrent rendering assumptions, Error Boundaries + Suspense.33- Semantic HTML, keyboard flows, modals, responsive and accessible UI.3435## When not to use3637- **Next.js-specific** routing, `fetch` revalidation, middleware — **`nextjs-pro`**.38- **React Native** screens and native build issues — **`react-native-pro`**.39- **Pure backend** API design — **`api-design-pro`** / **`nestjs-pro`** (pair for client consumption).4041## Required inputs4243- **`react` + `react-dom` major** (from `package.json` or user).44- **Bundler/framework** when SSR, code splitting, or RSC boundaries matter.4546## Expected output4748Follow **Suggested response format** strictly — system model through residual risks.4950## Workflow5152Apply **Karpathy principles** throughout: Think Before Coding, Simplicity First, Surgical Changes, Goal-Driven Execution.53541. **Confirm** React version, framework, and SSR/RSC context → verify: [context documented].552. **State assumptions** about requirements, constraints (**Think Before Coding**).563. **Apply** minimum solution first; escalate only when justified (**Simplicity First**).574. **Make surgical changes** — only touch code directly related to the request (**Surgical Changes**).585. **Define success criteria**; loop until verified (**Goal-Driven Execution**).596. **Respond** using **Suggested response format**; note main risks.6061### Operating principles62631. **Think Before Coding** — State React version, SSR/RSC context, and framework before proposing any solution. Ask when unknown.642. **Simplicity First** — Minimum hook or component that solves the problem; no premature abstraction (HOCs, context, portals) unless justified.653. **Surgical Changes** — Only change the component or hook directly related to the request. No opportunistic refactors of unrelated effects or memoization.664. **Goal-Driven Execution** — Done = no infinite update loops, no Rules of Hooks violations, no hydration mismatches in the changed subtree.675. **Rules of Hooks always** — Verify call-count consistency first; hooks called conditionally or in loops are bugs regardless of the apparent behavior.686. **Effect as external sync** — `useEffect` is for synchronizing with external systems; state derivation and event handling are not effects.697. **Keys as stable identity** — List keys must be stable, unique, and content-derived — never array index for mutable lists.708. **Accessibility by default** — Every interactive element gets role + keyboard + focus management; a11y is not a post-implementation task.7172### Rendering and effects system model (summary)7374Render phase (pure) → commit phase (DOM mutations) → layout effects → passive effects. Strict Mode double-invokes both to surface side effects in render. Concurrent rendering may suspend and resume; effects only run after commit.7576Details: [references/react-rendering-and-effects-system-model.md](references/react-rendering-and-effects-system-model.md)7778### Failure modes and mitigation (summary)7980Infinite update loops, stale closures in effects, hydration mismatches, list identity (index keys), unsafe JSX spread — detection and fixes.8182Details: [references/failure-modes-detection-mitigation.md](references/failure-modes-detection-mitigation.md)8384### Decision framework and trade-offs (summary)8586Derived vs stored state, server vs client state, controlled inputs, transitions, state colocation vs store.8788Details: [references/decision-framework-and-trade-offs.md](references/decision-framework-and-trade-offs.md)8990## Suggested response format91921. **Context** — React version, framework (Vite/Next/Remix), SSR vs SPA.932. **System model** — Which render/effect phase applies; concurrent vs legacy mode relevance.943. **Root issue** — What's broken and why (stale closure, Rules of Hooks violation, hydration mismatch, etc.).954. **Solution** — Minimum code change; annotate why each hook or pattern is correct.965. **Failure modes addressed** — What this fix prevents and what it doesn't.976. **Residual risks** — Edge cases remaining (Strict Mode double-fire, RSC boundary, memoization trap).9899## Resources in this skill100101| Topic | File |102|-------|------|103| Rendering and effects system model | [references/react-rendering-and-effects-system-model.md](references/react-rendering-and-effects-system-model.md) |104| Components and JSX patterns | [references/components-and-jsx.md](references/components-and-jsx.md) |105| Failure modes and mitigation | [references/failure-modes-detection-mitigation.md](references/failure-modes-detection-mitigation.md) |106| Decision framework and trade-offs | [references/decision-framework-and-trade-offs.md](references/decision-framework-and-trade-offs.md) |107| Decision tree | [references/decision-tree.md](references/decision-tree.md) |108| Anti-patterns | [references/anti-patterns.md](references/anti-patterns.md) |109| UI/UX design integration | [references/ui-ux-design.md](references/ui-ux-design.md) |110| Tips and tricks | [references/tips-and-tricks.md](references/tips-and-tricks.md) |111| Edge cases | [references/edge-cases.md](references/edge-cases.md) |112| Quality guardrails | [references/quality-validation-and-guardrails.md](references/quality-validation-and-guardrails.md) |113| Integration map | [references/integration-map.md](references/integration-map.md) |114| Version notes | [references/versions.md](references/versions.md) |115116## Quick example117118**Input:** "My useEffect runs twice in development."119- React Strict Mode intentionally double-invokes effects to surface missing cleanup. This is expected in dev, not a bug.120- **Fix:** Add cleanup function if the effect has side effects; verify the behavior is idempotent.121- **Verify:** Effect cleanup correctly cancels subscriptions, timers, or requests.122123**Input (tricky):** "I get a hydration mismatch — client renders different content than server."124- Root cause: Server and client render produce different HTML (Date.now(), Math.random(), window checks, missing `suppressHydrationWarning`).125- **Fix:** Guard browser-only code with `typeof window !== 'undefined'` inside `useEffect`, not in render. Use `suppressHydrationWarning` only for intentionally dynamic attributes (timestamps, ad slots).126- **Verify:** No `Warning: Text content did not match` in browser console.127128**Input (cross-skill):** "Server Component fetches data but I need client interactivity."129- **Boundary:** Keep data fetching in the Server Component; pass data as props to a `"use client"` child that owns the interactive state.130- Pair **`nextjs-pro`** for RSC/Actions specifics, **`typescript-pro`** for typed props across the boundary.131- **Verify:** RSC payload in Network tab, no unnecessary client bundle increase.132133## Checklist before calling the skill done134135- [ ] React version and framework confirmed before writing any code (Think Before Coding)136- [ ] Rules of Hooks satisfied — no conditional or loop hook calls (Simplicity First)137- [ ] Only the requested component/hook modified — no unrelated refactors (Surgical Changes)138- [ ] No infinite update loop risk in the changed code (Goal-Driven Execution)139- [ ] Keys are stable and content-derived for any lists140- [ ] Hydration mismatch risk addressed for SSR/RSC code141- [ ] Accessibility preserved (roles, keyboard, focus) for interactive elements142- [ ] Stale closure sources identified and cleaned up in useEffect143144---145> Source: [truongnat/skills](https://github.com/truongnat/skills) — distributed by [TomeVault](https://tomevault.io).146<!-- tomevault:4.0:skill_md:2026-06-16 -->