ワンクリックで
layer-07-data-model
Expert knowledge for Data Model Layer modeling in Documentation Robotics
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Expert knowledge for Data Model Layer modeling in Documentation Robotics
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Expert knowledge for Data Store Layer modeling in Documentation Robotics
Graph-based code intelligence for using dr analyzer subcommands to understand codebase structure, discover elements, and verify model alignment
Expert knowledge for Application Layer modeling in Documentation Robotics
Expert knowledge for Motivation Layer modeling in Documentation Robotics
Expert knowledge for Business Layer modeling in Documentation Robotics
Expert knowledge for Security Layer modeling in Documentation Robotics
| name | LAYER_07_DATA_MODEL |
| description | Expert knowledge for Data Model Layer modeling in Documentation Robotics |
| triggers | ["JSON Schema","data model","schema","object schema","data structure","properties","validation","data type"] |
| version | 0.8.3 |
Layer Number: 07 Specification: Metadata Model Spec v0.8.3 Purpose: Defines logical data structures using JSON Schema Draft 7, specifying entities, properties, validation rules, and data governance.
The Data Model Layer captures logical data structures:
This layer uses JSON Schema Draft 7 (industry standard) with custom extensions for cross-layer traceability.
Central Entity: The ObjectSchema (defining an object structure) is the core modeling unit.
CLI Introspection: Run
dr schema types data-modelfor the authoritative, always-current list of node types. Rundr schema node <type-id>for full attribute details on any type.
| Entity Type | Description |
|---|---|
| JSONSchema | Root schema document |
| ObjectSchema | Defines object structure with properties |
| ArraySchema | Defines array with items and constraints |
| StringSchema | String validation (length, pattern, format) |
| NumericSchema | Number/integer validation (min, max, multipleOf) |
| SchemaComposition | Combines schemas (allOf, anyOf, oneOf, not) |
| SchemaDefinition | Named reusable type for shared use in definitions blocks |
| SchemaProperty | Individual property definition |
| Reference | $ref to other schemas |
Note: Data governance (
x-data-governance) and database mapping (x-database) are cross-layer extension attributes, not node types. Set them directly on the schema element they describe — on anobjectschemafor table-level mapping, or on aschemapropertyfor field-level governance (e.g., marking an individual
Use this decision tree before assigning a type to any code pattern.
$schema, $id, and type fields at the top level? → data-model.jsonschemaallOf, anyOf, oneOf, or not (even if it also has properties)? → data-model.schemacompositiondefinitions block (has title and type)? → data-model.schemadefinitiontype: object and properties? → data-model.objectschemaitems, minItems, maxItems, uniqueItems, or contains? → data-model.arrayschemaminLength, maxLength, pattern, or format? → data-model.stringschemaminimum, maximum, exclusiveMinimum, exclusiveMaximum, or multipleOf? → data-model.numericschema$ref pointer with no additional constraints? → data-model.referenceobjectschema, carrying its own constraints (title, description, readOnly, default, const, etc.) alongside or instead of a $ref? → data-model.schemaproperty| Misclassification | Correct Classification | Why |
|---|---|---|
Modeling x-data-governance or x-database as their own elements | Set as extension attributes on the relevant schema element (objectschema or schemaproperty) | These are cross-layer extension attributes, not spec node types |
Using objectschema for a reusable definition in a definitions block | schemadefinition | definitions entries are named, reusable definitions; objectschema is for structural instances |
Using schemadefinition for a top-level schema document | jsonschema | A root document with $schema and $id is jsonschema, not a definition |
Using schemaproperty for a standalone string/numeric/array type | stringschema / numericschema / arrayschema | Use the specific schema type when the constraint set is rich enough to stand alone; use schemaproperty only for inline field declarations within an objectschema |
Using objectschema for a schema that uses allOf to extend another | schemacomposition | When the primary purpose is combining or extending schemas, classify as schemacomposition — even if the schema also declares properties |
Using schemaproperty for a bare $ref with no other constraints | reference | A standalone $ref with nothing else is a reference; use schemaproperty only when the field also carries its own constraints (title, description, readOnly, default, etc.) |
Activate when the user:
Outgoing (Data Model → Other Layers):
x-business-object-ref → Business Layer (what business concept does this represent?)x-database → Data Store Layer (how is this stored physically?)x-data-governance → Security Layer (classification, PII, retention)x-apm-data-quality-metrics → APM Layer (data quality monitoring)Incoming (Other Layers → Data Model):
# Add object schema
dr add data-model objectschema "User" --description "User object schema"
# List data models
dr list data-model --type objectschema
# Validate data model layer
dr validate --layers data-model
# Export as JSON Schema
dr export jsonschema --layers data-model
id: data-model.objectschema.user
name: "User Schema"
type: objectschema
properties:
type: object
required: [id, email, username]
properties:
id:
type: string
format: uuid
description: "Unique user identifier"
email:
type: string
format: email
description: "User email address"
x-data-governance:
classification: confidential
pii: true
username:
type: string
minLength: 3
maxLength: 50
pattern: "^[a-zA-Z0-9_-]+$"
created_at:
type: string
format: date-time
roles:
type: array
items:
type: string
description: "User role assignments"
x-business-object-ref: business.actor.user
x-database:
table: users
schema: public
Before declaring data-model layer extraction complete, verify each type was considered:
$schema + $id declarations)$ref pointers to shared or external schemasallOf for inheritance, anyOf/oneOf for polymorphism)definitions blocksIf any type has ZERO elements, explicitly decide: "This type doesn't apply to this codebase" with reasoning.
type on schema elements — validation fails without itschemadefinition entries and reference them via $refx-data-governance on the relevant schemaproperty or objectschemax-business-object-ref to link to the Business Layer and x-database to link to the Data Store Layerformat for semantic string types (email, uuid, date-time, uri) rather than custom pattern where a standard format exists