Home › Rules › GEMINI.md examples
GEMINI.md examples: copy-paste GEMINI.md files for Gemini CLI and Antigravity
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
| Location | Gemini CLI | Antigravity (app, IDE and CLI) |
|---|---|---|
~/.gemini/GEMINI.md | Yes: your rules for every project | Yes: global, always on |
GEMINI.md in the project root | Yes (it also checks parent folders) | Yes, always on |
GEMINI.md in a subfolder | Yes, loaded when the agent works on files there | Yes, for files in that folder |
AGENTS.md | Only if you add it to context.fileName (example 6) | Yes, same as GEMINI.md |
.agents/rules/*.md | No | Yes, 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)
# 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
# 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
# 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
# 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
# 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
{
"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
---
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
- Write rules, not a novel. Every line is sent with every prompt. Short, specific bullets get followed most.
- Say how to run and check the app. Install, run and test commands save the agent from guessing.
- Watch the size in Antigravity. Its docs cut any single rule file at 24,000 bytes, and all always-on rules share a 20,000-token budget. Past that, the biggest files are swapped for a pointer the agent reads only when it needs to.
- Use a rule for "always" and a skill for "how to". Antigravity's docs put it this way: constraints like "always use zod for validation" go in rules; multi-step jobs like running a migration go in a skill. See SKILL.md examples.
- Check it loaded. In Gemini CLI,
/memory showprints what the model sees.
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
- CLAUDE.md examples and best practices
- copilot-instructions.md examples
- Windsurf rules examples (now Devin Desktop)
- Every rules file format
- Free rules file generator
Sources
- Gemini CLI docs: Provide context with GEMINI.md files
- Gemini CLI on GitHub: GEMINI.md docs
- Google Antigravity docs: Rules
- GitHub docs: Support for different types of custom instructions
Checked Oct 20, 2026. These tools change often; if something here no longer matches, tell us at [email protected].