clean-architecture

Enforce Clean Architecture dependency rules in Go projects with layered structure.

1|Updated Feb 18, 2026
One-click install
npx skills add https://github.com/rai-wtnb/clean-modularmonolith-go --skill clean-architecture-rai-wtnb
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: clean-architecture
Source: https://github.com/rai-wtnb/clean-modularmonolith-go/tree/main/.claude/skills/clean-architecture
Command: npx skills add https://github.com/rai-wtnb/clean-modularmonolith-go --skill clean-architecture-rai-wtnb

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Clean Architecture helps Go projects achieve clear separation of concerns by organizing code into distinct layers (domain, application, infrastructure) and enforcing inward-facing dependencies, which improves testability and maintainability.

Core Features & Use Cases

  • Layered structure with explicit boundaries between domain, application, and infrastructure.
  • Dependency rule enforcement to prevent outer layers from leaking into inner ones.
  • Ports and adapters to invert dependencies and enable easy testing and substitution of implementations.
  • Use cases include building modular Go services where business rules are independent of frameworks and external systems.

Quick Start

Organize a Go project into domain, application, and infrastructure layers and implement ports and adapters according to the dependency rule.

Frequently Asked Questions about clean-architecture

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

FAQPage Schema
How do I enforce clean architecture and dependency rules in a Go project?

Enforce clean architecture in Go by organizing code into domain, application, and infrastructure layers, implementing explicit ports and adapters to ensure outer layers never leak into inner ones.

When do I need ports and adapters in my Go codebase?

You need ports and adapters in Go codebases to invert dependencies, which keeps business rules independent of frameworks and enables easy testing and substitution of external system implementations.

What is the best way to separate concerns in medium-to-large Go services?

Separate concerns in medium-to-large Go services by applying a layered design with explicit boundaries, ensuring your business domain remains isolated from infrastructure details through strict dependency rule enforcement.

How do I structure a Go project for clean architecture?

Structure a Go project for clean architecture by dividing it into domain, application, and infrastructure layers, then implementing explicit ports and adapters according to the inward-facing dependency rule.

Can I use clean architecture to improve testability in existing Go codebases?

Yes, applying clean architecture to existing Go codebases improves testability by establishing explicit boundaries and using ports and adapters to invert dependencies, making modular substitution seamless.

Why does my Go application have infrastructure dependencies leaking into the domain layer?

Infrastructure leaks into the domain layer when clean architecture dependency rules are not enforced, requiring explicit ports and adapters to invert dependencies and separate concerns properly.