Configure Gemini for Tailwind CSS v4 styling: automatic class sorting, mobile-first responsive classes, class-based dark mode, CSS-first theme tokens and cva variants.
GEMINI.md. Downloaded files need to be placed in that repository path.## Gemini Tailwind CSS Expert
Applies to: **/*
You are an expert in Tailwind CSS and modern styling. Check the Tailwind major version first; this guidance targets v4.
## Class organization
- Do not hand-order classes. Use `prettier-plugin-tailwindcss` (Tailwind v4: set `tailwindStylesheet` to the CSS entry file) and list helper functions such as `cn` and `cva` in `tailwindFunctions`.
- Use complete class names; never build them by concatenation (`bg-${color}-500`), because Tailwind cannot detect them.
## Responsive design
```html
<div class="grid grid-cols-1 gap-4 p-4 sm:grid-cols-2 sm:gap-6 lg:grid-cols-3 lg:p-8">
```
- Mobile first: unprefixed classes apply to all widths, prefixed ones from that breakpoint up. Use container queries (`@container`, `@md:`) for components placed in containers of different widths.
## Dark mode
```html
<div class="bg-white text-gray-900 dark:bg-gray-900 dark:text-white">
<p class="text-gray-600 dark:text-gray-300">Subtle text</p>
</div>
```
- `dark:` follows the OS setting by default. For a manual toggle, add `@custom-variant dark (&:where(.dark, .dark *));` to the main CSS file.
## Design tokens
- Define colors, fonts and spacing as theme variables in CSS:
```css
@import "tailwindcss";
@theme {
--color-brand-500: oklch(0.62 0.19 255);
--font-display: "Inter", sans-serif;
}
```
This generates utilities such as `bg-brand-500` and `font-display`.
## Component pattern
```tsx
import { cva, type VariantProps } from 'class-variance-authority';
export const button = cva('inline-flex items-center rounded font-medium focus-visible:ring-2', {
variants: {
intent: {
primary: 'bg-blue-500 text-white hover:bg-blue-600',
secondary: 'bg-gray-200 text-gray-900 hover:bg-gray-300',
},
size: {
sm: 'h-8 px-3 text-sm',
md: 'h-10 px-4',
lg: 'h-12 px-6 text-lg',
},
},
defaultVariants: { intent: 'primary', size: 'md' },
});
export type ButtonVariants = VariantProps<typeof button>;
```
- Check color contrast for text on each variant (including dark mode) and keep a visible focus style.
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 designer asks Gemini for a brand button and a dark-mode card in a Tailwind v4 project that uses a theme toggle.
Create a Button with primary/secondary intents and three sizes, and a Card that supports our dark mode toggle. Brand color is oklch(0.62 0.19 255).
A cva definition with defaultVariants and a focus-visible style, an @theme block adding --color-brand-500, the @custom-variant dark line for the toggle, a card using dark: utilities, and a note to let prettier-plugin-tailwindcss sort the classes.
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 Tailwind CSS Expert
Applies to: **/*
You are an expert in Tailwind CSS and modern styling. Check the Tailwind major version first; this guidance targets v4.
## Class organization
- Do not hand-order classes. Use `prettier-plugin-tailwindcss` (Tailwind v4: set `tailwindStylesheet` to the CSS entry file) and list helper functions such as `cn` and `cva` in `tailwindFunctions`.
- Use complete class names; never build them by concatenation (`bg-${color}-500`), because Tailwind cannot detect them.
## Responsive design
```html
<div class="grid grid-cols-1 gap-4 p-4 sm:grid-cols-2 sm:gap-6 lg:grid-cols-3 lg:p-8">
```
- Mobile first: unprefixed classes apply to all widths, prefixed ones from that breakpoint up. Use container queries (`@container`, `@md:`) for components placed in containers of different widths.
## Dark mode
```html
<div class="bg-white text-gray-900 dark:bg-gray-900 dark:text-white">
<p class="text-gray-600 dark:text-gray-300">Subtle text</p>
</div>
```
- `dark:` follows the OS setting by default. For a manual toggle, add `@custom-variant dark (&:where(.dark, .dark *));` to the main CSS file.
## Design tokens
- Define colors, fonts and spacing as theme variables in CSS:
```css
@import "tailwindcss";
@theme {
--color-brand-500: oklch(0.62 0.19 255);
--font-display: "Inter", sans-serif;
}
```
This generates utilities such as `bg-brand-500` and `font-display`.
## Component pattern
```tsx
import { cva, type VariantProps } from 'class-variance-authority';
export const button = cva('inline-flex items-center rounded font-medium focus-visible:ring-2', {
variants: {
intent: {
primary: 'bg-blue-500 text-white hover:bg-blue-600',
secondary: 'bg-gray-200 text-gray-900 hover:bg-gray-300',
},
size: {
sm: 'h-8 px-3 text-sm',
md: 'h-10 px-4',
lg: 'h-12 px-6 text-lg',
},
},
defaultVariants: { intent: 'primary', size: 'md' },
});
export type ButtonVariants = VariantProps<typeof button>;
```
- Check color contrast for text on each variant (including dark mode) and keep a visible focus style.
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.