# Go modernize

> Go modernize is an open-source agent skill for developer tools. Guides an agent to modernize Go code with newer language and stdlib features. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf, Goose
- **Website:** https://github.com/eduardo-sl/go-agent-skills/tree/main/skills/(code-quality)/go-modernize
- **Repository:** https://github.com/eduardo-sl/go-agent-skills
- **GitHub stars:** 90
- **License:** MIT
- **Skill name:** go-modernize
- **Collection:** https://github.com/eduardo-sl/go-agent-skills
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-12-02

## About

Go Modernize helps an agent update existing Go code to use features added between Go 1.21 and 1.27, such as generics, log/slog, errors.Join, the slices and maps packages, iterators, and the stdlib uuid package. It works incrementally: the agent first checks the go directive in go.mod, since it should never adopt a feature newer than that version, and raising the directive is treated as a separate change with its own breakage checklist.

The skill walks the agent through a procedure that runs the official Go modernizers first (go fix on Go 1.26 and later, or the modernize analyzer on older toolchains) and then applies judgment-based migrations such as replacing interface{} with type parameters or replacing log calls with structured slog output. It defines three modes: inline changes limited to lines already being edited, a version bump mode, and a sweep mode that splits work into one commit per category.

It expects a Go project with the Go toolchain installed, and gopls is optional for the modernize analyzer. The agent is expected to run the build and test suite after each group of changes. Detailed before-and-after examples are kept in reference files that the agent loads only when needed.

## When your agent uses it

> Modernize Go code to use current language features and standard library additions, Go 1.21 through 1.27: generics and generic methods, log/slog, errors.Join, slices/maps, iterators, encoding/json/v2, stdlib uuid. Use when: "modernize", "update to modern Go", "use generics", "replace interface{}", "upgrade Go version", "slog", "errors.Join", "range over func", "iterators". Not for: general style (go-coding-standards), error philosophy (go-error-handling), logging architecture (go-observability).

## What it can access

From a static check of the files on GitHub; nothing was run.

- [Instructions only, no scripts](https://github.com/eduardo-sl/go-agent-skills/tree/HEAD/skills/(code-quality)/go-modernize)
- [Asks for: Read, Edit, Write, Glob, Grep, Bash(go:*), Bash(gofmt:*), Bash(golangci-lint:*)…](https://github.com/eduardo-sl/go-agent-skills/blob/HEAD/skills/(code-quality)/go-modernize/SKILL.md)
- [License: MIT](https://github.com/eduardo-sl/go-agent-skills/tree/HEAD/skills/(code-quality)/go-modernize)

## Features

- **Incremental modernization workflow:** Checks the go.mod directive first and applies changes in small, buildable steps.
- **Official modernizer integration:** Runs go fix or the modernize analyzer to apply mechanical migrations automatically.
- **Version-by-version feature table:** Lists which replacements apply from Go 1.13 through Go 1.27.
- **Go version bump checklist:** Covers prerequisites and per-release breakage checks before raising the go directive.
- **Priority-ordered changes:** Ranks correctness and security fixes above readability and gradual migrations.

## Good for

- Replace interface{} helpers with generics in a Go package
- Convert log.Printf calls to structured log/slog output
- Swap manual error accumulation for errors.Join
- Replace hand-written slice and map loops with the slices and maps packages
- Raise the go directive in go.mod and check for breakage

## Install

### Any agent

Download the skill folder from https://github.com/eduardo-sl/go-agent-skills and copy it into your agent's skills folder.

## FAQ

### Which tools does the skill need?

It needs the Go toolchain. gopls is optional and is used for the modernize analyzer.

### Will Go modernize change the go version in go.mod?

No. Raising the go directive is a separate version bump mode that the skill handles only deliberately, in its own commit.

### Does Go modernize change every file in a project at once?

By default, inline mode only modernizes lines already being changed. A full sweep is done only when asked and is split into one commit per category.

### Does Go modernize run scripts?

No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

### Which AI agents can use Go modernize?

Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose. Each reads skills in the SKILL.md format from its own folder; the install steps on this page list them.

### What are the best alternatives to Go modernize?

The closest alternatives to Go modernize are Go refactoring, Go dependency audit, Axiom modernize, Java upgrade and Modern cpp.

## Where this comes from

- Description: from the skill's own SKILL.md.

## Alternatives

- [Go refactoring](https://ai-powered.com/skills/go-refactoring): Go refactoring is an open-source agent skill for developer tools.
- [Go dependency audit](https://ai-powered.com/skills/go-dependency-audit): Go dependency audit is an open-source agent skill for security.
- [Axiom modernize](https://ai-powered.com/skills/axiom-modernize): Axiom modernize is an open-source agent skill for developer tools.
- [Java upgrade](https://ai-powered.com/skills/java-upgrade): Java upgrade is an open-source agent skill for developer tools.
- [Modern cpp](https://ai-powered.com/skills/modern-cpp): Modern cpp is an open-source agent skill for developer tools.
- [Go semantic tools](https://ai-powered.com/skills/go-semantic-tools): Go semantic tools is an open-source agent skill for developer tools.
- [Go documentation](https://ai-powered.com/skills/go-documentation): Go documentation is an open-source agent skill for developer tools.
- [Doc and modernize](https://ai-powered.com/skills/doc-and-modernize): Doc and modernize is an open-source agent skill for files and documents.

---
Source: https://ai-powered.com/skills/go-modernize
