> golang-architecture
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)
curl "https://skillshub.wtf/HoangNguyen0403/agent-skills-standard/golang-architecture?format=md"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
- Do NOT use standard patterns if specific project rules exist.
- Do NOT ignore error handling or edge cases.
> related_skills --same-repo
> typescript-tooling
Development tools, linting, and build config for TypeScript. Use when configuring ESLint, Prettier, Jest, Vitest, tsconfig, or any TS build tooling. (triggers: tsconfig.json, .eslintrc.*, jest.config.*, package.json, eslint, prettier, jest, vitest, build, compile, lint)
> typescript-security
Secure coding practices for TypeScript. Use when validating input, handling auth tokens, sanitizing data, or managing secrets and sensitive configuration. (triggers: **/*.ts, **/*.tsx, validate, sanitize, xss, injection, auth, password, secret, token)
> typescript-language
Modern TypeScript standards for type safety and maintainability. Use when working with types, interfaces, generics, enums, unions, or tsconfig settings. (triggers: **/*.ts, **/*.tsx, tsconfig.json, type, interface, generic, enum, union, intersection, readonly, const, namespace)
> typescript-best-practices
Idiomatic TypeScript patterns for clean, maintainable code. Use when writing or refactoring TypeScript classes, functions, modules, or async logic. (triggers: **/*.ts, **/*.tsx, class, function, module, import, export, async, promise)