Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Designs a system's data layer as DATA.md: datastore, ER diagram, schemas, indexes, migrations, retention, sensitive-data inventory.
Use this skill ↓36% 68%+32 ptsof test cases passed
Passed 15 of 22 test cases with the skill, and 8 of 22 without it.
In the open questions section of the database design document, two unresolved architectural decisions remain regarding document-store embedding versus normalized relational tables. What value must be assigned to the frontmatter status attribute?
Sets status frontmatter key to has_open_questions when unresolved questions remain in § 12.
3 of 3 safety checks passed
Produce a DATA.md that serves as the single source of truth for the system's persistent-data layer: which datastore(s) the system uses and why, the ER (or collection) diagram, the schema for every table or collection with column-by-column typing and constraints, every index with its rationale, the ordered list of migrations, the retention and deletion policy per table, the sensitive-data inventory per column, and the consistency and concurrency strategies applied across entities. Crucially, DATA.md extends traditional database documentation with an access-patterns section that maps every query the system actually runs to the index that serves it — schemas without access patterns are under-specified. An agent reading this document alone can explain, for any query the system issues, which index serves it and at what cost class; for any table, which aggregate it persists and which invariants its constraints enforce; for any column holding sensitive data, its classification, masking rule, and encryption posture.
DATA.md is read by /operations (for migration sequencing, retention runbooks, and backup posture), /security (for the sensitive-data inventory), every per-unit /SPEC.md that touches persistence (to draw typing and constraints from a single source), /code-review for conformance against the registered schema, and /system-verification during bootstrap. The defining discipline — and the commonest violation — is every query is indexed or explicitly accepted as a scan: a schema that lists columns and indexes without the access-pattern map is half a design, because it does not prove the indexes are the right ones. Co-locating schema, indexes, and access patterns in one artifact is the deliberate read-pattern optimisation that makes this skill exist.
INV-NN references for invariants enforced at the database level (uniqueness, foreign-key integrity, check constraints).ADR-NN that chose the storage engine is cited verbatim in § 1 Datastore Overview. Multi-store architectures (a relational primary plus a blob store plus a cache) produce multiple datastore sub-blocks.migrations/, db/migrations/, priv/repo/migrations/, Flyway, Alembic, ActiveRecord, Knex) are present, read them fully. Every shipped migration appears in § 6 with its original filename preserved. Do not re-describe shipped migrations from memory — quote their actual effect..sql files, query-builder DSL, EXPLAIN artefacts), ORM model code (repositories, DAOs, Active Record models), or data-access layers, scan them to harvest the queries the system actually runs. Each harvested query maps to a row in § 5 with its origin file and function cited in the Uses index column's footnote.Read set size: 2 required + up to 3 auto-discovered. Read both required inputs end-to-end; for refinement, read every migration file and every data-access source file before drafting. Omitted reading causes two specific failure modes: tables with no owning aggregate (DOMAIN drift) and indexes with no serving query (orphan indexes — the schema is lying about which queries matter).
Data-layer design proceeds in nine phases: datastore anchoring, aggregate-to-schema mapping, index inventory, access-pattern mapping (the critical phase), migration enumeration, retention and deletion, sensitive-data inventory, consistency and concurrency, and validation. Phases are sequential but revisit earlier phases when a later one reveals a missing index, a missing migration, or a mis-sized constraint. Do not skip the access-patterns phase — it is the phase that proves the schema is the right schema.
Read ARCHITECTURE.md § 2 and § 5 to fix the datastore technology. For each distinct datastore the system uses (typically one primary relational or document store, optionally a blob store, a cache, a message queue's durable state, a search index), record: kind (postgres, mysql, dynamodb, mongo, sqlite, redis, s3, elasticsearch, cassandra, …), version pinned where load-bearing, connection model (pooled / per-request / serverless), transactional semantics (single-row atomic / single-shard / multi-shard with 2PC / none), and consistency guarantees this datastore provides out of the box (read-after-write, snapshot isolation, eventual, tunable quorum). Cite the originating ADR-NN from ARCHITECTURE.md § 5.
The primary datastore kind lands in frontmatter datastore:. If multiple datastores exist, datastore: carries the primary (the one that owns aggregate persistence); secondary stores (cache, blob) are declared in § 10 Non-Relational Side and do not contribute to datastore:.
For each aggregate in DOMAIN.md § 5 (and for entities in § 4 that persist independently), choose the schema representation:
accounts table holding both IndividualAccount and OrganisationAccount). Record the discriminator column and the per-discriminator invariants.Next to this one in the catalogue, plus more from the same author.