implement-domain-model

Translates domain-model documents into Go value objects, typestate aggregates, and domain events.

Updated Sep 14, 2026
One-click install
npx skills add https://github.com/nakamori-naoya/go-convention-plugins --skill implement-domain-model-nakamori-naoya
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: implement-domain-model
Source: https://github.com/nakamori-naoya/go-convention-plugins/tree/main/plugins/go-convention/skills/implement-domain-model
Command: npx skills add https://github.com/nakamori-naoya/go-convention-plugins --skill implement-domain-model-nakamori-naoya

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? It removes ambiguity when turning a domain-model specification into Go code by enforcing a strict one-to-one mapping: each documented element becomes a type, each operation a method, and each rejection reason a sentinel error, with nothing invented beyond the document. ## Core Features & Use Cases - Document-to-code mapping: Converts domain-model documents (element lists, state/type splits, domain events) into Go value objects with private fields and NewX constructors, sealed sum-type aggregates with per-state structs, and domain event types. - Typestate aggregate design: Implements operations as value-receiver methods returning Transition[Next, Event] results, with As*/Restore* functions and a persistence port interface per aggregate. - Use Case: Given a meeting-room reservation domain-model document, generate the complete reservation package with Tentative/Confirmed/Cancelled/Expired state types, sentinel errors matching each documented rejection reason, and an event-sourced Repository interface. ## Quick Start Implement the reservation aggregate from this domain-model document in Go, mapping every element, operation, and rejection reason to types, methods, and sentinels.

Frequently Asked Questions about implement-domain-model

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

FAQPage Schema
How do I implement a DDD aggregate in Go from a domain model document?▼

Map each documented element to a type, each operation to a method on the appropriate state type, and each rejection reason to a sentinel error. Use sealed interface sum types with per-state structs, value receivers returning Transition[Next, Event], and never add operations the document does not define.

What is the typestate pattern for Go aggregates?▼

Typestate gives each aggregate state its own struct type, so impossible operations simply have no method on that type. A sealed interface acts as the sum type, AsX functions narrow states with sentinel errors, and transitions return the next state value plus its domain event.

Can this approach use external Go libraries like pgx or connectrpc?▼

No. The domain package uses only the Go standard library (errors, time, context, slices) and must not import persistence, RPC, or logging packages. An import boundary check with go list verifies this constraint.

When should a Go value object constructor return an error?▼

NewX returns an error only when the documented generation conditions include rejectable combinations, such as an empty identifier or end-before-start time slot. If no combination can be rejected, the constructor returns the value alone to avoid dead error branches.

What happens when the domain model document is incomplete?▼

Implementation stops rather than guessing. Missing operations, preconditions, events, or unresolved decisions are reported back to the document author with the specific gaps listed, and no defaults or placeholders are substituted.