3 python rules available
Three Antigravity rules match python exactly, but only one is a real Python rule: the FastAPI backend rule. The other two (AI art generation and the generic Antigravity rule) list python among several technologies and are under 250 characters. The file below is written for the FastAPI-style backend the substantive rule describes.
Google describes Antigravity as its agentic development platform. Antigravity reads workspace rules from AGENTS.md or GEMINI.md and from Markdown files in .agents/rules/, with a trigger front matter field that sets when a rule is active. Global rules live under ~/.gemini/.
.agents/rules/python.mdStarting point, not a tested configuration for your repository. Active when files matching globs are involved (trigger: glob). Review the instructions, adapt the file paths and run your project's existing checks.
--- trigger: glob globs: "**/*.py" --- # Python instructions for Antigravity ## Focus for this project - Define request and response bodies as Pydantic models; return response models, not ORM objects. - Get database sessions and the current user through FastAPI dependencies (Depends), not module-level globals. - Use async def only when the whole call chain is async; do not call blocking I/O inside async endpoints. - Add a pytest test using the app's existing test client fixture for each new route. ## Python conventions - Read requires-python in pyproject.toml first. Use built-in generics such as list[str] (3.9+) and X | None unions (3.10+) only when the minimum version allows them at runtime. - Annotate public functions and keep Any out of new signatures. - Raise specific exception types and never use a bare except:. - Use the formatter, linter and type checker already configured in pyproject.toml instead of introducing new ones. ## Before you finish - Run the configured linter and type checker (for example ruff check . and mypy) and pytest -q and report the actual output. If you cannot run them, say so and list the exact commands instead of saying they pass. - Summarize which of the rules above affected the change. - Show your plan, including the commands you will run, before editing any file outside the globs in this rule.
Create your own Antigravity rules for Python and share with the community.
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.
Antigravity truncates any single rule file over 24,000 bytes, and global plus always_on rules share a 20,000-token budget, according to the docs. AGENTS.md (or GEMINI.md) in a workspace directory is one of the documented rule locations, and ~/.gemini/AGENTS.md works globally. Use .agents/rules/ when a rule should only apply in some situations.
Documentation checked 2026-11-05: Google Antigravity docs: RulesGoogle Antigravity home page
Illustrative input and expected result. This example is a verification guide, not a recorded model run.
You ask Antigravity to add an API route to a FastAPI service and want typed request models, dependency-injected database sessions and tests run before it hands back.
Add PATCH /projects/{project_id} that renames a project the current user owns.A Pydantic update model, an endpoint that loads the project through the session dependency, a 404 for a missing project and 403 for another owner, a pytest case per branch, and lint/type/test output or a note that they were not run.
Content reviewed 2026-11-05. Confirm instruction activation in your installed client before relying on it.
Antigravity workspace rule for FastAPI services with Pydantic v2 schemas, per-request SQLAlchemy 2 async sessions, explicit transactions and 409 handling.