go-clean-architecture

Refactor Go services into framework-agnostic clean architecture layers.

8|Updated Jun 5, 2026
One-click install
npx skills add https://github.com/muratmirgun/gophers --skill go-clean-architecture-muratmirgun
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: go-clean-architecture
Source: https://github.com/muratmirgun/gophers/tree/main/skills/go-clean-architecture
Command: npx skills add https://github.com/muratmirgun/gophers --skill go-clean-architecture-muratmirgun

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps you design or refactor Go services so business logic stays isolated from HTTP frameworks, databases, and other infrastructure details. It prevents tangled code by enforcing inward dependencies and keeping usecases easy to test without a running server or database.

Core Features & Use Cases

  • Layered Architecture Guidance: Organize code into Domain, Usecase, Repository, and Delivery layers with clear dependency rules.
  • Framework and Database Decoupling: Keep Gin, Echo, Fiber, net/http, SQL, pgx, and GORM confined to the right boundaries.
  • Production Refactoring Support: Use it when splitting a monolith, untangling handler logic, mapping errors, or verifying that your service wiring is explicit and maintainable.

Quick Start

Ask the skill to refactor your Go service into clean architecture layers and show the directory structure, interfaces, and dependency wiring.

Frequently Asked Questions about go-clean-architecture

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

FAQPage Schema
How do I refactor a Go service into clean architecture layers?

To refactor a Go service into clean architecture, you restructure code into Domain, Usecase, Repository, and Delivery layers with inward-only dependencies, ensuring business logic remains testable without a running server or database.

What is the repository pattern in Go for isolating database dependencies?

The repository pattern in Go isolates database dependencies by defining interfaces in the domain or usecase layer and implementing them in the repository layer, keeping SQL, pgx, or GORM confined to infrastructure boundaries.

How do I make Go business logic testable without running an HTTP server?

Make Go business logic testable without a running HTTP server by moving framework code to the delivery layer and enforcing dependency inversion, allowing usecases to execute independently of Gin, Echo, or net/http.

Does this clean architecture approach work with my existing Go web frameworks?

Yes, this clean architecture approach works with existing Go web frameworks by confining Gin, Echo, Fiber, and net/http to the delivery layer, ensuring your business logic stays framework-agnostic and fully decoupled.

Why should I use dependency inversion when untangling a Go monolith?

Use dependency inversion when untangling a Go monolith to enforce inward-only dependencies, preventing business logic from directly importing infrastructure packages and making the codebase easier to split and maintain.

What is the best way to wire dependencies in a Go clean architecture main.go file?

The best way to wire dependencies in a Go clean architecture main.go file is through explicit, framework-free wiring, where interfaces are owned by inner layers and concrete implementations are injected at the application entry point.