brokle-domain-architecture

Guide Brokle domain design with canonical structure and multi-tenant scoping.

3|2|Updated Sep 4, 2025
One-click install
npx skills add https://github.com/brokle-ai/brokle --skill brokle-domain-architecture
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: brokle-domain-architecture
Source: https://github.com/brokle-ai/brokle/tree/main/.claude/skills/brokle-domain-architecture
Command: npx skills add https://github.com/brokle-ai/brokle --skill brokle-domain-architecture

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides deep guidance on Brokle's Domain-Driven Design (DDD) architecture, helping developers correctly structure new domains, entities, and cross-domain interactions. It ensures architectural consistency and maintainability.

Core Features & Use Cases

  • Domain Structure: Defines the standard directory layout for new domains, including entities, repository interfaces, service interfaces, and domain-specific errors.
  • Multi-Tenant Scoping: Explains the four critical patterns for multi-tenant data isolation (organization-scoped, project-scoped, flexible, global entities).
  • Cross-Domain Relationships: Guides on how to manage dependencies and interactions between different domains using professional aliases.
  • Use Case: A developer needs to introduce a new reporting domain. This skill outlines the steps to create the domain structure, define entities with correct multi-tenant scoping, and integrate it with existing domains like observability.

Quick Start

I need to create a new domain called notifications. Outline the directory structure, entity pattern, and how to define its repository and service interfaces, ensuring multi-tenancy.

Frequently Asked Questions about brokle-domain-architecture

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I structure a new domain in Go following domain-driven design principles?

Domain-driven design in Go requires a canonical structure with entities.go, repository.go, service.go, errors.go, types.go, and validators.go files. This separation ensures clear boundaries, testability, and maintainability across your domain layer while supporting scalable backend architecture.

What are the multi-tenancy patterns I should use when designing domain entities?

Multi-tenant domains require four scoping patterns: organization-scoped entities shared across projects, project-scoped entities isolated per project, flexible entities supporting both, and global entities outside tenant isolation. Choosing the right pattern ensures data isolation and architectural consistency.

How do I manage dependencies and interactions between multiple domains?

Cross-domain relationships in Go use professional aliases to decouple domain layers and prevent circular dependencies. This pattern maintains clean architecture boundaries while allowing domains to communicate through well-defined interfaces.

Can I use domain-driven design for Go backends handling complex business logic?

Yes. Domain-driven design scales effectively for Go backends with complex logic, multi-tenancy requirements, and cross-domain workflows. It provides structured entity design, service interfaces, and error handling tailored for backend scalability.

What's the difference between entity, repository, and service interfaces in a domain?

Entities define domain objects and business rules, repositories abstract data persistence operations, and services orchestrate complex business logic across entities. Together they create a layered domain structure that separates concerns and enables testing.

When should I refactor domain boundaries in an existing Go application?

Refactor domain boundaries when entities share responsibility, cross-domain dependencies become tangled, or new functional requirements span multiple domains. Restructuring ensures each domain maintains single responsibility and clear interfaces for future scalability.