database-design-patterns

Provide scalable database design patterns for relational and NoSQL schemas.

29|15|Updated Oct 17, 2025
One-click install
npx skills add https://github.com/NickCrew/claude-cortex --skill database-design-patterns-nickcrew
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: database-design-patterns
Source: https://github.com/NickCrew/claude-cortex/tree/main/skills/database-design-patterns
Command: npx skills add https://github.com/NickCrew/claude-cortex --skill database-design-patterns-nickcrew

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill covers core database design patterns, from normalization to polyglot persistence, to help design scalable, maintainable data models.

Core Features & Use Cases

  • Normalization & Denormalization: Balance data integrity with performance.
  • Polyglot Persistence: Use the right database for the right job (SQL, NoSQL, search).
  • CAP & BASE: Reason about consistency and availability trade-offs.

Quick Start

Compare a normalized schema for orders with a denormalized view for reporting.

Frequently Asked Questions about database-design-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I choose between normalizing and denormalizing a database schema?

Normalization reduces data redundancy and maintains integrity; denormalization duplicates data to optimize read performance. Choose normalization for write-heavy, transactional systems (OLTP) and denormalization for read-heavy analytical workloads (OLAP) or when query speed outweighs storage costs.

When should I use NoSQL instead of a relational database?

Use NoSQL databases for unstructured data, horizontal scaling requirements, or when schema flexibility matters. Relational databases suit structured data with complex joins and ACID guarantees. Polyglot persistence uses both: SQL for transactional data, NoSQL for catalogs or time-series.

What's the difference between sharding and replication in database design?

Sharding splits data across multiple servers by a key, distributing write load and storage. Replication copies data across servers for redundancy and read availability. Both address scalability but serve different purposes: sharding for capacity, replication for resilience.

How do I migrate data from a relational to a NoSQL database?

Plan the target schema to match access patterns, map relational tables to document or key-value structures, handle denormalization and embedding, validate data integrity, and execute incremental migration with dual writes. Schema mismatch and cardinality changes are common migration challenges.

What trade-offs should I consider between consistency and availability?

ACID databases prioritize consistency and partition tolerance but may reduce availability during conflicts; BASE systems favor availability and partition tolerance at eventual consistency. CAP theorem dictates you cannot guarantee all three; choose based on tolerance for stale reads and recovery time.

Can I use caching to improve database performance without redesigning the schema?

Yes. Caching reduces query load on the database and speeds repeated reads without schema changes. Layer caching in application code or use dedicated tools (Redis, Memcached). Cache invalidation and staleness are trade-offs; combine caching with selective denormalization for optimal scaling.