Create domain layer components: models, repository interfaces, marshallers, and implementations. Use when: (1) adding domain model in internal/domain/model/, (2) creating repository interface in internal/domain/repository/, (3) implementing repository with marshaller in internal/infrastructure/{db}/. This is Step 2 of CRUD workflow (after add-database-table, before add-api-endpoint).
Create domain layer components for a new entity following DDD patterns.
make migrate.up1. Domain Model → internal/domain/model/{entity}.go
2. Domain Error → internal/domain/errors/errors.go
3. Repository Interface → internal/domain/repository/{entity}.go
4. Marshaller → internal/infrastructure/{db}/internal/marshaller/{entity}.go
5. Repository Impl → internal/infrastructure/{db}/repository/{entity}.go
6. Generate Mocks → make generate.mock
Location: internal/domain/model/{entity}.go
Create the entity struct, constructor, update methods, and type aliases.
Key requirements:
id.New() for ID generation in constructorCreatedAt and UpdatedAt to the same time parameterReadonlyReference for relations (always nil in constructor)type Examples []*ExampleSee: references/domain-model-patterns.md
Location: internal/domain/errors/errors.go
Add a not-found error for the entity:
ExampleNotFoundErr = NewNotFoundError("E2xxxxx", "Example not found")
Follow error code conventions from .claude/rules/domain-errors.md.
Location: internal/domain/repository/{entity}.go
Define the repository interface with standard CRUD operations and query structs.
Key requirements:
//go:generate directive for mock generationnullable.Type[T] for optional enum/custom type filter fieldsBaseGetOptions / BaseListOptions in query structsSee: references/repository-patterns.md
Location: internal/infrastructure/{mysql|postgresql|spanner}/internal/marshaller/{entity}.go
Convert between DB models and domain models.
Key requirements:
ReadonlyReference must remain nil (no recursive loading)ToModel and ToDBModel functionsSee: references/marshaller-patterns.md
Location: internal/infrastructure/{mysql|postgresql|spanner}/repository/{entity}.go
Implement the repository interface using SQLBoiler.
Key requirements:
transactable.GetContextExecutor(ctx) for all DB operationsbuildListQuery helper for reusable filter logicbuildPreload helper for relation loadingaddForUpdateFromBaseGetOptions, addForUpdateFromBaseListOptionsSee: references/repository-patterns.md
make generate.mock
This generates mock implementations in internal/domain/repository/mock/.
ReadonlyReference for relations (if any)id.New() and ReadonlyReference: nilnull.* types for optional fieldsExamples []*Example)IDs(), MapByID())Unknown as first constantString() and Valid() methodsNew{Type}(str string) constructor//go:generate directivenullable.Type[T] for optional enumsToModel, ToDBModel, ToModels, ToDBModelsReadonlyReference correctlybuildListQuery and buildPreload helpersAfter creating domain entity, use add-api-endpoint skill to create:
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer