go-project-layout

Organize Go projects into cmd/, internal/, and pkg/ directories.

Updated Jan 16, 2026
One-click install
npx skills add https://github.com/davzucky/lazygitlab --skill go-project-layout
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: go-project-layout
Source: https://github.com/davzucky/lazygitlab/tree/main/.opencode/skills/go-project-layout
Command: npx skills add https://github.com/davzucky/lazygitlab --skill go-project-layout

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This skill helps enforce idiomatic Go project structure, preventing common pitfalls like disorganized code and non-standard directory layouts.

Core Features & Use Cases

  • Enforces internal/ and pkg/ usage: Guides where to place application-specific versus public API code.
  • Minimal cmd/: Ensures entrypoints are thin and orchestration is moved to internal/app.
  • Use Case: When starting a new Go project or refactoring an existing one, use this skill to ensure a clean, maintainable, and standard directory layout from the outset.

Quick Start

Apply the go-project-layout skill to organize the current Go project directory.

Frequently Asked Questions about go-project-layout

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

FAQPage Schema
What is the standard Go project structure for organizing code?

The standard Go project structure organizes code into `cmd/` for entrypoints, `internal/` for application-specific code, and `pkg/` for public API code. This ensures a clean, maintainable, and idiomatic directory layout based on visibility and purpose.

How do I organize a Golang project to separate internal code from public packages?

To organize a Golang project, place private application code inside the `internal/` directory to restrict external imports, and use the `pkg/` directory for code that is safe to be imported by other projects. This skill validates your structure against these conventions.

When should I use the internal directory in my Go code organization?

You should use the `internal/` directory in your Go code organization when you need to enforce application-specific boundaries and prevent external projects from importing your private packages. It keeps entrypoints thin by moving orchestration to `internal/app`.

What's the best way to structure a Go project when starting a new application?

The best way to structure a new Go project is to apply an internal-first layout using `cmd/`, `internal/`, and `pkg/` directories. This ensures minimal entrypoints and standard visibility practices from the outset, preventing disorganized code.

Does my Go project need a pkg directory if all code is application-specific?

If all code is application-specific, your Go project may not need a `pkg/` directory. You can keep everything within `internal/` to strictly enforce visibility and prevent external imports, ensuring your directory layout remains idiomatic and secure.