Data Model Layer Skill
Layer Number: 07
Specification: Metadata Model Spec v0.7.0
Purpose: Defines logical data structures using JSON Schema Draft 7, specifying entities, properties, validation rules, and data governance.
Layer Overview
The Data Model Layer captures logical data structures:
- SCHEMAS - Object, array, string, numeric schemas
- VALIDATION - Type constraints, required fields, patterns, ranges
- COMPOSITION - Schema combinations (allOf, anyOf, oneOf, not)
- GOVERNANCE - Data classification, PII, retention policies
- INTEGRATION - Links to business objects, database tables, API operations
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.
Entity Types
Core JSON Schema Entities (17 entities)
| 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) |
| SchemaProperty |
Individual property definition |
| Reference |
$ref to other schemas |
| DataGovernance |
Governance annotations (classification, retention) |
| DatabaseMapping |
Maps to physical database (x-database extension) |
When to Use This Skill
Activate when the user:
- Mentions "data model", "schema", "JSON Schema", "data structure"
- Wants to define object structures, properties, or validation rules
- Asks about data types, constraints, or data governance
- Needs to model entities like User, Order, Product, etc.
- Wants to link data models to APIs or databases
Cross-Layer Relationships
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):
- API Layer → Data Model (request/response schemas via $ref)
- UX Layer → Data Model (form validation rules)
- Testing Layer → Data Model (input constraints for test partitioning)
Validation Best Practices
- Required fields - Use
required array for mandatory properties
- Type validation - Always specify
type (object, array, string, number, etc.)
- Format validation - Use
format for email, uuid, date-time, uri, etc.
- Range validation - Use min/max for numbers, minLength/maxLength for strings
- Pattern validation - Use
pattern for regex validation (e.g., phone numbers)
- Data governance - Always add
x-data-governance for sensitive data
- Reusability - Use
$ref to reference shared schemas
Common Commands
# Add object schema
dr add data_model object-schema --name "User" --property type=object
# List data models
dr list data_model object-schema
# Validate data model layer
dr validate --layer data_model
# Export as JSON Schema
dr export --layer data_model --format json-schema
Example: User Schema
id: data_model.object-schema.user
name: "User Schema"
type: object-schema
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
Pitfalls to Avoid
- ❌ Missing
type field (validation will fail)
- ❌ Not marking PII/sensitive data with governance
- ❌ Overly complex schemas (break into smaller reusable schemas)
- ❌ Not using
$ref for shared definitions
- ❌ Missing cross-layer links to business and database layers
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
1---2name: layer-07-data-model3description: Expert knowledge for Data Model Layer modeling in Documentation Robotics Use when this capability is needed.4---56# Data Model Layer Skill78**Layer Number:** 079**Specification:** Metadata Model Spec v0.7.010**Purpose:** Defines logical data structures using JSON Schema Draft 7, specifying entities, properties, validation rules, and data governance.1112---1314## Layer Overview1516The Data Model Layer captures **logical data structures**:1718- **SCHEMAS** - Object, array, string, numeric schemas19- **VALIDATION** - Type constraints, required fields, patterns, ranges20- **COMPOSITION** - Schema combinations (allOf, anyOf, oneOf, not)21- **GOVERNANCE** - Data classification, PII, retention policies22- **INTEGRATION** - Links to business objects, database tables, API operations2324This layer uses **JSON Schema Draft 7** (industry standard) with custom extensions for cross-layer traceability.2526**Central Entity:** The **ObjectSchema** (defining an object structure) is the core modeling unit.2728---2930## Entity Types3132### Core JSON Schema Entities (17 entities)3334| Entity Type | Description |35| --------------------- | -------------------------------------------------- |36| **JSONSchema** | Root schema document |37| **ObjectSchema** | Defines object structure with properties |38| **ArraySchema** | Defines array with items and constraints |39| **StringSchema** | String validation (length, pattern, format) |40| **NumericSchema** | Number/integer validation (min, max, multipleOf) |41| **SchemaComposition** | Combines schemas (allOf, anyOf, oneOf, not) |42| **SchemaProperty** | Individual property definition |43| **Reference** | $ref to other schemas |44| **DataGovernance** | Governance annotations (classification, retention) |45| **DatabaseMapping** | Maps to physical database (x-database extension) |4647---4849## When to Use This Skill5051Activate when the user:5253- Mentions "data model", "schema", "JSON Schema", "data structure"54- Wants to define object structures, properties, or validation rules55- Asks about data types, constraints, or data governance56- Needs to model entities like User, Order, Product, etc.57- Wants to link data models to APIs or databases5859---6061## Cross-Layer Relationships6263**Outgoing (Data Model → Other Layers):**6465- `x-business-object-ref` → Business Layer (what business concept does this represent?)66- `x-database` → Data Store Layer (how is this stored physically?)67- `x-data-governance` → Security Layer (classification, PII, retention)68- `x-apm-data-quality-metrics` → APM Layer (data quality monitoring)6970**Incoming (Other Layers → Data Model):**7172- API Layer → Data Model (request/response schemas via $ref)73- UX Layer → Data Model (form validation rules)74- Testing Layer → Data Model (input constraints for test partitioning)7576---7778## Validation Best Practices79801. **Required fields** - Use `required` array for mandatory properties812. **Type validation** - Always specify `type` (object, array, string, number, etc.)823. **Format validation** - Use `format` for email, uuid, date-time, uri, etc.834. **Range validation** - Use min/max for numbers, minLength/maxLength for strings845. **Pattern validation** - Use `pattern` for regex validation (e.g., phone numbers)856. **Data governance** - Always add `x-data-governance` for sensitive data867. **Reusability** - Use `$ref` to reference shared schemas8788---8990## Common Commands9192```bash93# Add object schema94dr add data_model object-schema --name "User" --property type=object9596# List data models97dr list data_model object-schema9899# Validate data model layer100dr validate --layer data_model101102# Export as JSON Schema103dr export --layer data_model --format json-schema104```105106---107108## Example: User Schema109110```yaml111id: data_model.object-schema.user112name: "User Schema"113type: object-schema114properties:115 type: object116 required: [id, email, username]117 properties:118 id:119 type: string120 format: uuid121 description: "Unique user identifier"122 email:123 type: string124 format: email125 description: "User email address"126 x-data-governance:127 classification: confidential128 pii: true129 username:130 type: string131 minLength: 3132 maxLength: 50133 pattern: "^[a-zA-Z0-9_-]+$"134 created_at:135 type: string136 format: date-time137 roles:138 type: array139 items:140 type: string141 description: "User role assignments"142 x-business-object-ref: business.actor.user143 x-database:144 table: users145 schema: public146```147148---149150## Pitfalls to Avoid151152- ❌ Missing `type` field (validation will fail)153- ❌ Not marking PII/sensitive data with governance154- ❌ Overly complex schemas (break into smaller reusable schemas)155- ❌ Not using `$ref` for shared definitions156- ❌ Missing cross-layer links to business and database layers157158---159> Converted and distributed by [TomeVault](https://tomevault.io/claim/tinkermonkey) — claim your Tome and manage your conversions.160<!-- tomevault:4.0:skill_md:2026-04-13 -->