api-design
This skill should be used when the user needs to "design the API", do "endpoint design", pin down a "request/response shape", choose a "pagination" strategy…
This skill should be used when the user asks "SQL or NoSQL", "which database", how to design a "data model" or "schema design", picks an "indexing" strategy, needs "sharding" or "partitioning", sets up "replication" (leader-follower / multi-leader), defines a "primary key"/"sort
$ npx -y skills add proyecto26/system-design-skills --skill data-storage --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/data-storageContext preview
The summary Claude sees to decide when to auto-load this skill.
This skill should be used when the user asks "SQL or NoSQL", "which database", how to design a "data model" or "schema design", picks an "indexing" strategy, needs "sharding" or "partitioning", sets up "replication" (leader-follower / multi-leader), defines a "primary key"/"sort
name: data-storage description: This skill should be used when the user asks "SQL or NoSQL", "which database", how to design a "data model" or "schema design", picks an "indexing" strategy, needs "sharding" or "partitioning", sets up "replication" (leader-follower / multi-leader), defines a "primary key"/"sort key", asks whether to "denormalize", or weighs "polyglot persistence". Use it whenever a design must decide where records live, how they are keyed and accessed, and how the store scales past one node — even if the user just says "store the data".
Choose where records live, how they are keyed and queried, and how the store grows past a single machine. Storage is the hardest layer to change later: a wrong data model or shard key calcifies into a scaling ceiling, and getting replication wrong silently serves stale or lost data.
Any system that persists state: picking SQL vs NoSQL, designing a schema and its access paths, adding indexes, splitting a hot table, distributing data across nodes (sharding/partitioning), adding read replicas, or deciding what to denormalize. Reach here the moment "store the data" needs a concrete key and query shape.
Don't shard, add replicas, or reach for NoSQL before a number forces it (YAGNI). A single well-indexed relational node handles ~1k QPS and tens of GB to low TB comfortably — most systems never outgrow it. Sharding multiplies operational cost and breaks joins/transactions; add it only when one node's write throughput or dataset size is genuinely exceeded (→ `back-of-the-envelope`). Caching reads (→ `caching`) and adding read replicas are cheaper first moves than sharding.
Answer these before choosing a store or topology — they decide the design:
document blobs? a graph of connections? Drives SQL vs NoSQL.
Point lookups by key, range scans, ad-hoc queries, aggregations? Model the store around the queries it must serve.
(→ `back-of-the-envelope` for QPS, storage, and shard counts.)
multi-record transactions required? (CAP/consistency theory → `consistency-coordination`.)
data the system can afford to lose on a node failure.
**Relational (SQL — Postgres, MySQL):** strict schema, joins, ACID transactions. *Use when* data is relational, integrity matters, and queries are varied/ad-hoc — the safe default until a number rules it out.
**Document (MongoDB, etc.):** flexible schema, self-contained JSON-ish documents queried by structure. *Use when* records are read/written as a whole and the schema evolves; relationships are few.
**Key-value (Redis, DynamoDB, Riak):** O(1) get/put by key, no rich queries. *Use when* access is purely by a known key and massive throughput is needed.
**Wide-column (Cassandra, Bigtable, HBase):** rows keyed by partition, columns sparse, keys kept sorted for range scans. *Use when* writes are huge and the table can be designed around a few known query patterns.
**Graph (Neo4j):** nodes and edges. *Use when* the core queries traverse many-to-many relationships (social graph, recommendations).
**Scaling moves (apply on top of any store):**
*Use when* reads dominate and slight staleness is OK.
functional domains scale independently and rarely join.
*Use when* a single node's writes or dataset are exceeded. (This skill owns it.)
vastly outnumber writes and joins are the bottleneck.
**Polyglot persistence:** use more than one of the above, each for what it's best at (e.g. Postgres for orders, Redis for sessions, a search index for full-text). The cost is operating and reconciling several stores.
| Option | What it solves | What it worsens | Change it when | |---|---|---|---| | Relational/SQL | Joins, ACID, ad-hoc queries, integrity | Single-node write ceiling; schema migrations; harder horizontal scale | Writes/size exceed one node, or schema is truly fluid → NoSQL/shard | | Document | Schema flexibility; whole-object reads | No joins; cross-document consistency is manual; query engine weaker | Data turns relational or needs multi-doc transactions → SQL | | Key-value | Extreme throughput, simple ops | Only key access; no range/secondary queries | Queries beyond the key are needed → document/wide-column | | Wide-column | Write-heavy scale, range scans on sorted keys | Must know queries up front; rigid once keyed; eventual by default | Access patterns are unknown/varied → relational | | Graph | Cheap deep relationship traversal | Niche tooling; hard to shard; weak for bulk scans | Relationships are shallow → relational/document | | Indexing | Turns scans into lookups | Slower writes; more storage; index bloat | Write amplification hurts more than the read win | | Read replicas | Offloads reads; redundancy | Replication lag → stale reads; failover/promotion logic | Stale reads unacceptable → read-from-leader / `consistency-coordination` | | Federation | Per-domain scale, smaller working sets | Cross-domain joins break; app routing logic | A single domain still won't fit → shard that domain | | Sharding | Horizontal write + storage scale | Cross-shard joins/txns hard; resharding pain; hot shards |
Design scalable systems the way strong engineers actually do — by reasoning, not by memorizing diagrams.
Repo: proyecto26/system-design-skills
This skill should be used when the user needs to "design the API", do "endpoint design", pin down a "request/response shape", choose a "pagination" strategy…
This skill should be used when a system design needs a diagram — "draw the architecture", "diagram this system", "show the components", "make an…
This skill should be used when the user needs to "estimate QPS", "back-of-the-envelope" (BOTEC) numbers, "how much storage / bandwidth", "how many servers",…
This skill should be used when the user wants a "blob store" or "object storage", names "S3" or an S3-compatible store, needs to "store images / video /…
This skill should be used when the user asks about a "caching strategy", "cache invalidation", "what to cache", "read-through vs write-through vs write-back",…
This skill should be used when the user asks about the "CAP theorem", "PACELC", a "consistency model", "eventual vs strong consistency", "read-your-writes",…