diff --git a/.agents/skills/deep-review/SKILL.md b/.agents/skills/deep-review/SKILL.md index 22d22b1a15..f133f1b547 100644 --- a/.agents/skills/deep-review/SKILL.md +++ b/.agents/skills/deep-review/SKILL.md @@ -111,8 +111,8 @@ Tier 2 file filters: - **Modernization Reviewer**: one instance per language present in the diff. Filter by extension: - Go: `*.go` — reference `.claude/docs/GO.md` before reviewing. - - TypeScript: `*.ts` `*.tsx` - - React: `*.tsx` `*.jsx` + - TypeScript: `*.ts` `*.tsx`: reference `.agents/skills/deep-review/references/typescript.md` before reviewing. + - React: `*.tsx` `*.jsx`: reference `.agents/skills/deep-review/references/react.md` before reviewing. `.tsx` files match both TypeScript and React filters. Spawn both instances when the diff contains `.tsx` changes — TS covers language-level patterns; React covers component and hooks patterns. Before spawning, verify each instance's filter produces a non-empty diff. Skip instances whose filtered diff is empty. @@ -155,9 +155,11 @@ File scope: {filter from step 2}. Output file: {REVIEW_DIR}/{role-name}.md ``` -For the Modernization Reviewer (Go), add after the methodology line: +For Modernization Reviewer instances, add the language reference after the methodology line: -> Read `.claude/docs/GO.md` as your Go language reference before reviewing. +- **Go:** `Read .claude/docs/GO.md as your Go language reference before reviewing.` +- **TypeScript:** `Read .agents/skills/deep-review/references/typescript.md as your TypeScript language reference before reviewing.` +- **React:** `Read .agents/skills/deep-review/references/react.md as your React language reference before reviewing.` For re-reviews, append to both Tier 1 and Tier 2 prompts: diff --git a/.agents/skills/deep-review/references/react.md b/.agents/skills/deep-review/references/react.md new file mode 100644 index 0000000000..30e32d1994 --- /dev/null +++ b/.agents/skills/deep-review/references/react.md @@ -0,0 +1,305 @@ +# Modern React (18–19.2) + Compiler 1.0 — Reference + +Reference for writing idiomatic React. Covers what changed, what it replaced, and what to reach for. Includes React Compiler patterns — what the compiler handles automatically, what it changes semantically, and how to verify its behavior empirically. Scope: client-side SPA patterns only. Server Components, `use server`, and `use client` directives are framework-specific and omitted. Check the project's React version and compiler config before reaching for newer APIs. + +## How modern React thinks differently + +**Concurrent rendering** (18): React can now pause, interrupt, and resume renders. This is the foundation everything else builds on. Most existing code "just works," but components that produce side effects during render (mutations, subscriptions, network calls in the render body) are unsafe and will misbehave. Concurrent features are opt-in — they only activate when you use a concurrent API like `startTransition` or `useDeferredValue`. + +**Urgent vs. non-urgent updates** (18): The `startTransition` / `useTransition` API introduces a formal split between updates that must feel immediate (typing, clicking) and updates that can be interrupted (filtering a large list, navigating to a new screen). Non-urgent updates yield to urgent ones mid-render. Use this instead of `setTimeout` or manual debounce when you want the UI to stay responsive during expensive re-renders. + +**Actions** (19): Async functions passed to `startTransition` are called "Actions." They automatically manage pending state, error handling, and optimistic updates as a unit. The `useActionState` hook and `