Code Add Domain Type

Table of Contents

When to use this skill

When you need to add a new domain type to an ORE Studio component with JSON I/O, table I/O, a test data generator, and repository CRUD support. This is the mandatory first step before any exposure layer (SQL schema, HTTP, CLI, shell, Wt, Qt) can be built. See the Entity lifecycle overview for the full layer ordering.

How to use this skill

Codegen is the primary path. Manual creation is a last resort and must be justified in the file header.

  1. Create a JSON model in projects/ores.codegen/models/{component}/ following the *_domain_entity.json or *_junction.json naming convention. See ORE Studio Codegen for the model schema and available fields. Type mappings are in Entity lifecycle§"Type mappings".
  2. Generate all C++ artefacts (files written directly to the project tree — no copy step): cd projects/ores.codegen && ./run_generator.sh models/{component}/{entity}_domain_entity.json --profile all-cpp
  3. Build and verify: use cmake-runner to confirm the component library compiles cleanly.
  4. Raise PRs at phase boundaries — Phase 1: domain + I/O; Phase 2: generator; Phase 3: repository; Phase 4: tests + diagrams. Use feature-branch-manager to transition between branches and pr-manager to open each PR.
  5. Update diagrams after Phase 4: plantuml-class-modeler for the class diagram; plantuml-er-modeler for the ER diagram.

If codegen cannot express the pattern, extend the Mustache templates in library/templates/ first, then regenerate. See ORE Studio Codegen§"Profile catalogue" for what each profile generates and which library it uses.

Recipes

Reference

Templates

Runs via --profile all-cpp (combines domain · generator · repository · service · protocol). Full output paths are in Entity lifecycle§"Complete entity file checklist".

Sub-profile Key templates
--profile domain cpp_domain_type_class.hpp.mustache (+ 6)
--profile generator cpp_domain_type_generator.hpp.mustache (+ 1)
--profile repository cpp_domain_type_entity.hpp.mustache (+ 5)
--profile service cpp_service.hpp.mustache (+ 1)
--profile protocol cpp_protocol.hpp.mustache

Read the template directly for the authoritative implementation — do not reproduce it here.

Emacs 29.1 (Org mode 9.6.6)