
Go Packages
Guidance for structuring Go packages, grouping imports, and avoiding init and os.Exit outside main.
- skills.sh installs
- 1.3K
- GitHub stars
- 196
- last updated
- Aug 21, 2026
Own this skill? Claim it
What it does
- Covers package naming and sizing, import grouping and aliasing, init() avoidance, and exits confined to main
- Includes
references/IMPORTS.mdfor import details andreferences/PACKAGE-SIZE.mdfor splitting packages and CLI flags - Enforces rules such as no util packages, no dot imports outside circular-dependency tests, and a
run()pattern in main - Designed for Go projects starting fresh or splitting a growing codebase, with pointers to go-naming and go-linting for adjacent concerns
Install
$ npx -y skills add cxuu/golang-skills --skill go-packages -yInstalls into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.
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
Details
- Repository
- github.com/cxuu/golang-skills
- Categories
- Go, Code Review & Quality
- First seen
- May 16, 2026
More from cxuu/golang-skills
All 20- Go Functional Options1.3K
- Go Data Structures1.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.4K
- Go Concurrency1.4K
- Go Linting1.4K
- Go Interfaces1.4K
- Go Documentation1.3K
- Go Style Core1.3K
- Go Performance1.3K
- Go Context1.3K
- Go Naming1.3K
- Go Defensive1.3K
Similar to Go Packages
More Go
go-namingcxuu/golang-skills1.3K installsGo naming rules for packages, types, functions, variables, and receivers, with a checker script and reference docs.
go-documentationcxuu/golang-skills1.3K installsStructured guide for writing Go doc comments, with a validation script for exported symbols and package comments.
golang-project-layoutsamber/cc-skills-golang42.5K installsGo project layout and workspace guide covering cmd, internal, and pkg conventions, module naming, and go.work setup.
golang-design-patternssamber/cc-skills-golang44.3K installsIdiomatic Go design patterns covering constructors, error flow, lifecycle, and architecture choices for production code.
python-project-structurewshobson/agents15.6K installsOpinionated guide for Python project layout, module cohesion, and explicit public APIs with __all__.