Home › Rules › GEMINI.md examples

GEMINI.md examples: copy-paste GEMINI.md files for Gemini CLI and Antigravity

Based on the Gemini CLI and Google Antigravity docs, checked Oct 20, 2026. Sources below.

Short answer: GEMINI.md is a plain Markdown file of instructions that Gemini CLI sends to the model with every prompt: what your project is, your rules, and the commands to run. Put one in your project's root folder, and an optional personal one at ~/.gemini/GEMINI.md for every project. Google Antigravity reads GEMINI.md too, along with AGENTS.md. One thing to know: for unpaid and Google One users, Gemini CLI was replaced by Antigravity CLI on June 18, 2026, so if you're on one of those plans, Antigravity CLI is what reads your file now. Below are 7 examples you can copy.

Where GEMINI.md files go

LocationGemini CLIAntigravity (app, IDE and CLI)
~/.gemini/GEMINI.mdYes: your rules for every projectYes: global, always on
GEMINI.md in the project rootYes (it also checks parent folders)Yes, always on
GEMINI.md in a subfolderYes, loaded when the agent works on files thereYes, for files in that folder
AGENTS.mdOnly if you add it to context.fileName (example 6)Yes, same as GEMINI.md
.agents/rules/*.mdNoYes, one rule per file with a trigger header (example 7)

Gemini CLI joins all the files it finds and sends them together. The footer shows how many context files are loaded. Type /memory show to see exactly what the model gets, and /memory reload after you edit a file.

7 GEMINI.md examples

1. A web app (Next.js + Supabase)

GEMINI.md (project root)
# Project: Habit tracker web app

A web app where people sign up, add habits and tick them off each day.
Built with Next.js (App Router), TypeScript, Tailwind CSS and Supabase.

## How to work with me
- I'm a beginner. Explain changes in plain English before making them.
- Work in small steps. After each step, tell me how to test it in the browser.
- Ask before changing the database, login, or payments.
- Explain any error in plain English before fixing it.

## Code rules
- TypeScript for new files. Function components only.
- Reuse components in src/components before creating new ones.
- Tailwind classes only. No inline styles.
- Never put secret keys in front-end code.

## Commands
- Run locally: npm run dev
- Check before you say you're done: npm run lint and npm run build

Change the first lines to your own project. The "Commands" section matters most: when the agent knows how to run and check your app, it guesses less.

2. A Python script

GEMINI.md (project root)
# Project: Daily sales summary script

A Python 3.12 script that reads orders.csv and emails a summary every morning.

## Rules
- Keep it a simple script. No classes unless I ask.
- Read passwords and API keys from environment variables. Never hard-code them.
- Every function gets a one-line docstring in plain English.
- When something fails, print which file or row caused it.

## Commands
- Install: pip install -r requirements.txt
- Try it safely: python main.py --dry-run (prints the email instead of sending it)
- Test: pytest

3. Your global GEMINI.md

~/.gemini/GEMINI.md
# My rules for every project
- I'm new to coding. Use plain English and explain new terms the first time.
- Make the smallest change that works. Don't touch code I didn't ask about.
- Never delete files or run commands that remove data without asking first.
- When you finish, tell me what changed and how to check it.

This loads for every project, so keep it about how you like to work. Anything specific to one project goes in that project's file.

4. A subfolder GEMINI.md

src/components/GEMINI.md
# Components folder
- One component per file, named like HabitCard.tsx.
- Mobile first: everything must work at 375px wide.
- Buttons and links need a visible focus style. Images need alt text.
- Reuse Button, Card and Input from ./ui before making new ones.

Gemini CLI picks this up only when it reads or edits files in that folder, so the rules show up exactly when they're useful.

5. Split a long file with imports

GEMINI.md (with @ imports)
# Project: Habit tracker web app

Short overview and the most important rules go here.

@./docs/style-guide.md
@./docs/database-rules.md

In Gemini CLI, each @./path.md line pulls in another file, so you can keep the main file short. Relative and absolute paths both work. Antigravity uses a different include syntax, @[label](path), so check its Rules docs if you use both.

6. Make Gemini CLI read AGENTS.md too

.gemini/settings.json
{
  "context": {
    "fileName": ["AGENTS.md", "GEMINI.md"]
  }
}

By default Gemini CLI only looks for GEMINI.md. With this setting it also reads AGENTS.md, so one file can serve Gemini, Cursor, Codex and Copilot.

7. An Antigravity rule that loads only when needed

.agents/rules/database.md
---
trigger: model_decision
description: "Use whenever writing or changing database tables, migrations, row-level security or login code."
---

# Database rules
1. Explain the change in plain English and what could break.
2. Show me the migration before running it. Wait for my OK.
3. Never turn off row-level security.
4. Never drop a table or column without asking twice.

Antigravity only sends the description until your task matches it. The trigger must be one of always_on, model_decision, glob or manual, written exactly like that: Antigravity's docs say a rule with a missing or misspelled trigger (like alwaysOn) is silently ignored. It also only scans files directly inside .agents/rules/, not subfolders.

GEMINI.md vs AGENTS.md

They hold the same kind of instructions in plain Markdown. Antigravity reads both, and GitHub Copilot's cloud agent reads a GEMINI.md in the root as well. Gemini CLI reads only GEMINI.md unless you change the setting in example 6. If you use more than one AI tool, the simplest setup is one AGENTS.md plus that setting. If you only use Gemini, a GEMINI.md is fine. More: AGENTS.md vs CLAUDE.md and every rules file format.

Tips

Best value

Get all 5 kits for $25 with 30% off: code WELCOME30 at checkout (through Nov 30, 2026)

A GEMINI.md tells the agent how to code. The kits tell it what to build and in what order, with copy-paste prompts and stop-and-test checkpoints: a small game, a Discord bot, an email-triage agent, an MVP, or a cleanup of messy code.

Get all 5 kits for $25 → See what's in each kit

$25 instead of $39 for the five kits bought separately; WELCOME30 takes 30% off that at checkout ($17.50). Instant download from Gumroad. 7-day refund, no questions asked.

Related

Sources

Checked Oct 20, 2026. These tools change often; if something here no longer matches, tell us at [email protected].

Get the free Starter Rules for Gemini, Cursor and Claude Code

  • A copy-paste rules file to save as AGENTS.md or CLAUDE.md, or paste into Lovable, Bolt, v0 or Replit: small steps, ask before risky changes, no fake "it works", secrets kept out of code.
  • A kickoff prompt that makes your AI ask up to 3 questions and plan 5 to 8 small, testable steps before it writes any code.
  • The habit that saves projects: work, test, commit.

After that, an occasional email when we publish a new guide or rules file.

Free. No spam. Unsubscribe anytime. See our privacy note.