roninforge/roninforge-go/go-modernize
Claude Code and agent skill by roninforge/roninforge-go
- community
Checking that the SKILL.md file is still in the repository.
Migrate older Go code to 1.22+ idioms: ioutil -> io/os, log.Println -> slog, interface{} -> any, manual mux routing -> http.ServeMux method patterns, drop v := v shadow, math/rand -> math/rand/v2.
Install
npx vskill@latest install roninforge/roninforge-go/go-modernizeSKILL.md
The same SKILL.md was published earlier as roninforge/roninforge-go/go-modernize.
Modernize Go to 1.22+
When to Use
When inheriting or auditing a Go codebase that predates 1.22 patterns, or when an AI-generated codebase uses outdated idioms.
Instructions
Apply each transformation in order. Run go build ./... and go test ./... after each step.
Step 1: Bump Go version
In go.mod:
Set this to the lowest version the project will support. go 1.22 minimum for the patterns in this skill.
Step 2: ioutil -> io / os
Replace:
ioutil.ReadAll(r)->io.ReadAll(r)ioutil.ReadFile(p)->os.ReadFile(p)ioutil.WriteFile(p, b, mode)->os.WriteFile(p, b, mode)ioutil.TempFile(...)->os.CreateTemp(...)ioutil.TempDir(...)->os.MkdirTemp(...)ioutil.NopCloser(r)->io.NopCloser(r)ioutil.Discard->io.Discard
Then remove the import.
Step 3: interface{} -> any
Review each change. interface{} may legitimately appear in generated code; do not touch generated files (*_gen.go, *.pb.go).
Step 4: log -> slog
Replace package-level log calls:
At the top of main:
log.Fatal is the worst offender - it calls os.Exit(1) which skips deferred funcs. Always replace with a returned error.
Step 5: Routing -> http.ServeMux method patterns (1.22+)
If the codebase has a hand-rolled router or third-party (mux.Router, chi.Router) and the routing is simple, port to stdlib:
If the project uses middleware chains or wildcards, leave the existing router and apply other rules.
Step 6: Drop unnecessary loop-variable shadowing
In 1.22+, for _, v := range items creates a fresh v each iteration. The v := v shadow is unnecessary.
Remove the shadow line.
Step 7: math/rand -> math/rand/v2
For non-cryptographic randomness:
For cryptographic randomness (tokens, passwords, IDs), use crypto/rand:
Never use math/rand for security-sensitive randomness.
Step 8: Error wrapping
Use the go-error-wrap skill for this step.
Step 9: Verify
If a third-party linter is available, also run golangci-lint run.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/go-modernize/SKILL.md
Popularity
- 7-day trend score
- 5
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/roninforge/roninforge-go/go-modernize)