# Modern Go Guidelines

A set of guidelines that helps AI coding agents write modern, idiomatic Go by detecting a project's Go version and preferring newer language features and standard-library additions over older patterns.

Modern Go Guidelines is a repository of guidelines for AI coding agents that helps them write modern Go code, covering features from Go 1.0 through Go 1.27, including everything targeted by Go's own modernize analyzer. With these guidelines, an agent uses constructs such as max(a, b) instead of an if-else block, slices.Contains instead of a manual loop, and cmp.Or(a, b, c) instead of a chain of nil checks, and knows about recent additions such as new(42) and errors.AsType[T] from Go 1.26.

An agent following the guidelines detects the project's Go version from go.mod and only uses language features and standard-library additions available up to that version, aiming to fix two known causes of outdated generated code: model training-data lag on newer language features, and a frequency bias toward older, more common idioms in training data.

The guidelines are distributed for Junie, Claude Code, Codex and Cursor, and for other agents through skills.sh, and are licensed under Apache-2.0.

Website: https://github.com/JetBrains/go-modern-guidelines
