architecture

📁 mte90/dotfiles 📅 Today
3
总安装量
2
周安装量
#59473
全站排名
安装命令
npx skills add https://github.com/mte90/dotfiles --skill Architecture

Agent 安装分布

amp 2
cline 2
opencode 2
cursor 2
kimi-cli 2
codex 2

Skill 文档

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 Repository interface, not SQLRepository struct.
  • Wire up in Main: Main function composes the dependency graph.

References