react

react is a cursor rule for Cursor from louisbrulenaudet/monorepo-template. It costs 0 tokens per session (1,427 once invoked), scanned A, original, Apache-2.0.

A set of rules defines conventions for client-only React 19 single-page applications (SPAs), including component structure, data loading, routing, and performance.

In plain words
What is it for?
It guides React code changes involving components, hooks, asynchronous state, routing, providers, environment settings, and memoization.
Why use it?
It prevents common project-level mistakes such as fetching data in effects, defining components inside components, or using unstable list keys.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit It guides React code changes involving components, hooks, asynchronous state, routing, providers, environment settings, and memoization.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/louisbrulenaudet/monorepo-template/react
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.

Clone the repo
git clone --depth 1 https://github.com/louisbrulenaudet/monorepo-template

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for react

README.md
[![agentmods](https://agentmods.dev/badge/rules/louisbrulenaudet/monorepo-template/react/github.svg)](https://agentmods.dev/rules/louisbrulenaudet/monorepo-template/react)
Your own site
<a href="https://agentmods.dev/rules/louisbrulenaudet/monorepo-template/react"><img src="https://agentmods.dev/badge/rules/louisbrulenaudet/monorepo-template/react/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for react

Your own site · 80×15
<a href="https://agentmods.dev/rules/louisbrulenaudet/monorepo-template/react"><img src="https://agentmods.dev/badge/rules/louisbrulenaudet/monorepo-template/react.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 1,427 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00000 $0.01427
Opus 5.5 $0.00000 $0.00571
Sonnet 5.5 $0.00000 $0.00285
Haiku 4.5 $0.00000 $0.00143

Measured 10d ago against content hash 4a49b95f7ca8, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

react 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 10d ago.

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.

.cursor/rules/frontend/react.mdc · 43 lines

How it starts

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

React SPA (React 19 + Vite)

front-* apps are client-only Vite SPAs: no SSR, React Server Components, or "use server"; ignore React guidance framed around those. Targeted performance audit: skill vercel-react-best-practices (browser/client guidance only).

Layout

  • Screens live in src/pages/, thin route files in src/routes/ (tanstack-router.mdc); shared UI in src/components/ (primitives in src/components/ui/); non-render logic in src/hooks/, src/services/, src/utils/; frontend-only value sets in src/enums/; runtime config in src/config/. HTTP calls pair with their queryOptions in src/services/worker-api/<feature>.ts + <feature>-query-options.ts.
  • components/ui/ holds primitives that import only #/utils/* and other primitives (lint-enforced by a no-restricted-imports override). A component that reads a hook, a service, or feature content lives in src/components/<feature>/ beside that content (health/, onboarding/), and components/feedback/ holds app-shell states only (error, not-found); RouteErrorFallback stays router-free, because the root ErrorBoundary renders it outside RouterProvider. Promote a feature to src/features/<x>/ only once it spans two routes, updating the rule paths: globs in the same change, because they key on the layered folders.
  • In-app absolute imports use the package.json "imports" map (#/* → ./src/*, e.g. #/components/ui/Button) - never an @/ alias, resolve.alias, or compilerOptions.paths.

Components and hooks

  • Never define a component (or a memo / lazy wrapper) inside another component's body; hoist it to module scope.
  • Never fetch in useEffect or mirror query data into local state: server state is TanStack Query (tanstack-query.mdc), and react-doctor/no-fetch-in-effect is a lint error. Derive during render rather than syncing props/state in useEffect; effects are only for external sync and clean up on unmount.
  • React Compiler is on: do not default to useMemo / useCallback / memo; they are an escape hatch.
  • useTransition / startTransition / useDeferredValue for non-urgent or expensive UI work.
  • List keys use stable identity (item.id), never the index when order can change.
  • ref is a normal prop (no new forwardRef). use() only with a stable cached promise under <Suspense>, never use(fetch(...)) created during render.
  • Hook rules (react/rules-of-hooks, react/exhaustive-deps) and jsx-a11y (partial a11y coverage) are oxlint rules; never add an ESLint / eslint-plugin-react-hooks toolchain.

Read the full file on GitHub · 43 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. 10d ago Changed · +2 lines 4a49b95f7ca8
  2. 17d ago Changed d90e9d51e1fe
  3. 18d ago Changed · +14 lines 0f53191cf829
  4. 22d ago Changed 576fe836a05a
  5. 1mo ago First seen · 27 lines · 0 tokens per session scan A 0c7f4b916787

Subscribe to this mod's changes

react is a cursor rule published in the GitHub repository louisbrulenaudet/monorepo-template (19 stars, last pushed 2d ago), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 1,427 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-30.