go-clean-architecture

Structure Go applications into domain, application, and infrastructure layers.

Updated Oct 29, 2025
One-click install
npx skills add https://github.com/billybbuffum/budget --skill go-clean-architecture
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: go-clean-architecture
Source: https://github.com/billybbuffum/budget/tree/main/.claude/skills/go-clean-architecture
Command: npx skills add https://github.com/billybbuffum/budget --skill go-clean-architecture

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Go projects often struggle with maintaining a clear separation of concerns as codebases grow. This Skill provides expert guidance on implementing a true Clean Architecture in Go, clarifying how to organize domain, application, and infrastructure layers to keep business rules independent from frameworks and external details.

Core Features & Use Cases

  • Clear Layered Boundaries: Domain models and business logic live in internal/domain, with outer layers depending inward.
  • Dependency Rule Enforcement: Outer layers depend on inner domain interfaces only, preventing leakage of framework concerns.
  • Practical Patterns: Concrete Go code samples and guidance for entities, repositories, and services across the three layers.
  • Use Case: A Go microservice evolves its domain layer without touching HTTP or persistence code, simplifying testing and maintenance.

Quick Start

Create a new Go module, then structure your code as internal/domain (domain models and interfaces), internal/application (services and use cases), and internal/infrastructure (concrete persistence and adapters). Wire everything in a minimal main.go to bootstrap the application.

Frequently Asked Questions about go-clean-architecture

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

FAQPage Schema
How do I structure a Go project using clean architecture?

Structure your Go project using clean architecture by organizing code into internal/domain for models, internal/application for services, and internal/infrastructure for persistence. This isolates business logic from frameworks and external details.

What is the dependency rule in Go clean architecture?

The dependency rule in Go clean architecture requires outer layers to depend only on inner domain interfaces. This prevents framework and persistence concerns from leaking into the core business logic.

How do I isolate business logic from frameworks in Go?

Isolate business logic from frameworks in Go by placing domain models and rules in an inner layer, using interface-based dependencies for outer layers. This allows swapping HTTP or persistence code without altering core logic.

Can I use clean architecture for a Go microservice?

Yes, you can use clean architecture for a Go microservice. It enforces distinct domain, application, and infrastructure layers, allowing the domain layer to evolve independently without touching HTTP or persistence code.

When should I not use clean architecture in Go?

Avoid clean architecture in Go for small, simple scripts or prototypes where the overhead of distinct domain, application, and infrastructure layers outweighs the benefit of separating concerns.