Architecture

Define Clean Architecture standards and standard project layouts for Golang applications.

51|6|Updated Mar 28, 2019
One-click install
npx skills add https://github.com/Mte90/dotfiles --skill architecture-mte90
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Architecture
Source: https://github.com/Mte90/dotfiles/tree/main/.config/opencode/skills/golang/architecture
Command: npx skills add https://github.com/Mte90/dotfiles --skill architecture-mte90

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides clear guidelines and standards for structuring Golang projects, ensuring maintainability, scalability, and adherence to best practices like Clean Architecture.

Core Features & Use Cases

  • Clean Architecture Enforcement: Guides the separation of concerns into distinct layers (Domain, Usecase, Adapter).
  • Standard Project Layout: Implements the recommended Go project layout for better organization.
  • Dependency Management: Promotes explicit dependency injection and interface-based design.
  • Use Case: When starting a new Golang microservice, use this Skill to establish a robust and scalable project structure from the outset.

Quick Start

Understand the standard Golang project layout by reviewing the references.

Frequently Asked Questions about Architecture

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

FAQPage Schema
How do I structure a Golang project using Clean Architecture?

Clean Architecture in Golang separates concerns into distinct layers like Domain, Usecase, and Adapter. This approach enforces dependency inversion and interface segregation to ensure maintainability and scalability across your application structure.

What is the recommended standard project layout for a Golang application?

The recommended standard project layout for Golang uses directories like cmd, internal, and pkg. This package-oriented design organizes code effectively, separating executable entry points from internal application logic and reusable public packages.

How do I implement dependency injection in a Golang microservice?

Dependency injection in Golang is implemented through explicit interface-based design. By defining interfaces at the point of use and injecting concrete implementations, you enforce dependency inversion and decouple your core business logic from external adapters.

When do I need to use the cmd, internal, and pkg directories in Go?

You need the cmd, internal, and pkg directories when organizing a Golang project for maintainability. The cmd directory holds main entry points, internal restricts private application code, and pkg exposes reusable public libraries for external import.

Does Domain-Driven Design work with the standard Go project layout?

Domain-Driven Design integrates with the standard Go project layout by structuring project files around domain boundaries. This combination supports package-oriented design and interface segregation, ensuring your architecture aligns with business requirements and Clean Architecture principles.

What is the best way to enforce separation of concerns in Golang applications?

The best way to enforce separation of concerns in Golang is by applying Clean Architecture principles. This involves dividing your codebase into explicit Domain, Usecase, and Adapter layers, which isolates business rules from infrastructure and external frameworks.