JetBrains /
go-modern-guidelines
Teaches coding agents to write current Go instead of outdated patterns
- 3.9k stars
- 127 stars since 3 Oct
- Go
- Updated 7 days ago
- Beginner friendly
- Agent skills & plugins
AI coding agents often write dated Go. The README gives two reasons: models don't know features added after their training cutoff, and older patterns appear more often in training data, so they get picked even when the model knows the newer one.
This repository fixes that with an explicit reference. The agent reads your project's go.mod to find the Go version, then uses language features and standard library additions up to that version. For example, it uses max(a, b) instead of an if-else block, slices.Contains instead of a hand-written loop, and cmp.Or instead of a chain of checks.
It shares its goal with the Go team's modernize analyzer, which updates existing code. These guidelines aim at new code, so agents write modern Go from the start. It ships for Junie, Claude Code, Codex and Cursor, and for other agents through skills.sh.
What it does
Version-aware guidance
The agent reads go.mod and only uses features available in that Go version, so the code it writes fits your project.
Wide feature coverage
Covers useful features from Go 1.0 through Go 1.27, including everything the modernize analyzer targets. FEATURES.md lists them with examples.
Newer APIs the model may not know
Includes recent additions such as new(42) for a pointer to a value and errors.AsType[T](err) for type-safe error matching, both from Go 1.26.
Works across several agents
Packaged as a plugin for Junie, Claude Code, Codex and Cursor. Other agents such as OpenCode can install it through skills.sh.
Automatic or explicit use
Claude Code and Junie invoke the skill when a Go task comes up. In Claude Code you can also call it with /modern-go-guidelines:use-modern-go.
What you could build
- Keep a Claude Code or Codex session writing idiomatic modern Go in a new service.
- Reduce review comments about old loops, manual min/max and hand-rolled slice helpers in agent-written pull requests.
- Make an agent respect the Go version in go.mod when it adds new code.
- Learn which newer Go features exist by browsing FEATURES.md with examples.
- Add the same Go guidance to a team that uses a mix of Junie, Cursor and Codex.
Get started
Make sure the Go toolchain is on your PATH, since the plugin installs a small CLI with go install on first use. Then add the repository as a marketplace in your agent and install the plugin; the Claude Code commands are shown here.
/plugin marketplace add JetBrains/go-modern-guidelines/plugin install modern-go-guidelines@goland-claude-marketplacenpx skills add JetBrains/go-modern-guidelinesCommands are copied from the project's README. Read it on GitHub for the full setup.