golang-project-layout

Generate Go project directory layouts for commands, internal code, and modules.

1|Updated May 26, 2026
One-click install
npx skills add https://github.com/tokiou/caba-inseguridad-v2-be --skill golang-project-layout-tokiou
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: golang-project-layout
Source: https://github.com/tokiou/caba-inseguridad-v2-be/tree/main/.claude/skills/golang-project-layout
Command: npx skills add https://github.com/tokiou/caba-inseguridad-v2-be --skill golang-project-layout-tokiou

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

It prevents wasted time and confusion by helping you organize a Go codebase with the right directory layout for your project type and growth path.

Core Features & Use Cases

  • Architecture-first structuring: Encourages asking the developer for the desired architecture so the layout matches real complexity instead of forcing patterns early.
  • Clean separation of concerns: Guides where to place cmd/ entry points versus internal/ or pkg/ business logic and reusable code.
  • Module and workspace conventions: Covers go.mod module naming and when to use go.work for multi-module development.
  • Operational readiness: Recommends essential root files (Makefile, .gitignore, golangci-lint config), testing co-location rules, and 12-Factor app conventions for services.
  • Use cases: Starting a new Go project, organizing an existing codebase, setting up a monorepo, creating multi-binary CLI/service/migration setups, and deciding between cmd/, internal/, and pkg/.

Quick Start

Ask an AI: "Generate a Go project directory layout for a new HTTP service with a CLI admin command and database migrations, using module naming that matches my repo URL and keeping cmd/ minimal."

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 layout to separate cmd entry points from internal business logic?

A Go project layout separates cmd entry points from internal business logic by keeping minimal executable code in cmd/ and placing private application code in internal/ to prevent external imports.

What is the difference between internal and pkg directories when organizing a Go codebase?

The internal directory enforces private package boundaries restricting external imports, whereas the pkg directory exposes reusable public libraries intended for external consumption across different modules.

When do I need a go.work file for a multi-module Go monorepo?

You need a go.work file for a multi-module Go monorepo when developing multiple local modules simultaneously, allowing the workspace to resolve dependencies locally without modifying go.mod files.

What is the best way to name Go modules in go.mod for a new HTTP service?

The best way to name Go modules in go.mod is matching your repository URL, ensuring import paths remain consistent and publicly accessible when structuring commands and reusable libraries.

How do I configure root files for a Go project to follow 12-Factor app conventions?

To configure root files for 12-Factor app conventions, include a Makefile, .gitignore, and golangci-lint configuration while co-locating tests with source code to maintain operational readiness.