react-best-practices-audit

A review of a React application against Vercel’s published guidelines for speed and efficient data loading. React is a JavaScript library for building user interfaces.

In plain words
What is it for?
Finding and prioritizing improvements in React or Next.js code, including data fetching, rendering, and bundle size.
Why use it?
It identifies performance problems such as unnecessary waiting, large browser bundles, slow server work, and avoidable screen updates.

Agent

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/vercel-labs/open-agents/react-best-practices-audit
Clone the repo
git clone --depth 1 https://github.com/vercel-labs/open-agents
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 3,297 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.03297
Opus 5 $0.00000 $0.01648
Sonnet 5 $0.00000 $0.00659
Haiku 4.5 $0.00000 $0.00330

Measured today against content hash b9025a9f5f11, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

react-best-practices-audit scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured today.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

docs/agents/react-best-practices-audit.md · 289 lines

How it starts

The opening of the file, as written. The whole thing — 289 lines — stays where its author put it; the contents beside it link to each section on GitHub.

React Best Practices Audit: apps/web

Audited against the Vercel React Best Practices (57 rules, 8 categories). Findings are ordered by impact.


1. Eliminating Waterfalls -- CRITICAL

1a. Sequential await chains in Server Components FIXED

Rule violated: async-parallel (Promise.all for independent operations)

app/sessions/[sessionId]/chats/[chatId]/page.tsx:67-93 -- Four sequential await calls where some are independent:

const session = await getServerSession();     // 1. auth
const sessionRecord = await getSessionById(sessionId); // 2. depends on nothing
const chat = await getChatByIdWithRetry(chatId, sessionId); // 3. depends on sessionId only
const dbMessages = await getChatMessages(chatId); // 4. depends on chatId only

getServerSession() and getSessionById() are independent and could run in parallel. After the ownership check, getChatByIdWithRetry and getChatMessages could also overlap (chatId is known from params, not from the session fetch).

Fix: Start independent promises early, await late:

const sessionPromise = getServerSession();
const sessionRecordPromise = getSessionById(sessionId);
const session = await sessionPromise;
if (!session?.user) redirect("/");
const sessionRecord = await sessionRecordPromise;
// ... ownership check ...
const [chat, dbMessages] = await Promise.all([
  getChatByIdWithRetry(chatId, sessionId),
  getChatMessages(chatId),
]);

1b. Missing Suspense boundaries FIXED

Rule violated: async-suspense-boundaries

There are zero loading.tsx files and zero error.tsx files in the entire app. Only one <Suspense> boundary exists (app/settings/accounts/page.tsx:8). The root layout (app/layout.tsx:24-39) has no Suspense wrapping {children}.

This means:

  • No streaming SSR for any page
  • The entire page tree (including the retry loop at page.tsx:31-48 that can block for up to 5 seconds) must resolve before anything paints

Fix: Added loading.tsx files for key route segments (sessions/[sessionId]/chats/[chatId], sessions/[sessionId], shared/[shareId]). Next.js automatically wraps these in <Suspense> boundaries.

Read the full file on GitHub · 289 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. today First seen · 289 lines · 0 tokens per session scan A b9025a9f5f11

Subscribe to this mod's changes

react-best-practices-audit is an agent published in the GitHub repository vercel-labs/open-agents (5,798 stars, last pushed 3d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 3,297 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.