
Go Packages
This covers the structural decisions you make when organizing Go code: when to split packages, how to group imports, whether that init() is actually necessary, and where os.Exit belongs (spoiler: only in main). It's opinionated in the right ways, like telling you to avoid util packages and generic names that obscure meaning. The package sizing guidance is genuinely helpful, with a table that asks whether you can describe the package purpose in one sentence. Also includes the run() pattern for CLI tools and flags in snake_case, which catches people off guard if they're coming from other languages. Draws from Google and Uber style guides, so it's not just someone's blog post preferences.
- skills.sh installs
- 1.3K
- GitHub stars
- 193
- last updated
- Aug 21, 2026
Install
$ npx -y skills add cxuu/golang-skills --skill go-packages --agent claude-codeInstalls into .claude/skills of the current project.
Files
Go Packages and Imports
Resource Routing
references/IMPORTS.md- Read when grouping imports, using blank imports, dot imports, or import aliases.references/PACKAGE-SIZE.md- Read when splitting packages, avoidinginit, structuringmain, or designing CLI flags/subcommands.
When this skill does NOT apply: For naming individual identifiers within a package, see go-naming. For organizing functions within a single file, see go-functions. For configuring linters that enforce import rules, see go-linting.
Package Organization
Avoid Util Packages
Package names should describe what the package provides. Avoid generic names
like util, helper, common — they obscure meaning and cause import
conflicts.
// Good: Meaningful package names
db := spannertest.NewDatabaseFromFile(...)
_, err := f.Seek(0, io.SeekStart)
// Bad: Vague names obscure meaning
db := test.NewDatabaseFromFile(...)
_, err := f.Seek(0, common.SeekStart)
Generic names can be used as part of a name (e.g., stringutil) but should
not be the entire package name.
Package Size
Sponsors
Details
- Repository
- github.com/cxuu/golang-skills
- Categories
- Code Review & Quality, Go
- First seen
- May 16, 2026
More from cxuu/golang-skills
All 20- Go Data Structures1.3K
- Go Functional Options1.3K
- Go Control Flow1.3K
- Go Logging1.1K
- Go Functions1.1K
- Go Generics1.1K
- Go Declarations1.1K
- Go Code Review1.8K
- Go Testing1.4K
- Go Error Handling1.3K
- Go Linting1.3K
- Go Concurrency1.3K
- Go Interfaces1.3K
- Go Documentation1.3K
- Go Style Core1.3K
- Go Performance1.3K
- Go Context1.3K
- Go Naming1.3K
- Go Defensive1.3K