golang-ddd

Implement Domain-Driven Design tactical patterns using idiomatic Go.

1|Updated Feb 12, 2026
One-click install
npx skills add https://github.com/baotoq/agent-skills --skill golang-ddd
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: golang-ddd
Source: https://github.com/baotoq/agent-skills/tree/main/skills/golang-ddd
Command: npx skills add https://github.com/baotoq/agent-skills --skill golang-ddd

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill provides a comprehensive guide and best practices for implementing Domain-Driven Design (DDD) tactical design patterns in Go, ensuring robust, maintainable, and idiomatic domain models.

Core Features & Use Cases

  • Pattern Implementation: Detailed guidance on Entities, Value Objects, Aggregates, Repositories, Domain Services, Domain Events, Factories, and Specifications.
  • Go Idioms: Emphasizes Go-native approaches like composition, interfaces, and unexported fields over traditional OOP.
  • Project Structure: Offers a clear, layered project structure for DDD in Go.
  • Use Case: When building a complex business domain in Go, use this Skill to structure your code according to DDD principles, leading to a more understandable and adaptable codebase.

Quick Start

Use the golang-ddd skill to generate a Go implementation for a new Order aggregate, including its repository interface and necessary value objects.

Frequently Asked Questions about golang-ddd

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

FAQPage Schema
How do I implement DDD tactical patterns in Go?

Implement DDD tactical patterns in Go by using composition, interfaces, unexported fields, and functional options to build domain models with rich business logic. This covers Entities, Value Objects, Aggregates, Repositories, and Domain Events using Go-native idioms.

How do I structure an aggregate and repository in Golang?

Structure a Go aggregate by defining unexported fields for state and exposing behavior through methods. Define repository interfaces within the domain layer to handle persistence, ensuring the domain model remains decoupled from infrastructure.

What is the best way to apply domain-driven design in Go without traditional OOP?

Apply domain-driven design in Go by favoring composition over inheritance and using interfaces for polymorphism. Define domain models using unexported fields and functional options to enforce invariants, avoiding traditional OOP class hierarchies.

When should I use the Specification pattern in a Go domain model?

Use the Specification pattern in a Go domain model to encapsulate complex business rules and validation logic. It allows you to combine, reuse, and test specific business conditions without cluttering your aggregate or entity methods.

Can I use domain events with Go-native idioms in a layered architecture?

Yes, implement domain events using Go-native idioms by defining event interfaces and dispatching them within your aggregates. This maintains a clear layered architecture while keeping the domain logic decoupled from event handlers.

Does this DDD guide support generating a complete Order aggregate with value objects?

Yes, this guide can generate a complete Go implementation for an Order aggregate. It includes creating the necessary value objects, repository interfaces, and factory methods following idiomatic Domain-Driven Design principles.