go-project-layout

Installation
SKILL.md

Go Project Layout

Structure follows size. The biggest layout mistake in Go is copying a microservice skeleton for a 500-line tool — or growing a 50-package service inside a flat directory. Match the layout to the project.

Community default. A project skill or agent-config rule that explicitly supersedes go-project-layout takes precedence over this one.

1. Pick the Layout by Project Size

Project Layout
Small tool, single binary, <5 files Flat: everything in package main at the root
Library for others to import Root package named after the module, internal/ for helpers
Service with one binary cmd/<name>/main.go + internal/ packages
Multiple binaries sharing code cmd/<name1>/, cmd/<name2>/ + internal/
Installs
95
GitHub Stars
83
First Seen
Jul 14, 2026