go-clean-architecture

Organize Go code into layered handler, service, and repository boundaries.

Updated Jan 8, 2026
One-click install
npx skills add https://github.com/OlegHQ/claude-config --skill go-clean-architecture-oleghq
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: go-clean-architecture
Source: https://github.com/OlegHQ/claude-config/tree/main/go-skills-plugin/skills/go-clean-architecture
Command: npx skills add https://github.com/OlegHQ/claude-config --skill go-clean-architecture-oleghq

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Go projects often become hard to maintain without a clear architecture. This skill prescribes a clean architecture with explicit layers (handler → service → repository) and dependency rules to improve testability and scalability.

Core Features & Use Cases

  • Acyclic Layering: enforces a dependency graph that points inward to core domains.
  • Explicit Dependency Injection: wires components in a predictable, testable way.
  • Guided Project Bootstrap: provides a scalable layout for new Go projects and refactoring.

Quick Start

Create a new Go project and apply the go-clean-architecture layout to start developing with clearly separated layers.

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 with clean architecture layers?

Structure a Go project with clean architecture by enforcing explicit layers like handler, service, and repository. This approach prescribes an acyclic dependency graph that points inward to core domains, ensuring components remain decoupled and highly testable.

What is the best way to enforce acyclic package structure in Go?

The best way to enforce acyclic package structure in Go is by applying explicit dependency rules between layers. By ensuring dependencies point inward toward core domains, you prevent circular references and maintain a predictable, testable architecture.

When should I use dependency injection in Go project structure?

Use dependency injection in Go project structure when you need to wire components predictably for testing. It is essential when refactoring monolithic code into decoupled layers, allowing services to remain independent of specific repository implementations.

Can I use clean architecture to refactor an existing Go project?

Yes, you can use clean architecture to refactor an existing Go project. It provides a guided project bootstrap for migrating tangled codebases into explicit, maintainable layers with strict dependency boundaries and decoupled components.

Does clean architecture limit layer responsibilities in Go applications?

Clean architecture limits layer responsibilities in Go applications by enforcing explicit boundaries. Handlers process requests, services handle business logic, and repositories manage data, preventing logic leakage across layers and improving overall scalability.