원클릭으로
layer-08-data-store
Expert knowledge for Data Store Layer modeling in Documentation Robotics
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Expert knowledge for Data Store Layer modeling in Documentation Robotics
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
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
Expert knowledge for Application Layer modeling in Documentation Robotics
| name | LAYER_08_DATA_STORE |
| description | Expert knowledge for Data Store Layer modeling in Documentation Robotics |
| triggers | ["database","collection","namespace","data-store","NoSQL","MongoDB","DynamoDB","document store","access pattern","index","field"] |
| version | 0.8.3 |
Layer Number: 08 Specification: Metadata Model Spec v0.8.3 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.
The Data Store Layer captures physical storage design in a paradigm-neutral way:
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.
storedlogicvscollection— common mistake:storedlogicis for stored procedures, triggers, and user-defined functions — executable logic that lives inside the database. For relational tables (or document collections, streams, or buckets), usecollectionwithcollectionType: TABLE(orDOCUMENT,STREAM, etc.). Usingstoredlogicfor a table will fail schema validation.
CLI Introspection: Run
dr schema types data-storefor the authoritative, always-current list of node types. Rundr schema node <type-id>for full attribute details on any type (e.g.,dr schema node data-store.collection).
| 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 |
Use this decision tree before assigning a type to any storage element.
Evaluate questions top-to-bottom. Stop at the first YES match. If none match, reconsider whether the concept belongs in a different layer.
storedlogic vs. eventhandler: If the element describes what fires and when (the reactive trigger mechanism), use
eventhandler. If it describes the computation or logic that runs (a function, procedure, or script), usestoredlogic.
Is this a database server/instance/cluster?
YES → data-store.database (e.g., PostgreSQL instance, MongoDB Atlas cluster)
Is this a logical grouping of collections (schema, keyspace, database prefix)?
YES → data-store.namespace (e.g., PostgreSQL schema, Cassandra keyspace, MongoDB database)
Is this a primary storage unit (table, document collection, stream, bucket, topic)?
YES → data-store.collection (e.g., users table, orders collection, events stream)
Is this a field or column definition inside a collection?
YES → data-store.field (e.g., email VARCHAR, user_id UUID, created_at TIMESTAMP)
Is this a query optimization index (B-tree, hash, compound, text, vector)?
YES → data-store.index (e.g., idx_users_email, full-text search index)
Is this a derived or materialized view over one or more collections?
YES → data-store.view (e.g., active_users_view, monthly_revenue_mv)
Is this a stored procedure, function, or user-defined aggregate in the database?
YES → data-store.storedlogic (e.g., calculate_discount(), get_user_stats(), normalize_email())
Is this a database-level validation constraint or schema enforcement rule?
YES → data-store.validationrule (e.g., check constraint, JSON schema validator,
foreign key [database-enforced referential integrity — not a cross-layer relationship])
Is this a named query access pattern describing how the application reads or writes data?
YES → data-store.accesspattern (e.g., get-user-by-email, list-orders-by-date, time-range-query)
Is this a CDC handler, database trigger, or event-driven data workflow?
YES → data-store.eventhandler (e.g., on-insert audit log, DynamoDB Streams handler)
Is this a TTL, archival, or data lifecycle rule?
YES → data-store.retentionpolicy (e.g., 90-day audit log TTL, GDPR deletion policy)
Activate when the user:
Cross-layer links are created via dr relate, not inline YAML attributes. Key relationships from the spec:
Outgoing (Data Store → Other Layers):
| Relationship | Example |
|---|---|
collection.realizes.api.schema | Users collection → API response schema |
collection.maps-to.api.requestbody | Orders collection → POST /orders body |
collection.serves.api.operation | Products collection → GET /products operation |
collection.implements.security.secureresource | PII collection → SecureResource policy |
collection.satisfies.security.dataclassification | Payments collection → PCI data class |
field.satisfies.security.dataclassification | email field → PII data classification |
field.requires.security.fieldaccesscontrol | SSN field → FieldAccessControl rule |
field.maps-to.api.parameter | user_id field → API path parameter |
database.satisfies.security.securitypolicy | DB → encryption-at-rest policy |
database.depends-on.technology.systemsoftware | PostgreSQL DB → pg systemsoftware |
retentionpolicy.satisfies.security.retentionpolicy | Retention rule → security retention policy |
Incoming (Other Layers → Data Store):
| Relationship | Example |
|---|---|
application.applicationcomponent.serves → collection | UserService → users collection |
technology.systemsoftware.depends-on → database | PostgreSQL technology → database |
collection/field regardless of whether the underlying store is relational or documentAccessPattern entities before collectionsAccessPattern to document which index serves which patternfield entities to a security dataclassification node via field.satisfies.security.dataclassification; note PII status in the field descriptionRetentionPolicy for collections with regulatory or storage requirementsStoredLogic entitiesEventHandler entitiesValidationRule for database-level constraints beyond field-level type enforcement# Add a database instance
dr add data-store database "users-db"
# Add a namespace (schema or keyspace)
dr add data-store namespace "public" --description "Default database namespace"
# Add a collection (table or document collection)
dr add data-store collection "users" --description "User records collection"
# Add a field to a collection
dr add data-store field "email" --description "User email address"
# Add an index
dr add data-store index "idx-users-email" --description "Index on email field"
# Add an access pattern (for NoSQL capacity planning)
dr add data-store accesspattern "get-user-by-email" --description "Point lookup by email"
# List collections
dr list data-store --type collection
# Validate data-store layer
dr validate --layers data-store
# Introspect available types
dr schema types data-store
# Collection — use collectionType to specify the paradigm-specific storage unit
id: data-store.collection.users
name: "Users Collection"
type: collection
description: "User account records — relational table (PostgreSQL)"
properties:
collectionType: TABLE
partitionKey: "id"
validationSchema: data-model.object-schema.user
# Fields are separate data-store.field elements — not nested inside the collection
id: data-store.field.users-id
name: "Users ID"
type: field
description: "Primary key"
properties:
dataType: uuid
nullable: false
fieldRole: PARTITION_KEY
id: data-store.field.users-email
name: "Users Email"
type: field
description: "User email address — PII"
properties:
dataType: string
nullable: false
id: data-store.field.users-created-at
name: "Users Created At"
type: field
properties:
dataType: timestamp
nullable: false
id: data-store.accesspattern.get-user-by-email
name: "Get User by Email"
type: accesspattern
description: "Point lookup by email — used for login and profile fetch"
properties:
patternType: POINT_READ
targetCollection: data-store.collection.users
keyCondition: "email"
consistencyRequirement: STRONG
expectedFrequency: HIGH_THROUGHPUT
id: data-store.retentionpolicy.audit-log-retention
name: "Audit Log Retention"
type: retentionpolicy
description: "365-day retention for regulatory compliance (SOC2, GDPR Article 30)"
properties:
targetCollection: data-store.collection.users-audit-log
retentionDuration: "P365D"
action: ARCHIVE
enabled: true
collection, field, validationruleAccessPattern for NoSQL stores (DynamoDB, Cassandra) — define access patterns firstfield entities are always separate elements linked via collection.composes.fieldx-pii, x-json-schema, or x-apm-performance-metrics attributes — these are not in the spec; use relationships (field.satisfies.security.dataclassification, collection.realizes.api.schema) insteadttlDays / archiveAfterDays in retentionpolicy — use retentionDuration (ISO 8601, e.g. "P365D") and action (enum: DELETE | ARCHIVE | ...)RetentionPolicy for regulated dataEventHandler for CDC or change-triggered workflowsBefore declaring data-store layer extraction complete, verify each type was considered:
If any type has ZERO elements, explicitly decide: "This type doesn't apply to this codebase" with reasoning.
Note:
accesspatternis strongly recommended for any NoSQL store (DynamoDB, Cassandra, Firestore) — NoSQL schema design is driven by access patterns.retentionpolicyis strongly recommended for any collection subject to regulatory requirements (GDPR, SOC2, HIPAA).