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.
- Create a JSON model in
projects/ores.codegen/models/{component}/following the*_domain_entity.jsonor*_junction.jsonnaming convention. See ORE Studio Codegen for the model schema and available fields. Type mappings are in Entity lifecycle§"Type mappings". - 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 - Build and verify: use cmake-runner to confirm the component library compiles cleanly.
- Raise PRs at phase boundaries — Phase 1: domain + I/O; Phase 2:
generator; Phase 3: repository; Phase 4: tests + diagrams. Use
feature-branch-managerto transition between branches andpr-managerto open each PR. - 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
- Entity lifecycle — layer ordering, type mappings, service naming.
Reference
- ORE Studio Codegen — model schema, profiles, and template catalogue.
- Entity lifecycle — canonical type mappings and service method naming.
- cmake-runner — build and test commands.
- unit-test-writer — writing Catch2 tests for the new domain type.
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.