31 python rules available
Gemini has 31 Python rules, most of them short data and ML prompts: pandas, PyTorch, TensorFlow, scikit-learn, Spark, Ray, Airflow, dbt, LangChain, Streamlit and more. Only the Python expert rule is substantive. The GEMINI.md section below sets data-work guardrails that apply across those libraries. GEMINI.md has no glob scoping, so the section names the files it applies to; a GEMINI.md inside a subfolder is the way to limit it to that folder.
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.
## Python development Applies to: **/*.py # Python instructions for Gemini CLI ## Focus for this project - Move logic that is reused from notebooks into importable modules with tests. - Set random seeds for anything stochastic and record library versions for model training code. - Never load a full production dataset to test a change; use a small fixture. ## 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. - If shell commands are not approved in this session, stop after the edit and list the exact commands for the user to run.
Create your own Gemini 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.
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
Illustrative input and expected result. This example is a verification guide, not a recorded model run.
You use Gemini CLI on a notebook-heavy analytics repository and want reproducible, tested transformations instead of one-off cells.
Turn the cleaning cells in notebooks/churn.ipynb into a tested function.
A typed function in a module (for example src/churn/clean.py), the notebook importing it, a pytest test with a small DataFrame fixture, and lint/test commands with their results or a note that they were not run.
Content reviewed 2026-11-05. Confirm instruction activation in your installed client before relying on it.
Generate secure Python code