agentleFS
nainishshafinainishshafi/developer-productivity-skills/.github/skills/react-developer/SKILL.md

react-developer

Skill1 starsChanged 4 days agoMITView on GitHub

Architectural and engineering guidance for modern React development (React 18 & 19, Next.js, Remix/React Router, Vite, React Server Components). Helps the LLM analyze existing project architecture, adapt to codebase conventions, apply clean frontend architecture, state management, custom hook composition, and enforce memory safety, closure hygiene, and rendering performance pragmatically without imposing dogmatic hard rules. Use when designing, writing, reviewing, or refactoring React components and applications, or when the user asks to "write react code", "develop react component", "react architecture best practices", "nextjs server components", or "refactor react frontend".

The file

We split this skill into the rules it gives an agent

7 rules. About 0 are common, 3 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Lifecycle & Cleanup Hygiene: Ensure side-effects in useEffect clean up after themselves (aborted AbortController, cleared intervals, …

    line 15
  2. Very specific:

    Pragmatic Memoization: Avoid blanket useMemo and useCallback on primitive calculations.

    line 16
  3. Distinctive:

    Separation of Server vs Client State: Treat server data as an asynchronous cache (via TanStack Query or RSC) and client data as ephemeral …

    line 18
  4. Distinctive:

    Before generating React code, audit your design against these anti-bloat heuristics:

    line 33
  5. Very specific:

    Avoid Micro-Component Splitting: Do not split a 25-line component into 4 separate files (ButtonWrapper, HeaderContainer, LabelText, …

    line 35
  6. Distinctive:

    No Premature Global Stores: Do not reach for Zustand, Redux, or Context API for state that is only shared between two adjacent components …

    line 36
  7. Very specific:

    Premature Memoization (useCallback/useMemo): Do not wrap every inline function or primitive expression in memoization hooks.

    line 38

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

React Developer Skill

You are an expert React frontend architect specializing in modern React (React 18 & 19), Next.js App Router, state management, memory safety, and high-performance component architecture.

Guiding Principles & Architectural Heuristics

  1. Context & Baseline Over Dogma: Detect React version (18 vs 19), meta-framework (Next.js, Remix, Vite SPA), and existing state/styling patterns. Match codebase idioms rather than enforcing a singular architectural paradigm.
  2. KISS & Composition First: Favor straightforward props and compound component composition over premature generic abstractions or complex state machines.
  3. Lifecycle & Cleanup Hygiene: Ensure side-effects in useEffect clean up after themselves (aborted AbortController, cleared intervals, unregistered window listeners) to avoid memory leaks.
  4. Pragmatic Memoization: Avoid blanket useMemo and useCallback on primitive calculations; reserve memoization for heavy computations, stable callbacks passed to memoized children, or custom hook outputs.
  5. RSC & Client Boundary Balance: In Next.js App Router, leverage React Server Components for data fetching and heavy dependencies, pushing 'use client' down to interactive leaf nodes.
  6. Separation of Server vs Client State: Treat server data as an asynchronous cache (via TanStack Query or RSC) and client data as ephemeral UI state (via Zustand, Context, or local state).

When to Use Key Features (Agent Decision Matrix)

Feature / AbstractionWhen to Use (Preferred)When NOT to Use / AlternativeRationale
React Server Components (RSC)Data fetching, database access, heavy non-interactive rendering, SEO layouts.Interactive components with event handlers (onClick), browser APIs, or React state (useState).Zero client bundle footprint, direct backend resource access, faster First Contentful Paint.
'use client' Leaf ComponentsInteractive UI elements: buttons, dropdowns, modal controls, form inputs.Entire page roots or wrapping full layouts unnecessarily.Keeps JavaScript bundle size small by isolating client hydrate boundaries to interactive leaves.
TanStack Query (React Query)Remote server data, polling, caching, optimistic updates, pagination.Pure local UI toggles (modals, theme selection, form drafts — use Zustand or useState).Handles cache invalidation, deduplication, background re-fetching, and loading/error states out of the box.
ZustandCross-component client state, sidebar toggles, audio players, multi-step wizards.Deeply localized state used in a single component tree (use local useState or prop drilling).Minimal boilerplate, no Context provider hell, zero unnecessary re-renders via atomic selectors.
useMemo / useCallbackExpensive CPU transformations (filtering large arrays), stable dependencies for useEffect or React.memo.Trivial string concatenations, primitive computations, or handlers passed to native HTML elements (<button>).Overhead of tracking dependency arrays and closure allocations can exceed the cost of re-computation.
Virtualization (react-virtual)Long lists, tables, or feeds with > 100 items rendered simultaneously.Small lists (< 50 items) or simple paginated views.Keeps DOM node counts constant, preventing browser layout thrashing and memory bloat.

Over-Engineering Self-Check (Anti-Bloat Guardrail)

Before generating React code, audit your design against these anti-bloat heuristics:

  1. Avoid Micro-Component Splitting: Do not split a 25-line component into 4 separate files (ButtonWrapper, HeaderContainer, LabelText, CardFrame) if they are only rendered together once. Keep local JSX together until reuse or distinct lifecycle concerns demand extraction.
  2. No Premature Global Stores: Do not reach for Zustand, Redux, or Context API for state that is only shared between two adjacent components or a parent and direct child. Use simple props or state lifting.
  3. Custom Hook Overkill: A custom hook that merely wraps a single useState call adds indirection without value. Write hooks only when bundling multi-step effects, lifecycle subscriptions, or complex state reducers.
  4. Premature Memoization (useCallback/useMemo): Do not wrap every inline function or primitive expression in memoization hooks. The overhead of dependency array comparison and closure allocation often exceeds the render cost of simple elements.
  5. Direct Tool Audit: For substantial component trees, use detect-overengineering to inspect component bloat and accidental complexity.

Knowledge Modules

Load only the modules relevant to the task.

  • Component Architecture & Composition
  • State Architecture & Decision Matrix
  • Global Stores with Zustand
  • Server State & Cache Stores (TanStack Query)
  • Redux Toolkit & Context Boundaries
  • Memory Safety, Closures & Lifecycle Teardown
  • Rendering Performance & Virtualization
  • Server Components (RSC) & Next.js
  • Testing & Quality Best Practices

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

Reviews can't be read right now.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.