What problem does it solve?
The Go backend often drifts away from clean architecture patterns, creating tangled code and slow maintenance. This skill codifies strict, repeatable rules to apply Clean Architecture within the toToogle project, ensuring proper boundaries between Entity, Repository Interface, Database (Gorm), Usecase, Handler, and Router.
Core Features & Use Cases
- Enforces layered boundaries and explicit data flow across Entity → Repository Interface → Database (Gorm) → Usecase → Handler → Router.
- Enforces dependency injection via constructors (e.g., NewXUsecase(repo)) and discourages global state to improve testability and maintainability.
- Guides ULID generation in the BeforeCreate hook for entities to ensure consistent ID patterns.
- Recommends unit testing with testify and standard Go testing practices to validate business rules.
- Documents ORM mappings with GORM tags and aligns with sqlite as the supported database in examples.
Quick Start
Apply these rules when implementing any Go backend component for the toToogle project to maintain strict clean-architecture compliance.