Data Store Layer Skill
Layer Number: 08
Specification: Metadata Model Spec v0.8.1
Purpose: Defines paradigm-neutral physical storage modeling, capturing databases, collections/tables, fields/columns, indexes, views, stored logic, validation rules, access patterns, event handlers, and retention policies across relational, document, key-value, time-series, and graph stores.
Layer Overview
The Data Store Layer captures physical storage design in a paradigm-neutral way:
- DATABASES - Database instances (any paradigm)
- NAMESPACES - Logical grouping of collections (schemas, keyspaces, databases)
- COLLECTIONS - Primary storage units (tables, collections, streams, buckets)
- FIELDS - Field/column definitions with types and constraints
- INDEXES - Query optimization indexes
- VIEWS - Derived or materialized views
- STORED LOGIC - Stored procedures, triggers, user-defined functions
- VALIDATION RULES - Database-level validation constraints
- ACCESS PATTERNS - Query access patterns for performance modeling
- EVENT HANDLERS - Event-driven data triggers
- RETENTION POLICIES - Data lifecycle and retention rules
This layer supports multiple storage paradigms: relational (PostgreSQL, MySQL), document (MongoDB, Firestore), key-value (Redis, DynamoDB), time-series (InfluxDB, TimescaleDB), and graph (Neo4j, Amazon Neptune).
Central Entity: The Collection (table, document collection, stream) is the core modeling unit.
CLI Introspection: Run dr schema types data-store for the authoritative, always-current list of node types.
Run dr schema node <type-id> for full attribute details on any type (e.g., dr schema node data-store.collection).
Entity Types
Core Data Store Entities (11 entities)
| Entity Type |
CLI Type |
Description |
| Database |
database |
Database instance (any paradigm — relational, document, key-value, etc.) |
| Namespace |
namespace |
Logical grouping of collections (schema, keyspace, database prefix) |
| Collection |
collection |
Primary storage unit (table, document collection, stream, bucket) |
| Field |
field |
Field or column definition with data type and constraints |
| Index |
index |
Query optimization index (B-tree, hash, compound, text, geospatial) |
| View |
view |
Derived or materialized view over one or more collections |
| StoredLogic |
storedlogic |
Stored procedures, triggers, and user-defined functions |
| ValidationRule |
validationrule |
Database-level validation constraint or schema enforcement rule |
| AccessPattern |
accesspattern |
Named query access pattern (for performance and capacity planning) |
| EventHandler |
eventhandler |
Event-driven trigger or change-data-capture handler |
| RetentionPolicy |
retentionpolicy |
Data lifecycle, TTL, and retention rule definition |
When to Use This Skill
Activate when the user:
- Mentions "database", "collection", "namespace", "data-store", "NoSQL", "document store"
- Wants to define collections, fields, indexes, or access patterns
- Asks about storage design for MongoDB, DynamoDB, PostgreSQL, Redis, etc.
- Needs to model physical storage for data models (any paradigm)
- Wants to link physical storage to logical data models
- Discusses event-driven data handling or change-data-capture
- Asks about data retention, TTL policies, or lifecycle management
Cross-Layer Relationships
Outgoing (Data Store → Other Layers):
x-json-schema → Data Model Layer (what logical schema does this implement?)
x-governed-by-* → Security Layer (data access policies)
x-apm-performance-metrics → APM Layer (query performance monitoring)
Incoming (Other Layers → Data Store):
- Data Model Layer → Data Store (physical storage mapping)
- Application Layer → Data Store (database connections)
- Technology Layer → Data Store (hosting infrastructure)
Design Best Practices
- Paradigm-neutral modeling — Use
collection/field regardless of whether the underlying store is relational or document
- Access patterns first — For NoSQL (DynamoDB, Cassandra), define
AccessPattern entities before collections
- Indexes — Add indexes for frequent query paths; use
AccessPattern to document which index serves which pattern
- PII marking — Use
x-pii on field entities to mark sensitive data
- Retention policies — Always add a
RetentionPolicy for collections with regulatory or storage requirements
- Stored logic — Capture stored procedures, triggers, and UDFs as
StoredLogic entities
- Event handlers — Document CDC (change-data-capture) and event-driven triggers as
EventHandler entities
- Validation rules — Add
ValidationRule for database-level constraints beyond field-level type enforcement
Common Commands
# Add a database instance
dr add data-store database --name "users-db"
# Add a namespace (schema or keyspace)
dr add data-store namespace --name "public" --property parentDatabase=data-store.database.users-db
# Add a collection (table or document collection)
dr add data-store collection --name "users" --property parentNamespace=data-store.namespace.public
# Add a field to a collection
dr add data-store field --name "email" --property dataType=string --property nullable=false
# Add an index
dr add data-store index --name "idx-users-email" --property fields='["email"]' --property unique=true
# Add an access pattern (for NoSQL capacity planning)
dr add data-store accesspattern --name "get-user-by-email" --property queryType=point-lookup
# List collections
dr list data-store collection
# Validate data-store layer
dr validate --layer data-store
# Introspect available types
dr schema types data-store
Example: Users Collection (Paradigm-Neutral)
id: data-store.collection.users
name: "Users Collection"
type: collection
properties:
parentNamespace: data-store.namespace.public
paradigm: relational # or: document, key-value, time-series, graph
fields:
- id:
dataType: uuid
nullable: false
primaryKey: true
- email:
dataType: string
nullable: false
x-pii: true
x-encrypted: true
- username:
dataType: string
nullable: false
- created_at:
dataType: timestamp
nullable: false
x-json-schema: data-model.object-schema.user
x-apm-performance-metrics:
- apm.metric.users-query-latency
Access Pattern (for DynamoDB/NoSQL)
id: data-store.accesspattern.get-user-by-email
name: "Get User by Email"
type: accesspattern
properties:
collection: data-store.collection.users
queryType: point-lookup
keyAttributes: ["email"]
consistencyLevel: strong
estimatedRps: 500
Retention Policy
id: data-store.retentionpolicy.users-audit-log
name: "Users Audit Log Retention"
type: retentionpolicy
properties:
collection: data-store.collection.users-audit-log
ttlDays: 365
archiveAfterDays: 90
regulatoryBasis: "SOC2, GDPR Article 30"
Pitfalls to Avoid
- ❌ Using SQL-only concepts (Table, Column, Constraint) — use paradigm-neutral
collection, field, validationrule
- ❌ Skipping
AccessPattern for NoSQL stores (DynamoDB, Cassandra) — define access patterns first
- ❌ Not marking PII fields with
x-pii
- ❌ Missing cross-layer links to data model layer (
x-json-schema)
- ❌ Forgetting
RetentionPolicy for regulated data
- ❌ Not documenting
EventHandler for CDC or change-triggered workflows
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
1---2name: layer-08-data-store-23description: Expert knowledge for Data Store Layer modeling in Documentation Robotics Use when this capability is needed.4---56# Data Store Layer Skill78**Layer Number:** 089**Specification:** Metadata Model Spec v0.8.110**Purpose:** Defines paradigm-neutral physical storage modeling, capturing databases, collections/tables, fields/columns, indexes, views, stored logic, validation rules, access patterns, event handlers, and retention policies across relational, document, key-value, time-series, and graph stores.1112---1314## Layer Overview1516The Data Store Layer captures **physical storage design** in a paradigm-neutral way:1718- **DATABASES** - Database instances (any paradigm)19- **NAMESPACES** - Logical grouping of collections (schemas, keyspaces, databases)20- **COLLECTIONS** - Primary storage units (tables, collections, streams, buckets)21- **FIELDS** - Field/column definitions with types and constraints22- **INDEXES** - Query optimization indexes23- **VIEWS** - Derived or materialized views24- **STORED LOGIC** - Stored procedures, triggers, user-defined functions25- **VALIDATION RULES** - Database-level validation constraints26- **ACCESS PATTERNS** - Query access patterns for performance modeling27- **EVENT HANDLERS** - Event-driven data triggers28- **RETENTION POLICIES** - Data lifecycle and retention rules2930This layer supports **multiple storage paradigms**: relational (PostgreSQL, MySQL), document (MongoDB, Firestore), key-value (Redis, DynamoDB), time-series (InfluxDB, TimescaleDB), and graph (Neo4j, Amazon Neptune).3132**Central Entity:** The **Collection** (table, document collection, stream) is the core modeling unit.3334> **CLI Introspection:** Run `dr schema types data-store` for the authoritative, always-current list of node types.35> Run `dr schema node <type-id>` for full attribute details on any type (e.g., `dr schema node data-store.collection`).3637---3839## Entity Types4041### Core Data Store Entities (11 entities)4243| Entity Type | CLI Type | Description |44| ------------------- | ----------------- | ------------------------------------------------------------------------ |45| **Database** | `database` | Database instance (any paradigm — relational, document, key-value, etc.) |46| **Namespace** | `namespace` | Logical grouping of collections (schema, keyspace, database prefix) |47| **Collection** | `collection` | Primary storage unit (table, document collection, stream, bucket) |48| **Field** | `field` | Field or column definition with data type and constraints |49| **Index** | `index` | Query optimization index (B-tree, hash, compound, text, geospatial) |50| **View** | `view` | Derived or materialized view over one or more collections |51| **StoredLogic** | `storedlogic` | Stored procedures, triggers, and user-defined functions |52| **ValidationRule** | `validationrule` | Database-level validation constraint or schema enforcement rule |53| **AccessPattern** | `accesspattern` | Named query access pattern (for performance and capacity planning) |54| **EventHandler** | `eventhandler` | Event-driven trigger or change-data-capture handler |55| **RetentionPolicy** | `retentionpolicy` | Data lifecycle, TTL, and retention rule definition |5657---5859## When to Use This Skill6061Activate when the user:6263- Mentions "database", "collection", "namespace", "data-store", "NoSQL", "document store"64- Wants to define collections, fields, indexes, or access patterns65- Asks about storage design for MongoDB, DynamoDB, PostgreSQL, Redis, etc.66- Needs to model physical storage for data models (any paradigm)67- Wants to link physical storage to logical data models68- Discusses event-driven data handling or change-data-capture69- Asks about data retention, TTL policies, or lifecycle management7071---7273## Cross-Layer Relationships7475**Outgoing (Data Store → Other Layers):**7677- `x-json-schema` → Data Model Layer (what logical schema does this implement?)78- `x-governed-by-*` → Security Layer (data access policies)79- `x-apm-performance-metrics` → APM Layer (query performance monitoring)8081**Incoming (Other Layers → Data Store):**8283- Data Model Layer → Data Store (physical storage mapping)84- Application Layer → Data Store (database connections)85- Technology Layer → Data Store (hosting infrastructure)8687---8889## Design Best Practices90911. **Paradigm-neutral modeling** — Use `collection`/`field` regardless of whether the underlying store is relational or document922. **Access patterns first** — For NoSQL (DynamoDB, Cassandra), define `AccessPattern` entities before collections933. **Indexes** — Add indexes for frequent query paths; use `AccessPattern` to document which index serves which pattern944. **PII marking** — Use `x-pii` on `field` entities to mark sensitive data955. **Retention policies** — Always add a `RetentionPolicy` for collections with regulatory or storage requirements966. **Stored logic** — Capture stored procedures, triggers, and UDFs as `StoredLogic` entities977. **Event handlers** — Document CDC (change-data-capture) and event-driven triggers as `EventHandler` entities988. **Validation rules** — Add `ValidationRule` for database-level constraints beyond field-level type enforcement99100---101102## Common Commands103104```bash105# Add a database instance106dr add data-store database --name "users-db"107108# Add a namespace (schema or keyspace)109dr add data-store namespace --name "public" --property parentDatabase=data-store.database.users-db110111# Add a collection (table or document collection)112dr add data-store collection --name "users" --property parentNamespace=data-store.namespace.public113114# Add a field to a collection115dr add data-store field --name "email" --property dataType=string --property nullable=false116117# Add an index118dr add data-store index --name "idx-users-email" --property fields='["email"]' --property unique=true119120# Add an access pattern (for NoSQL capacity planning)121dr add data-store accesspattern --name "get-user-by-email" --property queryType=point-lookup122123# List collections124dr list data-store collection125126# Validate data-store layer127dr validate --layer data-store128129# Introspect available types130dr schema types data-store131```132133---134135## Example: Users Collection (Paradigm-Neutral)136137```yaml138id: data-store.collection.users139name: "Users Collection"140type: collection141properties:142 parentNamespace: data-store.namespace.public143 paradigm: relational # or: document, key-value, time-series, graph144 fields:145 - id:146 dataType: uuid147 nullable: false148 primaryKey: true149 - email:150 dataType: string151 nullable: false152 x-pii: true153 x-encrypted: true154 - username:155 dataType: string156 nullable: false157 - created_at:158 dataType: timestamp159 nullable: false160 x-json-schema: data-model.object-schema.user161 x-apm-performance-metrics:162 - apm.metric.users-query-latency163```164165### Access Pattern (for DynamoDB/NoSQL)166167```yaml168id: data-store.accesspattern.get-user-by-email169name: "Get User by Email"170type: accesspattern171properties:172 collection: data-store.collection.users173 queryType: point-lookup174 keyAttributes: ["email"]175 consistencyLevel: strong176 estimatedRps: 500177```178179### Retention Policy180181```yaml182id: data-store.retentionpolicy.users-audit-log183name: "Users Audit Log Retention"184type: retentionpolicy185properties:186 collection: data-store.collection.users-audit-log187 ttlDays: 365188 archiveAfterDays: 90189 regulatoryBasis: "SOC2, GDPR Article 30"190```191192---193194## Pitfalls to Avoid195196- ❌ Using SQL-only concepts (Table, Column, Constraint) — use paradigm-neutral `collection`, `field`, `validationrule`197- ❌ Skipping `AccessPattern` for NoSQL stores (DynamoDB, Cassandra) — define access patterns first198- ❌ Not marking PII fields with `x-pii`199- ❌ Missing cross-layer links to data model layer (`x-json-schema`)200- ❌ Forgetting `RetentionPolicy` for regulated data201- ❌ Not documenting `EventHandler` for CDC or change-triggered workflows202203---204> Converted and distributed by [TomeVault](https://tomevault.io/claim/tinkermonkey) — claim your Tome and manage your conversions.205<!-- tomevault:4.0:skill_md:2026-04-15 -->