Skip to content
Skills Library
Programming · Building & coding

react-craft

/react-craft

React-specific engineering standards — impact-prioritized performance rules (waterfalls, bundle, re-renders), hooks discipline, RSC/server data, TypeScript-with-React, forms, and AI-feature patterns. Loaded on top of frontend-craft when the ticket's stack is React (incl. Next.js; React Native shares much of this). Use when building React UI.

Repository
skills ↗
Licence
MIT
Last repository change
13.07.2026

Assessment and security

90/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content25 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 13.07.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

React-specific engineering standards — impact-prioritized performance rules (waterfalls, bundle, re-renders), hooks discipline, RSC/server data, TypeScript-with-React, forms, and AI-feature patterns. Loaded on top of frontend-craft when the ticket's stack is React (incl. Next.js; React Native shares much of this). Use when building React UI.

Original author description

React-specific engineering standards — impact-prioritized performance rules (waterfalls, bundle, re-renders), hooks discipline, RSC/server data, TypeScript-with-React, forms, and AI-feature patterns. Loaded on top of frontend-craft when the ticket's stack is React (incl. Next.js; React Native shares much of this). Use when building React UI.

How it works

  1. CRITICAL — eliminate waterfalls (2–10× wins)
  2. CRITICAL — bundle size
  3. HIGH — server-side (RSC / Next.js App Router)
  4. MEDIUM — re-render optimization
  5. MEDIUM — rendering & JS
  6. Hooks & effects discipline
  7. State & data
  8. TypeScript with React
  9. Forms & AI features
  10. Checklist additions
Original SKILL.md headings · 98 lines, 728 words
SKILL.md preview
---
name: react-craft
description: React-specific engineering standards — impact-prioritized performance rules (waterfalls, bundle, re-renders), hooks discipline, RSC/server data, TypeScript-with-React, forms, and AI-feature patterns. Loaded on top of frontend-craft when the ticket's stack is React (incl. Next.js; React Native shares much of this). Use when building React UI.
user-invocable: false
---

# React Craft

Framework-specific rules on top of `frontend-craft`, distilled from Vercel's
`react-best-practices`. Match the project's React version, router and data
libraries first. Rules are ordered by **impact** — fix the CRITICAL classes before
the micro-optimizations.

## CRITICAL — eliminate waterfalls (2–10× wins)

- **Parallelize independent async work**: `await Promise.all([a(), b(), c()])`, not
  three sequential `await`s. Start promises early, await late.
- Check cheap sync conditions **before** awaiting; move `await` into the branch
  that actually uses the value.
- Stream with **Suspense** boundaries instead of blocking a whole route on the
  slowest fetch.

## CRITICAL — bundle size

- **No barrel-file imports.** Import the exact path (`lodash/debounce`,
  `@mui/material/Button`), not the package index — barrels can pull thousands of
  modules and add hundreds of ms to cold start (measured: `lucide-react` ~1,583
  modules, `@mui/material` ~2,225). In Next.js add heavy libs to
  `experimental.optimizePackageImports`.
- Dynamic-import heavy/below-the-fold components (`next/dynamic`, `React.lazy`).
- Defer third-party (analytics/logging) until after hydration; preload on
  hover/focus for perceived speed.

## HIGH — server-side (RSC / Next.js App Router)

- Server Components by default; add `"use client"` only where interactivity/hooks
  require it — don't mark whole trees client.
- Dedupe per-request reads with `React.cache()`; cross-request with an LRU cache.
- **Minimize data serialized to client components** — pass only the fields used,
  no whole DB rows. No module-level mutable request state in RSC/SSR.
- Parallelize fetches (restructure so independent data loads together; nested
  per-item fetches go inside `Promise.all`). Non-blocking work via `after()`.
- Authenticate server actions exactly like API routes; never trust the client.

## MEDIUM — re-render optimization

- **Derive during render; don't mirror props/state into an effect + `setState`.**
- Don't subscribe to state you only read inside a callback (use a ref); subscribe
  to a derived boolean, not the raw fast-changing value.
