1 rust rules available
The single Antigravity Rust rule covers systems work with an emphasis on memory safety. An autonomous agent working in Rust tends to fight the borrow checker with clone() or unwrap(); this file tells Antigravity what to do instead and which cargo checks must pass before it reports success.
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/rust.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: "**/*.rs,**/Cargo.toml" --- # Rust instructions for Antigravity ## Focus for this project - Define a crate error enum (with thiserror if the crate already depends on it) instead of returning String errors. - Library code must not panic on bad input; tests may use unwrap. - If a change needs a new dependency, stop and ask before editing Cargo.toml. ## Rust conventions - Read the edition and rust-version fields in Cargo.toml and stay within them; do not raise either without being asked. - Return Result from fallible functions and propagate with ?. No unwrap() or expect() outside tests, examples and documented invariants. - Borrow (&str, &[T]) in parameters where ownership is not needed, and avoid clone() added only to satisfy the borrow checker; explain any clone that remains. - Every unsafe block needs a // SAFETY: comment stating the invariant it relies on. ## Before you finish - Run cargo fmt --check, cargo clippy --all-targets -- -D warnings and cargo test 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.
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.
Create your own Antigravity rules for Rust and share with the community.
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 a parsing function to a Rust crate and want typed errors, no panics in library code and clippy-clean output.
Add a parse_duration(&str) -> Result<Duration, ParseError> function supporting values like 10s and 5m.
A function that borrows &str, returns a ParseError variant for empty or unknown units, unit tests for valid and invalid inputs, and cargo fmt/clippy/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.