Golang architecture
Skill ComeOnOliver/skillshub/skills/HoangNguyen0403/agent-skills-standard/golang-architecture
🧠The right skill, one API call. AI agent skills registry with token-efficient skill resolution. 5,000+ skills from 500+ top repos.
npx -y skills add ComeOnOliver/skillshub --skill golang-architectureAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
What its author says it does
Copied from the file, not written here
Standards for structural design, Clean Architecture, and project layout in Golang. Use when structuring Go projects or applying Clean Architecture in Go. (triggers: go.mod, internal/**, architecture, structure, folder layout, clean arch, dependency injection)
SKILL.md
2.2 KB, 418 tokens by cl100k_base, as published. Nobody here has run it
Golang Architecture Standards
Priority: P0 (CRITICAL)
Principles
- Clean Architecture: Separate concerns. Inner layers (Domain) rely on nothing. Outer layers (Adapters) rely on Inner.
- Project Layout: Follow standard Go project layout (
cmd,internal,pkg). - Dependency Injection: Explicitly pass dependencies via constructors. Avoid global singletons.
- Package Oriented Design: Organize by feature/domain, not by layer (avoid
controllers/,services/at root). - Interface Segregation: Define interfaces where they are used (Consumer implementation).
Standard Project Layout
See Standard Project Layout for directory tree.
Layer Rules
- Domain: Inner-most. No deps.
- UseCase: Depends on Domain.
- Adapter: Outer-most. Depends on UseCase/Domain.
Guidelines
- Use Constructors:
NewService(repo Repository) *Service. - Inversion of Control: Service depends on
Repositoryinterface, notSQLRepositorystruct. - Wire up in Main: Main function composes the dependency graph.
Verification Checklist (Mandatory)
- No Globals: Are there any global singletons or package-level variables being mutated?
- DI: Are dependencies explicitly passed via constructors?
- Interfaces: Are interfaces defined at the consumer side (where they are used)?
- Layering: Does
internal/domainhave zero external dependencies? - Composition: Are dependencies wired together in
main.go?
Anti-Patterns
- No Global Singletons: Use DI; avoid package-level mutable variables.
- No Layer Violations: Domain must not import from adapter/infrastructure layers.
- No God Services: Split large services into single-responsibility components.
References
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.