database-design

Installation
SKILL.md

Database Design

Good database design determines the long-term maintainability, performance, and correctness of any data-driven application. Schema decisions made early are expensive to reverse later. Every table, column, index, and constraint should exist for a reason backed by access patterns and business rules.

Data Modeling Principles

Start from Access Patterns

Design tables around how the application reads and writes data, not around how entities look in a domain model. Two questions drive every schema decision:

  1. What queries will run most frequently? -- these determine table structure, indexes, and denormalization choices
  2. What consistency guarantees does the data need? -- these determine normalization level, constraints, and transaction boundaries

Entity Relationships

Relationship Implementation When to Use
One-to-one Foreign key with UNIQUE constraint on the child table Splitting rarely-accessed columns into a separate table, or enforcing exactly-one semantics
One-to-many Foreign key on the child table referencing the parent Orders to order items, users to addresses
Related skills

More from krzysztofsurdy/code-virtuoso

Installs
32
GitHub Stars
17
First Seen
Mar 7, 2026