Advanced React 19 useTransition/useOptimistic

VerifiedCaution

Skill for using React 19's useTransition and useOptimistic in server actions, following a strict frontend doctrine with Next.js and Playwright.

Sby Skills Guide Bot
DevelopmentAdvanced
109/1/2026
Claude Code
#react-19#use-transition#use-optimistic#nextjs#server-actions

Recommended for

Our review

This skill guides advanced implementation of React 19 useTransition and useOptimistic for server action form state in a Next.js frontend within a specific monorepo, enforcing strict test and evidence doctrine.

Strengths

  • Precise activation triggers to identify the need.
  • Structured workflow (lint, typecheck, build, tests, E2E, deploy).
  • Requires reproducible benchmarks and comparison with public state of the art.
  • Clear abort rules (red CI, schema drift, leaked secrets) to prevent regressions.

Limitations

  • Tightly coupled to the hefarica/arbitragex-v2 monorepo, reducing portability.
  • Heavy doctrine that may be overkill for simple projects outside that context.
  • Requires deep understanding of React 19 and the Next.js/Playwright ecosystem.
When to use it

When working on server action form state in the specified monorepo and needing to implement optimistic states or transitions without blocking the UI.

When not to use it

For generic React projects without server actions, or when a simpler approach (useState, plain forms) is sufficient, or if the monorepo is not accessible.

Security analysis

Caution
Quality score78/100

The skill uses legitimate development tools and commands for testing, CI, and repository checks. It does not instruct destructive or exfiltrating actions, but it does involve shell execution and network interactions, so caution is warranted.

Findings
  • Instructs execution of shell commands (pnpm playwright test, gh pr checks, cargo nextest) for testing and CI interactions.
  • References repo-specific ABORT rules that may involve rotating secrets if leaked, but does not itself instruct exfiltration.

Examples

Set up useOptimistic for a server action form
Help me implement useOptimistic in the frontend/app directory for a server action form that updates a balance, following G005 doctrine and ensuring data consistency with the remote source.
Apply useTransition for pending UI
How should I apply useTransition to show a pending state during a server action submission in our Next.js frontend, respecting the G005 workflow and Playwright test requirements?
Validate G005 implementation against abort rules
Review my G005 useTransition/useOptimistic implementation in frontend/components for compliance with the monorepo doctrine, especially the ABORT conditions around CI, schema drift, and E2E coverage.

name: arbx-g-g005-advanced-react-19-usetransitionuseoptimistic description: "Post-Doc skill alineada al monorepo hefarica/arbitragex-v2 (Frontend Doctrinal (Next.js + Playwright)). Se activa cuando: server actions form state. Doctrina OMEGA Zero-Mocks · Fail-Closed · El Remoto Manda."

G005 — Advanced React 19 useTransition/useOptimistic

Dominio: Frontend Doctrinal (Next.js + Playwright) Nivel: Post-Doc Trigger: server actions form state Repos de referencia: vercel/next.js · facebook/react · microsoft/playwright · TanStack/query · shadcn-ui/ui · radix-ui/primitives · wevm/viem · wagmi-dev/wagmi Archivos del repo: frontend/app/* · frontend/components/* · frontend/tests/e2e/* · packages/schemas/*

Quick Start

ARBX_BUILD_FOR_LOCAL_E2E=1 ARBX_ASSUME_NO_RPC=1 pnpm playwright test --reporter=list,html

Core Workflow

  1. Cargar contexto del repo hefarica/arbitragex-v2 (rama actual, último PR, estado de CI).
  2. Identificar el subsistema impactado dentro de los archivos del repo listados arriba.
  3. Aplicar la doctrina del nivel Post-Doc sin desviaciones.
  4. Validar contra: lint → typecheck → build → tests → audit → E2E → deploy.
  5. Reportar evidencia en formato Markdown forense (logs, traces, métricas, hash de commit).

Doctrina del Nivel

  • Aporte de investigación: paper o RFC referenciado.
  • Benchmarks reproducibles con criterio estadístico (95% CI).
  • Comparativa contra estado del arte público.

Reglas de Ejecución

| Condición | Acción | |-----------|--------| | CI rojo en main | ABORT — fix-forward, nunca skip | | Drift schema producer↔consumer | ABORT — restaurar isomorfismo Zod/struct | | Cobertura E2E < contrato iter 18 | ABORT — añadir testid + assertion DEGRADED/UP/DOWN | | Secret en plaintext fuera de Vault/age | ABORT — rotar y reportar | | Profit neto ≤ gas + flashloan_fee | ABORT (skill C/E) | | Slippage > banda RiskGate | RESIZE o ABORT (skill C/E) |

Activation Triggers (regex parciales)

  • server actions form state
  • advanced react 19 usetransition/useoptimistic
  • arbitragex-v2 g

Output Esperado

  • Diff atómico (rustfmt aparte de semántica).
  • Evidencia: gh pr checks <N>, cargo nextest, traces OTel, screenshots Playwright.
  • ADR si la decisión cambia contrato (docs/adr/NNNN-*.md).

Related skills