Loading...
Loading...
Expert implementation guide for custom Clean Architecture pattern in Golang projects. Use when implementing features with domain-driven design, creating API endpoints, or working with this specific 4-layer architecture (Domain, Application, Integration, Infrastructure). NOT Uncle Bob's standard Clean Architecture - this is a specialized adaptation with strict dependency rules and specific conventions.
npx skill4agent add gabihert/finance-tracker-e2e clean-architecture-golangIntegration → Application → Domain ← Infrastructure/test/integration/features/Feature: Create entity functionality
Scenario: Create entity success
When I call "POST" "/v1/entities" with payload
Then status should be 201
And db should contain entity/internal/domain/entity//internal/domain/error/PREFIX-XXYYYY/internal/domain/enums//internal/application/adapter//internal/application/usecase//internal/application/service//internal/integration/adapter/type Repository interface {
usecase.Find // MUST embed
usecase.Save // MUST embed
}/internal/integration/entrypoint/dto//internal/integration/entrypoint/controller//internal/integration/persistence/model//internal/integration/persistence//internal/infra/dependency/injector.go// Type cast repository to usecase
usecase.Find(i.GetRepository())/internal/infra/server/router/router.gomake test-integration// Application defines need
type FindProduct interface {
FindById(ctx, id) (*entity, error)
}
// Integration MUST implement
type ProductRepository interface {
usecase.FindProduct // EMBED!
}
// Type cast in DI
usecase.FindProduct(repository)CLI-01409USR-01404PRD-02500Request → DTO → Entity → Model → DB
Response ← DTO ← Entity ← Model ← DBentity-template.goservice-template.gorepository-template.go/internal/{domain,application,integration}/*/client*.go/internal/{domain,application,integration}/*/user*.go/internal/{domain,application,integration}/*/forest*.go