System instructions for Gemini on React 19 + TypeScript: typed function components, accessible markup with useId, error boundaries, measured performance and review checklists.
GEMINI.md. Downloaded files need to be placed in that repository path.## Gemini React Development
Applies to: **/*
You are assisting with React and TypeScript code generation and reviews. Check the React version in package.json; this guidance targets React 19.
## Expertise
- React 19 function components and hooks, including Actions (`useActionState`, `<form action>`), `useOptimistic` and `ref` as a prop.
- TypeScript with `strict` enabled.
- Server-state libraries (TanStack Query, SWR or the framework's loaders) and client stores (Zustand, Jotai) where needed.
- Testing with Vitest or Jest and React Testing Library.
## Code generation
1. Use TypeScript with typed props; extend native element props (`ComponentProps<'button'>`) for wrappers.
2. Use function components and hooks; follow the Rules of Hooks.
3. Wrap independent sections in error boundaries (`react-error-boundary` or the framework's error files); error boundaries cannot be written as hooks.
4. Use semantic HTML first and ARIA only to fill gaps. Generate unique ids with `useId` instead of hard-coded ids.
5. Give every button a `type` and every input a label.
## Example
```tsx
import { useId } from 'react';
interface SectionProps {
title: string;
actionLabel: string;
onAction: () => void;
children?: React.ReactNode;
}
export function Section({ title, actionLabel, onAction, children }: SectionProps) {
const headingId = useId();
return (
<section aria-labelledby={headingId}>
<h2 id={headingId}>{title}</h2>
{children}
<button type="button" onClick={onAction}>{actionLabel}</button>
</section>
);
}
```
## When reviewing code
- Missing or loose TypeScript types (`any`, unchecked casts).
- Performance: unnecessary re-renders that were measured, state stored that could be derived, effects used to sync state, long unvirtualized lists. Do not add `useMemo`/`useCallback` without a reason; React Compiler, if enabled, memoizes automatically.
- Accessibility: missing labels, non-button elements with click handlers, duplicated ids, focus management in dialogs.
- Security: `dangerouslySetInnerHTML` with unsanitized data, secrets in client bundles, unvalidated URLs in `href`/`src`.
Cursor rules for Tailwind CSS v4: automatic class sorting, mobile-first breakpoints, CVA variants with merging, class-based dark mode via @custom-variant, and CSS-first @theme configuration.
Cursor rules for React with TypeScript: typed function components, React 19 ref-as-prop, hooks discipline, state ownership, error boundaries and measured performance work.
CLAUDE.md rules for React 19 with TypeScript covering typed components, derived state, compiler-aware memoization, useId-based accessibility and review checks.
Gemini
frontend
Illustrative input and expected result. This example is a verification guide, not a recorded model run.
Content reviewed .
A design-system Section component hard-codes id="heading" (duplicated when rendered twice) and a review request asks Gemini to check a dashboard for issues.
Review src/components/Section.tsx and src/pages/Dashboard.tsx for type, performance, accessibility and security problems.
A review that flags the duplicate hard-coded id and proposes useId, notes the missing button type, points out any any-typed props, avoids recommending blanket memoization, and lists accessibility and security findings with file and line references.
Gemini CLI loads instructional context from GEMINI.md files: a global ~/.gemini/GEMINI.md, files in your workspace directories and their parents, and files discovered in subfolders as the agent works. The file name is configurable, so a project can tell Gemini CLI to read AGENTS.md instead of, or alongside, GEMINI.md. The rules in this directory are written as plain system instructions, so the same text can also be used as a system instruction in Gemini API or Google AI Studio requests.
GEMINI.mdStarting point, not a tested configuration for your repository. GEMINI.md has no file-scoping front matter; add this as a section, or place a GEMINI.md in the relevant subfolder. Review the instructions, adapt the file paths and run your project's existing checks.
## Gemini React Development
Applies to: **/*
You are assisting with React and TypeScript code generation and reviews. Check the React version in package.json; this guidance targets React 19.
## Expertise
- React 19 function components and hooks, including Actions (`useActionState`, `<form action>`), `useOptimistic` and `ref` as a prop.
- TypeScript with `strict` enabled.
- Server-state libraries (TanStack Query, SWR or the framework's loaders) and client stores (Zustand, Jotai) where needed.
- Testing with Vitest or Jest and React Testing Library.
## Code generation
1. Use TypeScript with typed props; extend native element props (`ComponentProps<'button'>`) for wrappers.
2. Use function components and hooks; follow the Rules of Hooks.
3. Wrap independent sections in error boundaries (`react-error-boundary` or the framework's error files); error boundaries cannot be written as hooks.
4. Use semantic HTML first and ARIA only to fill gaps. Generate unique ids with `useId` instead of hard-coded ids.
5. Give every button a `type` and every input a label.
## Example
```tsx
import { useId } from 'react';
interface SectionProps {
title: string;
actionLabel: string;
onAction: () => void;
children?: React.ReactNode;
}
export function Section({ title, actionLabel, onAction, children }: SectionProps) {
const headingId = useId();
return (
<section aria-labelledby={headingId}>
<h2 id={headingId}>{title}</h2>
{children}
<button type="button" onClick={onAction}>{actionLabel}</button>
</section>
);
}
```
## When reviewing code
- Missing or loose TypeScript types (`any`, unchecked casts).
- Performance: unnecessary re-renders that were measured, state stored that could be derived, effects used to sync state, long unvirtualized lists. Do not add `useMemo`/`useCallback` without a reason; React Compiler, if enabled, memoizes automatically.
- Accessibility: missing labels, non-button elements with click handlers, duplicated ids, focus management in dialogs.
- Security: `dangerouslySetInnerHTML` with unsanitized data, secrets in client bundles, unvalidated URLs in `href`/`src`.
Ask for a small change to one matching file. Check the tool's loaded context or instruction view, inspect the diff for the requested convention, and run the relevant build or test. A well-formatted file does not guarantee the model follows every instruction.
The Gemini CLI documentation states that Gemini CLI was replaced by Antigravity CLI on June 18, 2026 for unpaid-tier and Google One users. Check which CLI your account uses; Antigravity rules are covered on the Antigravity page. Gemini CLI does not need a separate AGENTS.md mechanism: its context file name is configurable through context.fileName in settings.json (the docs show ["AGENTS.md", "CONTEXT.md", "GEMINI.md"]). Without that setting it looks for GEMINI.md.
Documentation checked 2026-11-05: Gemini CLI docs: GEMINI.md context filesGemini CLI docs: System prompt override
Cursor rules for Tailwind CSS v4: automatic class sorting, mobile-first breakpoints, CVA variants with merging, class-based dark mode via @custom-variant, and CSS-first @theme configuration.
Cursor rules for React with TypeScript: typed function components, React 19 ref-as-prop, hooks discipline, state ownership, error boundaries and measured performance work.
CLAUDE.md rules for React 19 with TypeScript covering typed components, derived state, compiler-aware memoization, useId-based accessibility and review checks.