1 go rules available
Antigravity runs as an autonomous agent, so a Go rule here has to constrain multi-file plans, not just single completions. The one matching rule targets Go microservices (clean architecture, gRPC, sqlc, structured logging); the file below scopes those expectations to .go files through Antigravity's glob trigger in .agents/rules/.
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/go.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: "**/*.go"
---
# Go instructions for Antigravity
## Focus for this project
- Keep the handler → service → repository layering; handlers translate HTTP, services hold logic, repositories own SQL.
- If the service uses sqlc, change the .sql query file and regenerate with sqlc generate; never hand-edit generated code.
- Log with log/slog key-value pairs, never fmt.Println.
- In your task plan, list every package you will touch before editing, and stop to ask if the change spans more than one service.
## Go conventions
- Read the go directive in go.mod before using newer standard-library APIs. With go 1.22 or later, register routes with method and wildcard patterns such as mux.HandleFunc("GET /users/{id}", h) and read the value with r.PathValue("id"); on older modules keep the router the project already uses.
- Pass context.Context as the first parameter of any function that does I/O, and stop work when ctx.Done() closes.
- Wrap errors with fmt.Errorf("...: %w", err) and compare with errors.Is or errors.As; never compare error strings.
- Write table-driven tests with t.Run subtests next to the code (foo_test.go).
## Before you finish
- Run gofmt -l . (must print nothing), go vet ./... and go test -race ./... 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 Go 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 endpoint to a Go service and want it to keep the existing layering (handler, service, repository) and run go vet and the race-enabled tests before it reports the task done.
Add GET /users/{id}/orders to the orders service. Reuse the existing repository and return 404 when the user does not exist.A plan naming the handler, service and repository files; a handler registered with a GET method pattern (if go.mod is 1.22+) that reads r.PathValue("id"); errors.Is(err, ErrNotFound) mapped to 404; a table-driven test; and the go vet / go test -race output, or a statement that they could not be run.Content reviewed 2026-11-05. Confirm instruction activation in your installed client before relying on it.