use-modern-go

Applies version-specific modern Go guidelines when writing or refactoring Go code.

Updated Feb 22, 2024
One-click install
npx skills add https://github.com/tlipoca9/dotfiles --skill use-modern-go-tlipoca9
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: use-modern-go
Source: https://github.com/tlipoca9/dotfiles/tree/main/home/dot_agents/skills/use-modern-go
Command: npx skills add https://github.com/tlipoca9/dotfiles --skill use-modern-go-tlipoca9

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires github.com/JetBrains/go-modern-guidelines, and includes scripts (resource) components.

What problem does it solve? Go evolves quickly, and AI knowledge cutoffs often lag behind the latest language idioms. This Skill ensures that any Go code you write, modify, fix, or refactor follows current, version-appropriate best practices by consulting the Modern Go Guidelines CLI as an authoritative source. ## Core Features & Use Cases - Version-Aware Guidance: Resolves the applicable Go version from go.mod, go.work, the local toolchain, or an explicit override, then lists only relevant guidelines. - Two-Step Discovery: Use list to see all applicable guidelines for a file or Go version, then explain specific guideline IDs for detailed examples. - Cross-Platform Wrappers: Ships with shell and PowerShell scripts that automatically install and cache the CLI on first run. - Use Case: Before refactoring a Go service targeting Go 1.24, run the list command against your file to discover modern idioms like sync.WaitGroup.Go or new atomic types, then apply them directly in your edits. ## Quick Start Ask the AI to review or edit a Go file using modern Go guidelines, and it will run the wrapper script's list command for your file before applying the relevant idioms.

Frequently Asked Questions about use-modern-go

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

FAQPage Schema
How do I write modern idiomatic Go code with AI assistance?▼

Run the wrapper script's list subcommand against your Go file before editing. It returns version-specific guidelines from the Modern Go Guidelines CLI, which you then apply to your code changes as authoritative style rules.

How does the tool detect which Go version guidelines apply?▼

The CLI resolves the applicable Go version automatically from go.mod, go.work, or the local Go toolchain. You can also pass an explicit version with the --go-version flag, such as --go-version 1.24.

Does the modern Go guidelines tool work on Windows?▼

Yes, the Skill includes a PowerShell wrapper script (run-tool.ps1) alongside the POSIX shell script. Both accept the same arguments and install the CLI into a local cache directory on first use.

What happens on the first run of the wrapper script?▼

The wrapper installs the go-modern-guidelines CLI at the pinned version into a local cache directory using go install. It verifies the installed binary's version matches the expected one before executing your command.

When should I use explain instead of list?▼

Use list first to discover applicable guideline IDs for your target Go version. Call explain only for specific returned IDs when you need detailed explanations or code examples before deciding whether to apply a guideline.

When should a returned Go guideline be skipped?▼

Skip a guideline only when it would not compile, would change program behavior, or clearly does not match the edited code. Before skipping a seemingly relevant guideline, call explain for its ID to confirm the decision.