- Functional `setState` (`setX(c => ...)`) for stable callbacks with empty deps.
- Lazy state init: `useState(() => expensiveParse())` — the initializer runs once.
- **Never define a component inside another component** (new type every render →
  full remount). Hoist static JSX and non-primitive default props out.
- `React.memo`/`useMemo`/`useCallback` only where the identity actually feeds a
  memoized child or an effect dep — don't memo simple primitives.
- `startTransition` / `useDeferredValue` to keep input responsive during expensive
  renders; stable, meaningful list `key`s (never index for reorderable lists).

## MEDIUM — rendering & JS

- Conditional render with a ternary, not `&&`: `{count > 0 ? <Badge/> : null}` —
  `{count && ...}` renders a literal `0`.
- `content-visibility` CSS for long lists; animate a wrapper `div`, not the SVG.
- `Map`/`Set` for repeated lookups (O(1)); single-pass `flatMap`/combined loops;
  hoist `RegExp` out of loops; `toSorted()` for immutable sorts.

## Hooks & effects discipline

- Rules of hooks are absolute (top level only). `useEffect` is for **synchronizing
  with external systems**, not deriving state. Every subscribing/timing effect
  returns cleanup; list all deps honestly (fix the design, don't silence the lint).
- Put interaction logic in event handlers, not effects. `useRef` for transient
  values that must not re-render.

## State & data

- Local first; global store (project's choice) only for truly global state.
- **Server state ≠ UI state**: use the project's data layer (TanStack Query /
  SWR / RTK Query) with dedup, caching, loading/error — not raw `useEffect`+`fetch`.
- Controlled inputs, one source of truth per field.

## TypeScript with React

- No `any`; type all props and API responses. Discriminated unions for
  variant/state; branded types for IDs (`UserId` ≠ `PostId`); `Pick`/`Omit`/
  `Partial` to keep types DRY. **Validate external input at the boundary with Zod**
  (or the project's validator) — types don't exist at runtime.

## Forms & AI features

- Forms: React Hook Form (or the project's lib) + schema validation; server
  actions for submission where the app uses them; readable errors, no double-submit.
- AI features: use the **Vercel AI SDK** (`useChat`, streaming, tool calls) rather
  than hand-rolling stream parsing, when the project builds LLM UIs.

## Checklist additions

- [ ] No sequential awaits for independent data; Suspense used for streaming.
- [ ] No barrel imports of heavy libraries; heavy components dynamically imported.
- [ ] No state derived via effect+setState; no component defined inside a component.
- [ ] Server components pass minimal serialized data; server actions authenticated.
- [ ] Server data via a caching layer; list keys stable; `{x > 0 ? … : null}` not `{x && …}`.

Versions

The database has no other skills named react-craft.

Database snapshot: 13.11.2026 · package version 6441f229744c (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100react-best-practices
    React and Next.js performance rules: waterfalls, bundle size, server rendering, re-renders. Use when building or reviewing React components or optimizing a Next.js app.
  • 90vue-craft
    Vue-specific engineering standards — Vue 3 Composition API + <script setup> + TS, reactivity correctness, composables, Pinia, router guards, performance and testing. Loaded on top of frontend-craft when the ticket's stack is Vue (incl. Nuxt). Use when building Vue UI.
  • 100react-patterns
    React + TypeScript component and hook standards. TRIGGER when: creating components, custom hooks, or reviewing React code. SKIP: visual styling and theme tokens (use mui-styling); global store design (use state-management).
  • 95fp-ts-react
    Practical patterns for using fp-ts with React - hooks, state, forms, data fetching. Use when building React apps with functional programming patterns. Works with React 18/19, Next.js 14/15.
  • 100react-frontend
    React, TypeScript, and Next.js patterns for frontend development. Use when building React components, managing state, fetching data, optimizing performance, or working with Next.js App Router. Covers React 18-19, hooks, Server Components, and type-safe patterns.
  • 90nextjs-craft
    Next.js App Router full-stack standards — server/client boundaries, the four caching layers, server-action security, route handlers, rendering/streaming, metadata, middleware limits, and Next-specific testing. Loaded on top of react-craft (and alongside backend-craft for server…

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.