From godmode
Guides React app architecture covering components, state management (Zustand, TanStack Query), performance optimization, Server Components, and testing (RTL, Playwright). Useful for React performance issues, hooks, re-renders.
How this skill is triggered — by the user, by Claude, or both
Slash command
/godmode:reactThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
- `/godmode:react`, "React app", "component architecture"
/godmode:react, "React app", "component architecture"grep -E "react|zustand|jotai|redux|react-query" \
package.json 2>/dev/null
grep -r "use client\|use server" \
--include="*.tsx" -l 2>/dev/null | head -10
Framework: Next.js | Remix | Vite | CRA
React: 18 | 19+ | Rendering: SPA | SSR | SSG
Pain points: re-renders, prop drilling, bundle size
Composition (default): small focused components, slot pattern for layouts. Custom Hooks: extract stateful logic (useDebounce, useMediaQuery, useLocalStorage). Render Props: when parent controls rendering.
Hierarchy: Pages -> Features -> UI Components -> Atoms. Rules: one thing per component, small props, composition over configuration, feature folders over tech folders.
| Type | Solution |
|---|---|
| Server/async (API) | TanStack Query / SWR |
| URL (params) | useSearchParams / nuqs |
| Form | React Hook Form + Zod |
| Local UI | useState / useReducer |
| Shared UI | Zustand or Jotai |
| Complex global | Zustand or Redux Toolkit |
IF bundle >500KB: enable code splitting. IF re-renders >3 per interaction: add memoization.
GOLDEN RULE: measure before optimizing. Use React DevTools Profiler.
RSC: server-only, zero client JS, direct DB access. useTransition: non-urgent state updates. useDeferredValue: defer expensive re-renders.
Pyramid: E2E (Playwright) -> Integration (RTL) -> Unit. Query priority: getByRole > getByLabelText > getByText
getByTestId (last resort). Rules: test behavior not implementation. userEvent > fireEvent. MSW for API mocking.
[ ] Composition over prop drilling
[ ] Custom hooks for reusable logic
[ ] State management per category
[ ] memo/useMemo with evidence only
[ ] Code splitting at route level
[ ] Error boundaries
[ ] Tests with accessible queries
[ ] TypeScript strict
any. Use unknown + type guard.tsc --noEmit after changes.Append .godmode/react-results.tsv:
timestamp action components hooks test_status build_status notes
KEEP if: tsc passes AND tests pass AND no new
ESLint warnings AND bundle size stable.
DISCARD if: type errors OR test failures OR hooks
rules violated OR bundle regressed.
STOP when ALL of:
- tsc --noEmit exits 0
- All tests pass
- No ESLint react-hooks warnings
- Bundle within budget
On failure: git reset --hard HEAD~1. Never pause.
| Failure | Action |
|---|---|
| Infinite re-render | Check useEffect deps, stabilize refs |
| Hydration mismatch | useEffect for client-only code |
| Bundle too large | Analyze, lazy-load routes |
| State on unmounted | Cleanup in useEffect, AbortController |
npx claudepluginhub arbazkhan971/godmodeReact component discipline: pure components, minimal state, effects as escape hatches. Invoke whenever task involves any interaction with React code — writing, reviewing, refactoring, debugging, or understanding JSX, hooks, component architecture, state management, or performance optimization.
Enforces scalable React architecture with feature-based structure, type-safe state management (React Query), API layers, performance patterns, and testing when building components/pages/apps.
Audits React and Next.js code for six critical pitfalls: nested components, index keys, derived state in effects, unsafe fetching, unmemoized contexts, and more.