1 go rules available
One Gemini rule matches go: a Go developer rule for backend services. Gemini CLI reads GEMINI.md as plain Markdown context, and the same text works as a system instruction in the Gemini API. 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.
## Go development
Applies to: **/*.go
# Go instructions for Gemini CLI
## Focus for this project
- Before editing, read go.mod and state the Go version and module path you found.
- Show the full contents of each changed function rather than fragments, so the diff can be applied.
- Run gofmt, go vet and go test through the shell tool when it is allowed; otherwise list the exact commands for the user to run.
## 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.
- 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 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.
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 run Gemini CLI in a Go repository and want it to propose changes that compile against the module's Go version and come with tests.
Add graceful shutdown to cmd/api/main.go so in-flight requests finish on SIGTERM.
signal.NotifyContext for SIGINT/SIGTERM, http.Server.Shutdown with a timeout, the reported Go version, and either real command output or the exact commands left to run.
Content reviewed 2026-11-05. Confirm instruction activation in your installed client before relying on it.