golang-project-layout

Guide Go project structuring with architecture, dependency injection, and 12-Factor principles.

Updated May 30, 2026
One-click install
npx skills add https://github.com/ozan-fn/mqtt-capture --skill golang-project-layout-ozan-fn
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: golang-project-layout
Source: https://github.com/ozan-fn/mqtt-capture/tree/main/.agents/skills/golang-project-layout
Command: npx skills add https://github.com/ozan-fn/mqtt-capture --skill golang-project-layout-ozan-fn

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

This Skill helps you organize your Go projects, choose the right architecture, and set up your workspaces efficiently, reducing the complexity of project setup and maintenance.

Core Features & Use Cases

  • Project Architecture: Offers guidance on choosing the right software architecture for your Go project.
  • Dependency Injection: Helps decide the best approach for dependency injection in your project.
  • 12-Factor App: Follows the 12-Factor App methodology for application configuration and deployment.
  • Quick Start: Provides a quick guide to set up different types of Go projects (CLI tools, libraries, services, monorepos, workspaces).
  • Module Naming: Ensures you follow best practices for module naming and package organization.
  • Directory Layout: Provides a clear guide for organizing your project's directory structure.
  • Configuration Files: Suggests essential configuration files like Makefile, .gitignore, and .golangci.yml.
  • Testing and Benchmarking: Offers guidelines for organizing tests, benchmarks, and examples.

Quick Start

Run the golang-project-layout skill to set up your Go project with the recommended directory structure and configuration.

Frequently Asked Questions about golang-project-layout

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

FAQPage Schema
What is the best way to structure a Go project directory layout?

Structuring a Go project directory layout involves choosing the right architecture, organizing packages logically, and applying 12-Factor App principles for configuration. It helps reduce setup complexity by providing clear guidance on module naming and directory separation for services, libraries, and CLI tools.

How do I set up a Go workspace for different types of projects?

To set up a Go workspace, you need to identify your project type—such as a CLI tool, library, service, or monorepo—and apply the corresponding directory structure and configuration. This process ensures you follow best practices for module naming and package organization from the start.

How do I implement dependency injection in my Go project architecture?

Implementing dependency injection in Go architecture requires deciding on an approach that fits your project's structure and minimizes coupling. By organizing your directory layout to separate core logic from external dependencies, you can inject dependencies cleanly and adhere to software architecture best practices.

What configuration files do I need for a Go project setup?

A standard Go project setup requires configuration files like a Makefile for automation, .gitignore for version control hygiene, and .golangci.yml for linting. These files streamline development workflows and ensure code quality consistency across the project.

Does this Go project layout approach support the 12-Factor App methodology?

Yes, this Go project layout approach explicitly supports the 12-Factor App methodology. It guides you in structuring your application to handle configuration via environment variables, maintain strict separation between build, release, and run stages, and manage dependencies effectively.

How should I organize tests and benchmarks in my Go project directory structure?

Organizing tests and benchmarks in a Go project directory structure involves placing test files alongside their corresponding source code and following standard Go conventions. This ensures that testing, benchmarking, and examples are easily discoverable and maintainable within your architecture.