Jetbrains released skills for Claude Code to write modern Go code

2026-02-217:31144blog.jetbrains.com

Developers can now confidently write modern Go code with Junie and Claude Code. We’ve released new guidelines for AI agents to use the latest Go features.

GoLand News

Go developers can now confidently write modern Go code using the AI agents Junie and Claude Code. We at JetBrains have just released a new plugin with guidelines for AI agents that ensure they use the latest features and follow best Go practices compatible with your current version of Go, as specified in go.mod. You can find the relevant GitHub repository at go-modern-guidelines.

With two major releases every year, Go is one of the more frequently updated languages. Yet we’ve found that all AI agents – Junie and Claude Code included – tend to generate obsolete Go code.

The Go team also pointed to that problem in one of their articles: “During the frenzied adoption of LLM coding assistants, we became aware that such tools tended – unsurprisingly – to produce Go code in a style similar to the mass of Go code used during training, even when there were newer, better ways to express the same idea.”

As an example, here’s a sample code snippet of how an agent used a manual loop to find an element in the slice:

// HasAccess checks if the user's role has access to protected resources.
func HasAccess(role string) bool {
    for _, allowed := range allowedRoles {
       if role == allowed {
          return true
       }
    }
    return false
}

There are two main reasons why agents would favor obsolete architecture where cleaner and more idiomatic solutions are available:

  • Data cutoff: Even the most current AI models are trained on time-bound datasets that have a “cutoff” date (for example, for Claude Opus 4.6, that’s May 2025). They will not recognize or suggest features that were introduced after that point, such as those found in the Go 1.26 release.
  • Frequency bias: AI models are primarily trained on open-source codebases that may not be readily updated. It’s natural that such datasets will feature more “old” code than “new”, and since AI models favor alternatives that are more frequent, they will suggest obsolete code as a result.

Just like the Go team, we at GoLand, strive to keep the Go ecosystem modern and idiomatic. So to mitigate the effect of AI agents contributing to this issue, we’ve created a plugin with a set of guidelines for Junie and Claude Code, that helps them generate modern Go code. The plugin automatically recognizes the current version of your Go code (specified in go.mod) and instructs the agent to use corresponding features, such as new(val) instead of x := val; &x or errors.AsType[T](err) instead of errors.As(err, &target) (both introduced in Go 1.26), as well as stdlib additions available up to and including that version.

Here’s the same code sample from before with our guidelines applied, where the agent actually uses the modern slices.Contains() method introduced in Go 1.21.

var allowedRoles = []string{"admin", "moderator", "editor"}

// HasAccess checks if the user's role has access to protected resources.
func HasAccess(role string) bool {
	return slices.Contains(allowedRoles, role)
}

For Junie version 2xx.620.xx or higher, you don’t have to do anything – these guidelines will be applied right out of the box.

If you’re running an older version, go to SettingsPluginsInstalled, find Junie, and then click Update.

If, for some reason, you want to disable these settings, you can do so in SettingsToolsJunieProject SettingsGo. The Provide modern Go guidelines option is enabled by default, so untick the box.

To use these guidelines in Claude Code, run the following commands inside a Claude Code session to install it.

Add this repository as a marketplace:

/plugin marketplace add JetBrains/go-modern-guidelines

Install the plugin:

/plugin install modern-go-guidelines

To activate it, run the following command at the start of a session:

/use-modern-go

Claude Code will then detect the Go version from go.mod and instruct the agent to use modern features compatible with that version.

> /use-modern-go

This project is using Go 1.24, so I'll stick to modern Go best practices

and freely use language features up to and including this version.

If you'd prefer a different target version, just let me know.

After this, any Go code that the agent writes will follow the guidelines.

Happy coding!
The GoLand team

image description

Read the original article

Comments

  • By ostaquet 2026-02-217:311 reply

    I'm currently working on lastclone. It's a tool for backing up my SBOM (Software Bill of Materials), and more specifically the third-party open source libraries that are at risk of disappearing with the advent of AI, or simply if the maintainers decide to shut down the project. As a CTO, it's important to guarantee business continuity and to ensure that the open source projects we use can be easily recovered.

    The lastclone project is written in Go. The version I'm working on is a CLI version. Some parts are developed with Claude Code, but I've run into certain issues.

    The code suggested by Claude Code doesn't take into account the latest developments in Go. There are two main reasons for this.

    First, there's the training data cutoff. Claude Opus 4.6 is the latest release to date, but the training is based on data up to May 2025. Since Go is a language that evolves regularly, the latest features present in 1.25 or 1.26 are not known to the model.

    Second, an LLM model, no matter how good it is, is a statistical model that operates based on its training. In the case of Go, the majority of the codebase used for training was developed on earlier versions. This codebase hasn't necessarily been adapted to the language's new features, and therefore, the model isn't able to use them.

    JetBrains comes to the rescue by publishing yesterday (20-FEB-2026) a plugin for Claude Code that allows it to be "instructed" on the latest best practices of the language. The plugin is well-structured and can detect the version of Go being used based on the go.mod file.

    • By indemnity 2026-02-2119:14

      You can also add golangci-lint with the modernize linter and tell Claude in CLAUDE.md to run it on every code change as an ambulance at the bottom of the cliff.

      Won’t stop Claude from writing “old” style, but it will fix the lint errors.

  • By ctmnt 2026-02-2112:31

    An aside: I find the range of possible meanings of “modern” fascinating. In some contexts it means post-Middle Ages, in some post-Industrial Revolution, in some mid-20th century, and in many (as here) it just means now-ish. (I’m ignoring non-temporal uses of it, which are a whole other thing.) This use, in the OP, is a particularly sharp one, since the JetBrains blog explicitly means in the last 6 to 12 months.

    I looked it up, and apparently the first use of “modern” (well, “modernus”, but who’s counting) to mean “now, when things are up to date, not earlier when things were old fashioned” was in the 6th century CE. [1] And even though in formal contexts modernity is long past, its colloquial use continues to drift along with us.

    Anyway, gotta go tell Claude to get with the times.

    1: https://en.wikipedia.org/wiki/Modernity#Etymology

  • By age123456gpg 2026-02-2111:20

    Related, Using go fix to modernize Go code https://go.dev/blog/gofix

HackerNews