golang-modernize

Modernize Go code to idiomatic patterns for Go 1.21 through 1.26 targets.

2|Updated Feb 12, 2024
One-click install
npx skills add https://github.com/adibfirman/dotfiles --skill golang-modernize-adibfirman
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: golang-modernize
Source: https://github.com/adibfirman/dotfiles/tree/main/claude/.claude/skills/technical/golang/golang-modernize
Command: npx skills add https://github.com/adibfirman/dotfiles --skill golang-modernize-adibfirman

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

It resolves outdated Go patterns by updating code to current language features, standard-library improvements, and more idiomatic, safer designs.

Core Features & Use Cases

  • Go-version-aware modernization: Suggests changes aligned with Go 1.21–1.26 and avoids features that aren’t available for the project’s configured Go version.
  • Safety-first refactors: Prioritizes correctness and security-impacting fixes (e.g., vulnerability-oriented checks and safer path handling) before readability improvements.
  • Tool-assisted and CI-friendly review: Guides modernization using checks like golangci-lint (modernize linter) and supports full-codebase scans for explicit invocations.

Quick Start

Ask an agent to run golang-modernize on your repository and propose a prioritized set of Go modernizations based on the go.mod version.

Frequently Asked Questions about golang-modernize

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I modernize Go code to use newer standard library features and safer idioms?

You modernize Go code by replacing outdated language patterns and standard-library usage with newer idiomatic equivalents. The process applies safety-first refactors to prioritize correctness and security-impacting fixes before readability improvements across your files.

Can I use golangci-lint to guide Go code modernization for my project?

Yes, golangci-lint modernize checks can optionally integrate with the process. It guides refactors by detecting outdated patterns and supports full-codebase scans for explicit invocations while constraining changes to your active development context.

Does Go modernization support version-aware refactoring for older Go versions?

Go modernization is version-aware, suggesting changes aligned with Go 1.21 through 1.26 targets. It avoids recommending language features or standard-library improvements that are not available for your project's configured version in go.mod.

What is the safest way to upgrade Go idioms across a large codebase?

The safest way to upgrade Go idioms is using a safety-first refactor approach that prioritizes correctness and vulnerability-oriented checks, such as safer path handling. It skips previously ignored items in .modernize and constrains changes to your active context.

What are the limitations of automated Go code modernization?

Limitations include avoiding features unavailable for your configured Go version and skipping items explicitly ignored in your .modernize file. It also constrains proposed changes to the developer's active context to prevent unintended modifications across the codebase.