go-packages

Organize Go packages and imports according to Google's and Uber's style guides.

Updated Apr 16, 2026
One-click install
npx skills add https://github.com/HadiCherkaoui/opencode-config --skill go-packages-hadicherkaoui
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: go-packages
Source: https://github.com/HadiCherkaoui/opencode-config/tree/main/skills/golang/go-packages
Command: npx skills add https://github.com/HadiCherkaoui/opencode-config --skill go-packages-hadicherkaoui

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Go projects often struggle with organizing packages, choosing meaningful package names, and managing imports and dependencies in a way that scales across teams. This skill presents guidance from Google's and Uber's Go style guides to help structure code, improve readability, and prevent import conflicts.

Core Features & Use Cases

  • Package Organization: guidance on creating cohesive, purpose-driven packages with descriptive names rather than generic ones.
  • Import Management: best practices for import groups, renaming, blank imports, and avoiding dot imports; recommended lintable patterns.
  • Init and Run-time Considerations: advice on avoiding init where possible, and deterministic patterns when initialization is necessary.

Quick Start

Follow these guidelines to structure a new Go module and refactor existing packages to align with the recommended naming, grouping, and init usage.

Frequently Asked Questions about go-packages

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

FAQPage Schema
How do I organize Go packages and imports according to style guides?

To organize Go packages and imports, group them by standard, external, and local paths while choosing descriptive package names. Apply structured rules from Google and Uber style guides to improve codebase readability and prevent import conflicts.

What is the best way to name Go packages for client libraries?

The best way to name Go packages is to choose descriptive, purpose-driven names rather than generic ones. Style guide guidance helps structure cohesive client libraries that scale across teams and prevent naming conflicts.

Why should I avoid init functions in Golang projects?

You should avoid init functions in Golang to ensure deterministic initialization practices. Style guides recommend avoiding init where possible to prevent hidden side effects and make dependency management predictable.

Can I use these Go coding standards for existing codebase refactors?

Yes, you can use these Go coding standards for existing codebase refactors. The guidelines apply to both new projects and refactoring existing packages to align import grouping, naming, and initialization patterns with recommended practices.

What are the recommended import grouping patterns in Go?

Recommended import grouping patterns in Go separate standard library, external, and local imports into distinct blocks. Lintable patterns from style guides help manage dependencies, renaming, and blank imports to improve readability and prevent conflicts.