{"slug": "help-ai-coding-agents-write-up-to-date-code-with-modern-golang-skills", "title": "Help AI Coding Agents Write Up-To-Date Code With Modern Golang Skills", "summary": "JetBrains' GoLand team released Modern Go Guidelines, an open-source set of skills that help AI coding agents write up-to-date Go code matching the Go version in a project, covering features from Go 1.0 through Go 1.27. The tool uses a CLI with 'list' and 'explain' subcommands to provide focused context, and it excludes guidelines for newer versions when the project uses an older Go version, ensuring compatibility and reducing token usage.", "body_md": "[AI](/go/category/ai/)\n\n[Community](/go/category/community/)\n\n[GoLand](/go/category/goland/)\n\n# Help AI Coding Agents Write Up-To-Date Code With Modern Golang Skills\n\n# TL;DR\n\n**Repository on GitHub**:[Modern Go Guidelines](https://github.com/JetBrains/go-modern-guidelines).** Purpose**: Modern Go Guidelines are a set of skills that help AI coding agents write up-to-date Go code that matches the Go version in your project.**Version support**: The skills cover useful language features and standard library additions from Go 1.0 through Go 1.27. Guidelines for newer versions are excluded when your project uses an older version.**Focused context**: The tool uses`list`\n\nfor short guidelines and`explain`\n\nfor detailed examples. This progressive disclosure approach gives agents detailed guidance only when they need it and helps them apply the skills more reliably.**Installation**: You can install the plugin from the marketplace or a local repository. The integration requires the Go toolchain, runs from a local cache, and does not modify your project.\n\n# Why AI coding agents need modern Go skills\n\nAI coding agents can produce working Go code, but they typically rely on outdated patterns. Older syntax appears more often in their training data. Newer language features and standard library additions may also fall outside their training cutoff.\n\nThe GoLand team created [Modern Go Guidelines](https://github.com/JetBrains/go-modern-guidelines) to close this gap. These Golang skills give agents an up-to-date reference for writing modern code. They help agents select features supported by the Go version in your project and avoid code that requires a newer version.\n\nModern Golang skills are an open-source contribution from the GoLand team to the broader Go community. You can use them with supported AI coding agents in the terminal.\n\n# Modern code for the correct Go version\n\nNewer code is useful only when your project can compile it. For this reason, the guidelines match the Go version declared in your go.mod file.\n\nConsider a project that contains the `go 1.25`\n\ndirective.\n\nThe agent can receive skills for Go 1.25 and earlier. It does not receive Go 1.26 or Go 1.27 skills. For example, it can learn to use `sync.WaitGroup.Go`\n\n, which Go 1.25 introduced. It will not receive a suggestion to use errors.AsType, which requires Go 1.26.\n\nThis version check ensures that the generated code is compatible with your project. It also reduces the amount of context the agent must read. The agent does not spend tokens on features that it cannot use.\n\n## CLI tool with focused output\n\nThe agent uses a CLI tool that comes with the *go-modern-guidelines* plugin. It includes the *use-modern-go* skill, a set of instructions that teaches the agent when and how to use the CLI. The tool supports two main subcommands: `list`\n\nand `explain`\n\n. The skill tells the agent to run `list`\n\nfor the relevant Go file before editing and to call `explain`\n\nwhen it needs details about a specific rule.\n\nEach agent integration runs these subcommands through its own wrapper. The examples below use the CLI binary name.\n\nYour agent uses the CLI to get skills for the Go version(s) used in your project. The `list`\n\nsubcommand returns short, relevant guidelines. When the agent needs more context, the `explain`\n\nsubcommand provides detailed guidance and code examples.\n\n```\ngo-modern-guidelines list --file-path ./internal/worker/worker.go\n```\n\nYour agent can also set the version directly:\n\n```\ngo-modern-guidelines list --go-version 1.27\n```\n\nThe output starts with the newest applicable guidelines and includes a stable identifier (ID) for each one:\n\n```\n...\nsync_waitgroup_go: Use wg.Go when spawning goroutines tracked by a sync.WaitGroup.\ntesting_t_context: Use t.Context() when a test function needs a context tied to the test lifetime.\njson_omitzero: Use omitzero on JSON-tagged bool, numeric, struct, and time fields whose zero value should be omitted; keep omitempty for empty strings, slices, and maps.\n...\n```\n\nThe short output helps the agent find relevant guidance without loading all available explanations and code samples.\n\nAn agent may not recognize a recent Go feature or know how to apply it because the feature falls outside its training data. When the agent needs more information about a guideline, it uses the `explain`\n\nsubcommand.\n\n```\ngo-modern-guidelines explain generic_methods\n```\n\nThe command returns a detailed explanation and a before-and-after example. The example compares an older pattern with its modern replacement, helping the agent apply the change correctly.\n\n```\ngeneric_methods:\n  Since: Go 1.27\n\n  Summary:\n    Use generic methods instead of package-level generic helper functions when the operation naturally belongs to the type itself.\n\n  Details:\n    Generic methods keep operations in the namespace of the type that owns them. Keep package-level helpers for operations that do not naturally belong to one receiver type.\n\n  Examples:\n\n  Before:\n    type Set[T comparable] map[T]struct{}\n    func Map[T comparable, U any](s Set[T], f func(T) U) []U {\n      out := make([]U, 0, len(s))\n      for value := range s {\n        out = append(out, f(value))\n      }\n      return out\n    }\n    names := Map(users, func(user User) string {\n      return user.Name\n    })\n\n  After:\n    type Set[T comparable] map[T]struct{}\n    func (s Set[T]) Map[U any](f func(T) U) []U {\n      out := make([]U, 0, len(s))\n      for value := range s {\n        out = append(out, f(value))\n      }\n      return out\n    }\n    names := users.Map(func(user User) string {\n      return user.Name\n    })\n```\n\nYour agent can request several explanations in one command:\n\n```\ngo-modern-guidelines explain generic_methods atomic_types errors_as_type\n```\n\n## What the guidelines cover\n\nThe project covers useful language features and standard library additions from Go 1.0 through Go 1.27. It also includes the patterns handled by the Go modernize analyzer.\n\nThe guidelines help agents choose patterns such as:\n\n`slices.Contains`\n\ninstead of a manual search loop.`min`\n\nand`max`\n\ninstead of handwritten comparisons.`cmp.Or`\n\ninstead of a chain that selects the first nonzero value.`sync.WaitGroup.Go`\n\ninstead of separate`Add`\n\n,`go`\n\n, and`Done`\n\ncalls.`errors.AsType`\n\nfor type-safe error matching in Go 1.26 and later.`new(value)`\n\nwhen you need a pointer to a value in Go 1.26 and later.`strings.CutLast`\n\nand`bytes.CutLast`\n\ninstead of LastIndex and manual slicing in Go 1.27.\n\nThese examples solve a common problem with generated code. An agent may know an older pattern because that pattern appears in a large body of existing code. The provision of explicit rules helps the agent choose the most current form of a given syntax.\n\nThese modern Go skills complement tools such as `go fix`\n\n. Our repository helps agents write current code from the start, while the `go fix`\n\ncommand helps update patterns that already exist in a codebase.\n\n## Installing the guidelines into your AI agent\n\nYou can install the plugin from the marketplace or from a local repository. Both methods require the Go toolchain on your `PATH`\n\n. On first use, the integration installs the command-line tool with `go install `\n\nand stores it in a local cache. It does not modify your project.\n\n### Install the plugin from the marketplace\n\n- Open a session with your AI agent (for example, run\n`claude`\n\nin the terminal). - Add the Modern Go Guidelines as a Claude marketplace:\n\n```\n/plugin marketplace add JetBrains/go-modern-guidelines\n```\n\n- Install the plugin:\n\n```\n/plugin install modern-go-guidelines\n```\n\n- Activate the guidelines:\n\n```\n/use-modern-go\n```\n\nThe integration checks the Go version in your project and provides the AI agent with the corresponding guidelines.\n\n### Install the plugin from a local repository\n\nUse a local repository to test the plugin before publishing or updating it. The repository root must contain the `.*-plugin/marketplace.json`\n\nfile.\n\n- Open a terminal and run your AI coding agent.\n- Add the local repository as a Claude marketplace. Replace the example path with the absolute path to your repository:\n\n```\n<claude|codex> plugin marketplace add /absolute/path/to/go-modern-guidelines\n```\n\n- Install the plugin from the marketplace:\n\n```\n<claude|codex> plugin install modern-go-guidelines@goland-<claude|codex>-marketplace\n```\n\n- Start or restart your AI agent in your Go project.\n- Activate the guidelines in the session:\n\n```\n/use-modern-go\n```\n\nThe AI agent reads the marketplace definition from your local repository and installs the plugin in its plugin cache. Your repository remains the marketplace source.\n\n# Start with modern Go\n\nLanguage releases move faster than model training cycles. Your coding agent needs a small, current source of truth to keep up.\n\nOur repository of modern Golang skills provides that source, without sending irrelevant material to the agent. Your `go.mod`\n\nfile sets the boundary. The `list`\n\nsubcommand shows what applies. The `explain`\n\nsubcommand adds detail only when the agent needs it.\n\nExplore the project, installation instructions, and current guidelines in the [Modern Go Guidelines repository](https://github.com/JetBrains/go-modern-guidelines).\n\nHappy coding!\n\nThe GoLand team\n\n#### Subscribe to GoLang Blog updates", "url": "https://wpnews.pro/news/help-ai-coding-agents-write-up-to-date-code-with-modern-golang-skills", "canonical_source": "https://blog.jetbrains.com/go/2026/08/24/help-ai-coding-agents-write-up-to-date-code-with-modern-golang-skills/", "published_at": "2026-08-24 14:18:56+00:00", "updated_at": "2026-08-24 16:13:24.588374+00:00", "lang": "en", "topics": ["developer-tools", "ai-tools", "artificial-intelligence"], "entities": ["JetBrains", "GoLand", "Modern Go Guidelines", "Go"], "alternates": {"html": "https://wpnews.pro/news/help-ai-coding-agents-write-up-to-date-code-with-modern-golang-skills", "markdown": "https://wpnews.pro/news/help-ai-coding-agents-write-up-to-date-code-with-modern-golang-skills.md", "text": "https://wpnews.pro/news/help-ai-coding-agents-write-up-to-date-code-with-modern-golang-skills.txt", "jsonld": "https://wpnews.pro/news/help-ai-coding-agents-write-up-to-date-code-with-modern-golang-skills.jsonld"}}