mh-cto-sdlc-data-arch
暂无简介
- License 许可
- MIT
- 最近更新
- 2026-05-13
- Stars
- ★ 2
- Forks
- 0
02 资源文件 2
- 其他customize.toml625 B
- 参考文档mh-skill-manifest.yaml526 B
03 SKILL.md 正文
Data Architecture
Mode: synthesize-first (D34). Read domain model and content model. Derive the data architecture. Ask only where persistence decisions cannot be resolved from context.
Elite character: Data architecture outlasts code. Schemas are the most expensive things to change in production. Every data model decision made here will still be load-bearing in Phase 6, Phase 7, and three refactor cycles later. The domain model from Phase 1 is the starting point — this skill translates it into a persistence reality.
ADR rule (D27): Write an ADR for data decisions that are hard to reverse, surprising without context, and had a real trade-off. Database choice, event sourcing vs. CRUD, sharding strategy — these qualify. Schema field names do not.
Step 1 — Load Artifacts
Confirm present:
- Domain model (
domain-model.md) ✓ / ✗ — REQUIRED - Content model (
content-model.md) ✓ / ✗ — REQUIRED - Arch drivers (
arch-drivers.md) ✓ / ✗ — REQUIRED - System diagram (
system-diagram.md) ✓ / ✗
Missing domain model: cannot proceed.
Step 2 — Map Domain Entities to Persistence
From the domain model, list every entity. For each entity:
- Entity: [name from domain model]
- Persistence type: [relational | document | key-value | time-series | event log | cache]
- Reason: [which arch driver or content model requirement determines this]
- Owner service/module: [from system decomposition — which service owns this data]
Apply the arch drivers: if a driver specifies performance requirements, compliance requirements, or data residency — apply them here. Do not choose persistence technology yet (that is tech-selection) — only persistence type and ownership.
Step 3 — Map Content Model Requirements
From content-model.md, identify what data each UI surface requires and at what latency. Map these to the entity list:
- Surface: [screen name from Phase 3]
- Data required: [entities + fields the surface displays]
- Latency expectation: [real-time / near-real-time / batched / on-demand]
- Read pattern: [list (paginated?) / single entity / aggregated / computed]
- Write pattern: [creates / updates / deletes — which entities, from which surfaces]
Surfaces with real-time requirements shape the API and event architecture. Surfaces with heavy aggregation shape query design and caching strategy.
Step 4 — Define Data Model
For each entity, produce a schema sketch. Not DDL — the structural decisions that shape the implementation.
Entity: {name}
Fields: {key fields with types}
Relationships: {owns / references / many-to-many with what}
Unique constraints: {what cannot be duplicated}
Indexes needed: {common query patterns that need fast lookup}
Sensitive data: {PII or regulated fields — flags security/compliance requirements}
For relationships:
- Owns: The owning entity holds the foreign key and is responsible for lifecycle
- References: Loose reference by ID — the referenced entity can be deleted independently
- Many-to-many: Explicit join structure — state the ownership of the join record
Orphan risk: flag any relationship where a parent deletion would create orphaned child records. Decide: cascade delete, soft delete, or block delete with explicit resolution.
Step 5 — Data Flow Diagram
Map how data flows through the system:
- Write flows: User action → which service → which entity → which other services are notified
- Read flows: User view → which service → which entities → any cross-service data assembly
For cross-service data assembly (a surface that needs data owned by two different services):
- Name the assembly pattern: API composition, event-sourced denormalized view, or materialized view
- Flag any assembly that would be slow or brittle — this is a Phase 5 performance test candidate
Step 6 — Persistence Strategy Decisions
Define the key decisions that constrain implementation:
Primary persistence: [relational / document / hybrid — with brief rationale]
Soft delete vs. hard delete: [chosen approach and rationale — this has compliance and query implications]
Audit log strategy: [if required by arch drivers — what events are logged, where]
Caching layer: [where caching is needed based on content model latency requirements — and what is NOT cached]
Test fixture implications: Which entities are load-bearing for testing? Complex entities with many relationships produce expensive fixtures. Flag any entity whose fixture complexity would slow test setup meaningfully — this feeds Phase 5 test data architecture.
Step 7 — Write ADR Entries (D27)
For data decisions that qualify (hard to reverse + surprising without context + real trade-off existed):
Save to docs/adr/000{N}-{slug}.md. Scan existing ADRs for current highest number.
Candidates: event sourcing choice, denormalization strategy, sharding/partitioning decision, soft vs. hard delete policy, choice of primary persistence type.
Step 8 — Write Output
Save to _mh-output/cto/sdlc/data-arch/{YYYY-MM-DD}_{r###}_data-model.md:
# Data Architecture
**Product:** {name}
**Date:** {date}
---
## Entity Map
| Entity | Persistence Type | Owner | Sensitive Fields |
| ------ | --------------------------- | --------- | -------------------- |
| {name} | relational / document / ... | {service} | {PII fields or none} |
## Data Models
### {Entity Name}
- **Fields:** {key fields with types}
- **Relationships:** {owns / references / m:m details}
- **Constraints:** {unique constraints, not-null requirements}
- **Indexes:** {lookup patterns that need indexes}
- **Orphan policy:** {cascade / soft-delete / block}
{Repeat for each entity}
## Content Model → Data Mapping
| Surface | Entities Required | Latency | Read Pattern |
| ------------- | ----------------- | ------------------- | ------------ |
| {screen name} | {entity list} | real-time / batched | {pattern} |
## Data Flow
### Write Flows
{For each create/update/delete — which service, which entity, what is notified}
### Read Flows / Cross-Service Assembly
{For any surface requiring data from multiple services — assembly pattern + risk}
## Persistence Decisions
- **Primary persistence:** {type and rationale}
- **Soft delete:** {yes/no — scope}
- **Audit log:** {strategy or N/A}
- **Caching:** {where + what is NOT cached}
## Test Fixture Complexity Flags
{Entities whose fixture setup is expensive — fed to Phase 5 test data architecture}
## ADRs Written
{List of ADR files created}
Step 9 — Present Summary
Data Architecture complete. {N} entities defined, {N} ADRs written.
Data shape: {one sentence — e.g. "relational with soft deletes, 2 entities with PII requiring encryption at rest"}
Cross-service assembly: {N} surfaces require assembly — {assembly pattern used}.
Test fixture risks: {N} entities flagged for fixture complexity.
Next step: Run /mh-cto-sdlc-integration-design to define external integration contracts.
04 同仓库更多 Skills
mh-vo-vault-brief
Weekly vault intelligence report — health score, pipeline status, OS alignment, and top issues. Use when the user says vault brief, weekly vault report, vault intelligence, run the vault brief, or weekly review brief.
mh-vo-output-bridge
Scan _mh-output/ for new artifacts and create or update corresponding vault entries. Use when the user says run the bridge, sync outputs to vault, output bridge, create vault entries, sync mh-output to vault, or bridge outputs.
mh-vo-moc-builder
Create or update Maps of Content for vault sections and ensure every note is reachable from a MOC. Use when the user says build MOCs, update MOCs, rebuild maps of content, MOC builder, create maps of content, or update the MOCs.
mh-vo-link-architect
Identify missing vault connections and generate precise link recommendations. Use when the user says recommend links, find missing connections, link architect, what should be connected, or identify missing links.
mh-vo-base-builder
Generate Obsidian Bases (.base files) for live database views of vault data. Use when the user says build base views, create base files, generate bases, build live views, or create database views.
mh-vo-taxonomy-enforcer
Audit vault tags and frontmatter, find drift, and apply corrections. Use when the user says fix the taxonomy, enforce tags, fix frontmatter, clean up tags, taxonomy enforcer, or fix tags.