go

Refactor and review Go code for idiomatic patterns and standard-library practices.

356|26|Updated Mar 23, 2026
One-click install
npx skills add https://github.com/spf13/go-skills --skill go-spf13
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: go
Source: https://github.com/spf13/go-skills/tree/main/go
Command: npx skills add https://github.com/spf13/go-skills --skill go-spf13

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you write, review, and refactor Go code so it stays simple, readable, maintainable, and aligned with modern Go conventions instead of drifting into over-engineered, Java-style patterns.

Core Features & Use Cases

  • Package and project layout guidance: Organize applications by domain and purpose rather than artificial layers, with clear boundaries and minimal nesting.
  • Idiomatic core language patterns: Apply clear control flow, useful zero values, early returns, concrete types, and well-placed interfaces.
  • Testing and concurrency best practices: Prefer table-driven tests, fakes and stubs, context-aware goroutines, channels, and standard-library-first tooling.
  • Use case: Refactor a Go service that has service/repository/controller layers into a flatter, domain-focused structure with simpler tests, cleaner error handling, and safer concurrency.

Quick Start

Ask for a review or rewrite of your Go code and specify that you want idiomatic package structure, modern stdlib-based patterns, and practical refactoring suggestions.

Frequently Asked Questions about go

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

FAQPage Schema
How do I refactor Go code to avoid Java-style layered architectures?

To refactor Go code away from Java-style layers, reorganize applications by domain and purpose rather than artificial layers, flattening service/repository/controller structures into clear, simple package boundaries with minimal nesting.

What is the best way to structure Go packages for maintainability?

The best way to structure Go packages is by domain-oriented design with clear boundaries, minimal nesting, and useful zero values, avoiding heavy frameworks in favor of standard-library-first APIs.

How do I write idiomatic Go tests with table-driven tests?

Idiomatic Go tests use table-driven tests, fakes, and stubs to ensure simple and maintainable coverage, aligning with standard-library-first tooling rather than heavy mocking frameworks.

Why does my Go concurrency need context-aware goroutines?

Go concurrency needs context-aware goroutines to ensure safe execution, allowing channels and standard-library patterns to manage cancellation and lifecycle cleanly without leaking resources.

How do I handle error wrapping in modern Go applications?

Handle error wrapping in modern Go by requiring clear error wrapping patterns, ensuring simple, readable, and maintainable code that aligns with modern Go conventions rather than over-engineered solutions.

Can I use generics and modern stdlib patterns in legacy Go refactoring?

Yes, you can refactor legacy Go code by applying modern standard-library practices, including generics and HTTP routing, to enforce idiomatic language patterns and flatten domain-focused structures.