{"slug": "skills-for-writing-modern-go-code", "title": "Skills for writing modern Go code", "summary": "JetBrains released a set of guidelines for code agents to write modern Go code, covering features from Go 1.0 through 1.27, including Go 1.26 additions like `new(42)` and `errors.AsType[T]`. The guidelines, available for Junie, Claude Code, Codex, and Cursor, aim to counter training data lag and frequency bias that cause agents to generate outdated Go code. They align with the Go team's `modernize` analyzer and require Go 1.25 or newer.", "body_md": "This repository contains [guidelines](https://github.com/JetBrains/go-modern-guidelines/blob/main/plugin/skills/use-modern-go/SKILL.md) for code agents that help them write modern Go code.\n\nFor example, an agent with these guidelines uses `max(a, b)`\n\ninstead of an if-else block, `slices.Contains`\n\ninstead of a manual loop, `cmp.Or(a, b, c)`\n\ninstead of a chain of nil checks. It also knows about recent additions like `new(42)`\n\nto get a pointer to a value and `errors.AsType[T](err)`\n\nfor type-safe error matching—both from Go 1.26.\n\nThe guidelines cover the most useful features from Go 1.0 through Go 1.27, including everything targeted by the `modernize`\n\nanalyzer. An agent will:\n\n- Detect the project's Go version from\n`go.mod`\n\n- Use language features and stdlib additions available up to and including that version\n- Prefer modern idioms over older patterns\n\nAll coding agents tend to generate outdated Go. Two reasons:\n\n-\n**Training data lag.** Models don't know about features added after their training cutoff. They can't use`errors.AsType[T]`\n\n(Go 1.26) if they've never seen it. -\n**Frequency bias.** Even for features the model knows, it often picks older patterns. There's more`for i := 0; i < n; i++`\n\nin the training data than`for i := range n`\n\n, so that's what comes out.\n\nThese guidelines fix both problems by giving the agent an explicit reference.\n\nThis aligns with the Go team's direction. The `modernize`\n\nanalyzer exists to automatically update existing code to use newer idioms (see [this talk](https://www.youtube.com/watch?v=_VePjjjV9JU) from the Go team). These guidelines serve the same goal for new code: agents write modern Go from the start, so there's less to fix later.\n\nThe marketplace integrations run a small CLI that is installed on first use with `go install`\n\n. Because of that, the [Go toolchain](https://go.dev/dl/) must be installed and available on your `PATH`\n\n.\n\nThe CLI is installed into a local cache (for example `~/.cache/go-modern-guidelines`\n\n) and never modifies your project. It targets **Go 1.25 or newer**; on an older Go it still works as long as automatic toolchain switching is enabled (`GOTOOLCHAIN=auto`\n\n, the default), which lets Go fetch a compatible toolchain on first run.\n\nThe guidelines are available for Junie, Claude Code, Codex, and Cursor, and for other agents via skills.sh.\n\nRun the following commands inside a Junie CLI session.\n\n- Add this repository as a marketplace:\n\n```\n/extensions marketplace add JetBrains/go-modern-guidelines\n```\n\n- Install the extension:\n\n```\n/extensions install modern-go-guidelines\n```\n\nJunie invokes the skill automatically when it is relevant to a Go task.\n\nUpdate the installed extension from inside a Junie CLI session:\n\n```\n/extensions update modern-go-guidelines\n```\n\nRun the following commands inside a Claude Code session.\n\n- Add this repository as a 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@goland-claude-marketplace\n```\n\nClaude Code invokes the skill automatically when it is relevant to a Go task.\n\nTo invoke it explicitly:\n\n```\n/modern-go-guidelines:use-modern-go\n```\n\nClaude Code can update the marketplace and installed plugin automatically at startup. Automatic updates are disabled by default for third-party marketplaces, so enable them once:\n\n- Run\n`/plugin`\n\n. - Open\n**Marketplaces** and select`goland-claude-marketplace`\n\n. - Select\n**Enable auto-update**.\n\nWhen Claude Code reports that the plugin was updated, apply the new version to the current session with:\n\n```\n/reload-plugins\n```\n\nTo update it manually instead, run these commands in a terminal:\n\n```\nclaude plugin marketplace update goland-claude-marketplace\nclaude plugin update modern-go-guidelines@goland-claude-marketplace\n```\n\nRun the following commands in a terminal.\n\n- Add this repository as a marketplace:\n\n```\ncodex plugin marketplace add JetBrains/go-modern-guidelines\n```\n\n- Install the plugin:\n\n```\ncodex plugin add modern-go-guidelines@goland-codex-marketplace\n```\n\nRefresh the marketplace and reinstall the plugin so Codex replaces its cached copy:\n\n```\ncodex plugin marketplace upgrade goland-codex-marketplace\ncodex plugin remove modern-go-guidelines@goland-codex-marketplace\ncodex plugin add modern-go-guidelines@goland-codex-marketplace\n```\n\nFor convenience, the guidelines are distributed as a Cursor plugin.\n\n- Add this repository as a marketplace by running the following command in a terminal:\n\n```\ncursor-agent plugin marketplace add https://github.com/JetBrains/go-modern-guidelines\n```\n\n- Install the plugin with the\n`/plugins`\n\ncommand inside a Cursor session.\n\nRefresh the marketplace from Git and reopen Cursor so it can pick up the new plugin version:\n\n```\ncursor-agent plugin marketplace update goland-cursor-marketplace\n```\n\nIf the installed plugin is still on the previous version, reinstall it with the `/plugins`\n\ncommand. Cursor does not currently provide a non-interactive CLI command for updating an installed plugin.\n\n### Other Agents (via [skills.sh](https://skills.sh))\n\nThe same skill package works across other agents such as OpenCode. Install it with:\n\n```\nnpx skills add JetBrains/go-modern-guidelines\n```\n\n(`--skill use-modern-go`\n\ninstalls only this skill.)\n\nUpdate the project-installed skill with:\n\n```\nnpx skills update use-modern-go -p -y\n```\n\nFor a globally installed skill, replace `-p`\n\nwith `-g`\n\n.\n\nTo try changes to the CLI in your agent, build this checkout into the tool's cache:\n\n```\nmake dev-install\n```\n\nThen set `GO_MODERN_GUIDELINES_DEV=1`\n\nin the environment your agent runs in. With it set, any agent using the plugin runs your local build instead of the released version, the same way across Claude Code, Codex, and Cursor. Export it before launching the agent so the agent process inherits it:\n\n```\nexport GO_MODERN_GUIDELINES_DEV=1\n```\n\nAfter editing the CLI, run `make dev-install`\n\nagain to rebuild; the next call picks it up. To go back to the released version, unset the variable (or run `make dev-uninstall`\n\nto remove the build):\n\n```\nmake dev-uninstall\n```\n\nThis requires the Go toolchain. The dev build is stored in the tool's cache directory (`$XDG_CACHE_HOME/go-modern-guidelines`\n\nor `~/.cache/go-modern-guidelines`\n\n).\n\nThe build is driven by `scripts/dev-install.sh`\n\n, which is intentionally separate from the agent-facing wrapper so an agent can never trigger a build. Without `make`\n\n(for example on Windows) you can run it directly:\n\n```\nsh scripts/dev-install.sh install       # or: uninstall\npwsh scripts/dev-install.ps1 install    # PowerShell equivalent\n```\n\n", "url": "https://wpnews.pro/news/skills-for-writing-modern-go-code", "canonical_source": "https://github.com/JetBrains/go-modern-guidelines", "published_at": "2026-08-28 09:54:44+00:00", "updated_at": "2026-08-28 10:18:39.310558+00:00", "lang": "en", "topics": ["developer-tools", "artificial-intelligence", "large-language-models"], "entities": ["JetBrains", "Go", "Junie", "Claude Code", "Codex", "Cursor"], "alternates": {"html": "https://wpnews.pro/news/skills-for-writing-modern-go-code", "markdown": "https://wpnews.pro/news/skills-for-writing-modern-go-code.md", "text": "https://wpnews.pro/news/skills-for-writing-modern-go-code.txt", "jsonld": "https://wpnews.pro/news/skills-for-writing-modern-go-code.jsonld"}}