golang-project-layout

Organize Go projects into size-aware directory layouts for CLI tools, libraries, services, and monorepos.

5|1|Updated Apr 14, 2026
One-click install
npx skills add https://github.com/omarluq/og-template --skill golang-project-layout-omarluq
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: golang-project-layout
Source: https://github.com/omarluq/og-template/tree/main/.agents/skills/golang-project-layout
Command: npx skills add https://github.com/omarluq/og-template --skill golang-project-layout-omarluq

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) and assets (resource) components.

What problem does it solve?

Go project structure often lacks consistency, leading to confusion and maintenance overhead. This Skill provides pragmatic guidance to tailor a project layout to size, type, and goals, preventing over- or under-structuring.

Core Features & Use Cases

  • Guidance for common Go project types (CLI tools, libraries, services, monorepos) and when to choose each.
  • Clear directory layout recommendations (cmd/, internal/, pkg/, configs/, scripts/), module naming rules, and workspace considerations.
  • Practical decision points for architecture, dependency injection, testing layout, and Go workspaces.

Quick Start

Choose your project type (CLI, library, or service), then apply the recommended layout by organizing main entry points under cmd/, private code under internal/, and reusable APIs under pkg/ along with configs and scripts.

Frequently Asked Questions about golang-project-layout

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

FAQPage Schema
How do I structure a Go project for maintainability and scale?

Structure Go projects by placing main entry points under cmd/, private code under internal/, and reusable APIs under pkg/, while adding configs and scripts to support maintainable, scalable code.

What is the best way to organize a Golang monorepo?

Organize a Golang monorepo by applying size-aware directory layouts, using Go workspaces, and enforcing module naming and separation of concerns to manage private versus public code across multiple services.

When should I use the internal directory vs pkg in a Go project?

Use the internal directory for private code you want to restrict from external imports, and use pkg for your reusable public APIs, enforcing clear separation of concerns within your Go project layout.

Does my Go CLI tool need a complex directory structure?

A Go CLI tool should use a size-aware directory layout to prevent over-structuring, typically requiring only cmd/ for entry points and internal/ for private logic unless it scales significantly.

How do I set up test layouts in a Golang project?

Set up Golang test layouts by aligning tests with your directory structure decisions, ensuring testing layout supports maintainable code and clear separation of concerns across cmd, internal, and pkg directories.