Antigravity rules examples work best when they encode repo-specific contracts that land in context for coding sessions—not one-off chat fluff. This page shows Markdown files under a typical .agents/rules/(or similar agents-rules) layout, plus snippets you can copy and tighten against your own verify commands. Treat every path here as illustrative— product discovery and UI change; re-check your installed host before treating any example as permanent. Pair with how to write GEMINI.md for project memory, and AGENTS.md vs rules when choosing which durable file owns each fact.
01
Independence note
02
What Antigravity rules are for (vs GEMINI.md & prompts)
Workspace rules feed durable guidance into agent sessions so the model does not re-guess house style every turn. Put contracts that stay true next month in rules (or shared AGENTS.md); put Gemini-only overrides in a thin GEMINI.md; put this ticket’s goal in the chat brief.
- Rules: package manager, route registry, forbidden deploy paths, test commands, language defaults.
- GEMINI.md: Gemini-specific stubs that point at shared AGENTS.md—see how to write GEMINI.md.
- Session prompts: this ticket’s objective, acceptance checks, and temporary non-goals.
- Neither: secrets, production credentials, or one-off customer data.
If you already maintain Cursor-, Windsurf-, Cline-, or Copilot-oriented rules, the engineering intent is similar—different packaging and loaders. Compare cursor rules examples, windsurf rules examples, cline rules examples, and copilot-instructions.md examples. Multi-file choice notes live in AGENTS.md vs CLAUDE.md vs Cursor rules.
03
File layout & discovery (illustrative)
Many Antigravity / agents-host setups look for small Markdown rule files under a workspace directory such as .agents/rules/. Prefer one canonical directory so teammates do not sync two trees. Numeric prefixes (01-, 02-) help when lexicographic order matters. Exact discovery depends on your host version—confirm in current product docs.
.agents/rules/
01-general.md # always-on house style
02-frontend.md # path-scoped page conventions
03-no-deploy.md # forbid wrangler/DNS unless asked
04-security-review.md # toggle / description-gated when neededKeep team contracts in the repo. Personal preferences belong in user-level settings when the product supports them—do not commit private tone prefs as accidental team policy.
04
Copy-ready antigravity rules examples
Adapt these templates. Replace commands, paths, and non-goals with your repo’s truth. Keep them short enough that a human will maintain them.
Always-on project conventions
# Project conventions
- Indent with 4 spaces; do not reformat unrelated files.
- Register every indexable page in the site’s route registry (e.g. pages[]).
- Prefer extending an existing page/component pattern over inventing a new layout.
- Run the project’s build command before claiming done.
- Do not deploy, edit hosting config, or change DNS unless the user explicitly asks.
- Shared cross-tool facts live in AGENTS.md; keep Gemini-only notes in GEMINI.md.Frontend / docs pages
# Frontend page rules
- Mirror ArticleNavigation + article-hero structure from sibling EN how-to pages.
- Unique Title, Description, and a single H1 that contains the target phrase.
- Include Related reading links to sibling guides; keep bidirectional links updated.
- Do not invent new indexed URLs; only add paths listed in the task.Safety / no-deploy
# Deploy and secrets
- Do not run wrangler deploy, change DNS, or edit Cloudflare / payment config unless asked.
- Never commit secrets, tokens, or production credentials into rules or chat history.
- Prefer env stores and documented secret managers over pasting keys into the session.When tools live outside the editor, pair rules with a clear tool policy in the prompt. For MCP host pitfalls, see the MCP server tutorial and MCP server best practices.
05
Writing patterns that stick
- Imperative and testable. “Run
pnpm run build” beats “ensure quality.” - Name artifacts. Paths, registry names, and sibling files beat vibes.
- State non-goals. Agents over-help; forbid deploy, rebrand, or drive-by refactors.
- One concern per file. Split style from security so reviews stay focused.
- Prefer AGENTS.md for shared facts. Gemini CLI often loads AGENTS.md—put cross-tool contracts there; keep Antigravity rules thin for host-specific deltas. See AGENTS.md vs rules.
- Point at exemplars. “Match
GoodGeminiMdPage.tsx” beats reinventing layout.
06
Anti-patterns
- Novel-length always-on rules: crowd context and get sampled inconsistently.
- Install-tour prose in rules: teach product setup in official docs; keep rules as contracts.
- Contradictions: “always refactor” next to “never touch unrelated files.”
- Secrets in rules: rules are often committed; use env stores instead.
- Copying Cursor / Windsurf / Cline rules wholesale without remapping: wrong directory, wrong done checks.
- Duplicating the same wall into AGENTS.md, GEMINI.md, and every rule file: sync cost explodes; pick one canonical layer per concern.
Related reading: How to write GEMINI.md · AGENTS.md vs CLAUDE.md vs Cursor rules · How to write AGENTS.md · Cursor rules examples · Windsurf rules examples · Cline rules examples · Continue rules examples · Kilo code rules examples · Amazon Q rules examples · copilot-instructions.md examples · Good agent prompts · Agent engineering notes
07
FAQ
Where should I put antigravity rules examples in a repo?
Many setups use an .agents/rules/ directory (or similar) at the workspace root with small, focused Markdown files. Exact discovery depends on your Antigravity / host version—confirm in current product docs. This site’s examples are unofficial templates, not a product catalog.
Do I need Antigravity rules if I already have GEMINI.md or AGENTS.md?
Only if Antigravity sessions do not reliably load your other files, or you want host-specific scoping. Prefer one clear statement of each convention in AGENTS.md or GEMINI.md; keep rules as thin deltas. See AGENTS.md vs CLAUDE.md vs Cursor rules.
How do these relate to Cursor, Windsurf, or Cline rules?
Same job—durable repo contracts—different loaders and file shapes. Compare cursor rules examples, windsurf rules examples, and cline rules examples. Do not paste the same wall of text into every layer.
Is this an Antigravity install guide?
No. This page only covers copy-ready rule writing. Install paths, auth, and product UI belong in official docs—re-check those after upgrades.