$npx -y skills add One-Man-Company/Skills-ContextManager --skill database-designDatabase design principles and decision-making. Schema design, indexing strategy, ORM selection, serverless databases.
| 1 | # Database Design |
| 2 | |
| 3 | > **Learn to THINK, not copy SQL patterns.** |
| 4 | |
| 5 | ## 🎯 Selective Reading Rule |
| 6 | |
| 7 | **Read ONLY files relevant to the request!** Check the content map, find what you need. |
| 8 | |
| 9 | | File | Description | When to Read | |
| 10 | |------|-------------|--------------| |
| 11 | | `database-selection.md` | PostgreSQL vs Neon vs Turso vs SQLite | Choosing database | |
| 12 | | `orm-selection.md` | Drizzle vs Prisma vs Kysely | Choosing ORM | |
| 13 | | `schema-design.md` | Normalization, PKs, relationships | Designing schema | |
| 14 | | `indexing.md` | Index types, composite indexes | Performance tuning | |
| 15 | | `optimization.md` | N+1, EXPLAIN ANALYZE | Query optimization | |
| 16 | | `migrations.md` | Safe migrations, serverless DBs | Schema changes | |
| 17 | |
| 18 | --- |
| 19 | |
| 20 | ## ⚠️ Core Principle |
| 21 | |
| 22 | - ASK user for database preferences when unclear |
| 23 | - Choose database/ORM based on CONTEXT |
| 24 | - Don't default to PostgreSQL for everything |
| 25 | |
| 26 | --- |
| 27 | |
| 28 | ## Decision Checklist |
| 29 | |
| 30 | Before designing schema: |
| 31 | |
| 32 | - [ ] Asked user about database preference? |
| 33 | - [ ] Chosen database for THIS context? |
| 34 | - [ ] Considered deployment environment? |
| 35 | - [ ] Planned index strategy? |
| 36 | - [ ] Defined relationship types? |
| 37 | |
| 38 | --- |
| 39 | |
| 40 | ## Anti-Patterns |
| 41 | |
| 42 | ❌ Default to PostgreSQL for simple apps (SQLite may suffice) |
| 43 | ❌ Skip indexing |
| 44 | ❌ Use SELECT * in production |
| 45 | ❌ Store JSON when structured data is better |
| 46 | ❌ Ignore N+1 queries |