Design system data flows and data-layer ownership, consistency, and store choices from access patterns. Use for critical-flow design, DFD semantic review, data lineage, authority, replication, retention, or a data-tier bottleneck. Avoid unrelated framework stream/dataframe implementation questions.
Access patterns and per-operation invariants choose the store. Ownership precedes schema. Shard last, not first. Trace critical flows before committing to stores or transport; diagrams are conditional.
Store Selection
List every read and write access pattern with its QPS, latency target, and consistency need.
Default to a relational store. It wins until a specific pattern proves it cannot serve.
Move a pattern to a specialized store only when the relational store fails that named pattern:
key-value for hot lookups, wide-column for massive ordered writes, document for schema-variant
aggregates, graph for multi-hop traversal, search index for text and facets, object store for blobs.
Every additional store adds sync lag, dual-write risk, and one more operational surface. Justify it.
Blobs never live in the primary database; store bytes in object storage and keep the reference.
Ownership and Consistency
Name one authoritative writer per entity or state boundary. Distinguish derived copies, replicas, caches, queues, projections, files, and client state; each needs an owner and refresh/rebuild or lifecycle rule.
Authenticated tenant/user scope is part of authority: carry it from source reads through lexical/vector retrieval, reranking, caches, async jobs and outputs, and deny when it is missing. Ranking relevance never grants access, and a derived copy outlives neither revocation nor its own invalidation. Load tenant-safe retrieval for scoped search, embeddings, caches, or async derived work.
Choose consistency per operation and invariant. Strong consistency is not implied by a domain label; state the consequence of stale or conflicting reads/writes.
Read replicas serve reads only when the consistency contract permits; expose lag and use primary routing, session pinning, or a write token where read-after-write matters.
Choose a bounded synchronous transaction, asynchronous event, saga, or another mechanism from transaction boundaries and failure semantics. A saga is not a universal substitute for atomicity; define recovery and compensations when it is used.
Scaling Order
Apply in order: resolve query shape, unindexed scans, and query amplification (loops, serializers, GraphQL fan-out); see database-query-performance for bounded batching and request-scoped DataLoaders. Then read replicas, caching, vertical scale, partitioning/archival, and sharding last. Sharding costs cross-shard joins, rebalancing, and permanent partition keys.
Partitioning
Choose a partition key that is high-cardinality, present in the hottest query, and evenly distributed.
Hash partitioning spreads load but kills range scans; range partitioning keeps scans but creates a moving hot partition on time-ordered keys.
Mitigate a celebrity key by salting the key, replicating the record, or serving it from a dedicated cache.
Plan resharding before launch: virtual buckets mapped to physical shards let you move buckets without rewriting keys.
Anti-Patterns
No premature sharding: an unindexed query at 300 QPS is not a sharding problem.
No shared database between services: it silently couples deploy and schema lifecycles.
No dual writes without reconciliation: use an event log or CDC, then reconcile.
No unbounded table growth: define retention, archival tier, and deletion at design time.
No denormalization without an update path: every copy needs an owner and a refresh trigger.
No relevance as authorization: ranking, similarity, or a namespace does not decide who may read a row.
No blanket giant JOIN for amplification: multi-row JOINs corrupt pagination and inflate memory; use bounded batching.
Verify
Critical paths name source, sink, transformations, authoritative owner, derived copies, invariant, user-visible outcome, adverse timeline, and observable verification; see flow contract.
Every selected store has a stated access-pattern reason; identify single-writer ownership where applicable.
Consistency and freshness are stated per relevant operation/flow.
Partitioning, hot-key mitigation, retention, archival, and deletion are addressed when workload or lifecycle makes them material.
Tenant-scoped flows name authenticated scope at every derived stage, the deny path for missing scope, and derived-copy revocation/invalidation; see tenant-safe retrieval.
Access amplification (loops, resolvers, aggregates) is bounded via batching or projection before caching or replicas; see database-query-performance.
Flow Contracts - critical-flow authority, copies, invariant and verification record
Tenant-Safe Retrieval - authenticated scope through retrieval, rerank, cache, jobs and derived-copy revocation
Critical Flows and DFD Review
Before choosing stores or transport, trace ingress, transformations, authority, derived state, consumers, trust boundaries, invariant, adverse timeline, and verification for each critical journey. Add delivery, durability, ordering, deduplication, backlog, recovery, capacity, and lifecycle details when material; explain significant omissions. A diagram is optional when prose or a table answers the question.
Load flow contracts for the canonical record, DFD review for semantic/scope checks, and worked flows for concise payment, CDC/backfill, and client-sync examples. DFD levels are not C4 levels. Use sequence/state/ERD/deployment views for ordering, lifecycle, schema, and placement; do not claim those from dataflow arrows.
Stateless computations and SDK functions may need no store, queue, or database. Select a mechanism from the invariant and constraints, not a domain-name recipe.
1---2name: system-design-data-architecture3description: "Design system data flows and data-layer ownership, consistency, and store choices from access patterns. Use for critical-flow design, DFD semantic review, data lineage, authority, replication, retention, or a data-tier bottleneck. Avoid unrelated framework stream/dataframe implementation questions."4metadata:5 source: https://skillmd.com/skills/hoangnguyen0403/system-design-data-architecture6 triggers:7 keywords:8 - sql vs nosql9 - sharding10 - replication11 - partition key12 - denormalization13 - hot partition14 - data store choice15 - read replica16 - polyglot persistence17 - system data flow18 - critical data flow19 - DFD review20 - data lineage21 - data authority22 - tenant isolation23 - multitenant retrieval24 - retrieval authorization25 - deletion propagation26---2728# Data Architecture2930## **Priority: P1 (HIGH)**3132Access patterns and per-operation invariants choose the store. Ownership precedes schema. Shard last, not first. Trace critical flows before committing to stores or transport; diagrams are conditional.3334## Store Selection35361. List every read and write access pattern with its QPS, latency target, and consistency need.372. Default to a relational store. It wins until a specific pattern proves it cannot serve.383. Move a pattern to a specialized store only when the relational store fails that named pattern:39 key-value for hot lookups, wide-column for massive ordered writes, document for schema-variant40 aggregates, graph for multi-hop traversal, search index for text and facets, object store for blobs.414. Every additional store adds sync lag, dual-write risk, and one more operational surface. Justify it.425. Blobs never live in the primary database; store bytes in object storage and keep the reference.4344## Ownership and Consistency4546- Name one authoritative writer per entity or state boundary. Distinguish derived copies, replicas, caches, queues, projections, files, and client state; each needs an owner and refresh/rebuild or lifecycle rule.47- Authenticated tenant/user scope is part of authority: carry it from source reads through lexical/vector retrieval, reranking, caches, async jobs and outputs, and deny when it is missing. Ranking relevance never grants access, and a derived copy outlives neither revocation nor its own invalidation. Load [tenant-safe retrieval](references/tenant-safe-retrieval.md) for scoped search, embeddings, caches, or async derived work.48- Choose consistency per operation and invariant. Strong consistency is not implied by a domain label; state the consequence of stale or conflicting reads/writes.49- Read replicas serve reads only when the consistency contract permits; expose lag and use primary routing, session pinning, or a write token where read-after-write matters.50- Choose a bounded synchronous transaction, asynchronous event, saga, or another mechanism from transaction boundaries and failure semantics. A saga is not a universal substitute for atomicity; define recovery and compensations when it is used.5152## Scaling Order5354Apply in order: resolve query shape, unindexed scans, and query amplification (loops, serializers, GraphQL fan-out); see [database-query-performance](../../database/database-query-performance/SKILL.md) for bounded batching and request-scoped DataLoaders. Then read replicas, caching, vertical scale, partitioning/archival, and sharding last. Sharding costs cross-shard joins, rebalancing, and permanent partition keys.5556## Partitioning5758- Choose a partition key that is high-cardinality, present in the hottest query, and evenly distributed.59- Hash partitioning spreads load but kills range scans; range partitioning keeps scans but creates a moving hot partition on time-ordered keys.60- Mitigate a **celebrity key** by salting the key, replicating the record, or serving it from a dedicated cache.61- Plan resharding before launch: virtual buckets mapped to physical shards let you move buckets without rewriting keys.6263## Anti-Patterns6465- **No premature sharding**: an unindexed query at 300 QPS is not a sharding problem.66- **No shared database between services**: it silently couples deploy and schema lifecycles.67- **No dual writes without reconciliation**: use an event log or CDC, then reconcile.68- **No unbounded table growth**: define retention, archival tier, and deletion at design time.69- **No denormalization without an update path**: every copy needs an owner and a refresh trigger.70- **No relevance as authorization**: ranking, similarity, or a namespace does not decide who may read a row.71- **No blanket giant JOIN for amplification**: multi-row JOINs corrupt pagination and inflate memory; use bounded batching.72## Verify7374- [ ] Critical paths name source, sink, transformations, authoritative owner, derived copies, invariant, user-visible outcome, adverse timeline, and observable verification; see [flow contract](references/flow-contracts.md).75- [ ] Every selected store has a stated access-pattern reason; identify single-writer ownership where applicable.76- [ ] Consistency and freshness are stated per relevant operation/flow.77- [ ] Partitioning, hot-key mitigation, retention, archival, and deletion are addressed when workload or lifecycle makes them material.78- [ ] Tenant-scoped flows name authenticated scope at every derived stage, the deny path for missing scope, and derived-copy revocation/invalidation; see [tenant-safe retrieval](references/tenant-safe-retrieval.md).79- [ ] Access amplification (loops, resolvers, aggregates) is bounded via batching or projection before caching or replicas; see [database-query-performance](../../database/database-query-performance/SKILL.md).80## References8182- [Database Scaling](references/database-scaling.md) - store comparison, replication topologies, sharding mechanics, query amplification & batching83- [Flow Contracts](references/flow-contracts.md) - critical-flow authority, copies, invariant and verification record84- [Tenant-Safe Retrieval](references/tenant-safe-retrieval.md) - authenticated scope through retrieval, rerank, cache, jobs and derived-copy revocation8586## Critical Flows and DFD Review8788Before choosing stores or transport, trace ingress, transformations, authority, derived state, consumers, trust boundaries, invariant, adverse timeline, and verification for each critical journey. Add delivery, durability, ordering, deduplication, backlog, recovery, capacity, and lifecycle details when material; explain significant omissions. A diagram is optional when prose or a table answers the question.8990Load [flow contracts](references/flow-contracts.md) for the canonical record, [DFD review](references/dfd-review.md) for semantic/scope checks, and [worked flows](references/worked-flows.md) for concise payment, CDC/backfill, and client-sync examples. DFD levels are not C4 levels. Use sequence/state/ERD/deployment views for ordering, lifecycle, schema, and placement; do not claim those from dataflow arrows.9192Stateless computations and SDK functions may need no store, queue, or database. Select a mechanism from the invariant and constraints, not a domain-name recipe.
Run npx get-skill add hoangnguyen0403/system-design-data-architecture in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
Design system data flows and data-layer ownership, consistency, and store choices from access patterns. Use for critical-flow design, DFD semantic review, data lineage, authority, replication, retention, or a data-tier bottleneck. Avoid unrelated framework stream/dataframe implementation questions. It is listed under Data & Analytics on SkillMD.
This skill has not completed SkillMD's automated safety review yet. Independent scanners report: Skill Scanner: PASS. Capability flags: makes network calls, reads secrets. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
HoangNguyen0403 (@hoangnguyen0403) published this skill. Their other Agent Skills are listed on their SkillMD profile.