Skip to content
Back to skills

Database Design

ASecurity

Database decisions - DB and ORM, schema, indexes, queries, migrations. Use when designing or changing a data model.

  • 6 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added December 5, 2026
developmentpythonsqldatabaseperformance

Security analysis

A100/100

Pro scans all 7 files and shows the line behind each finding

Scanned December 5, 2026

npx -y skills add Reprograme/redevkit --skill database-design --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Database Design?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Database Design
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/reprograme-database-design/badge)](https://www.skillsdirectory.com/skills/reprograme-database-design)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: database-design
description: Database decisions - DB and ORM, schema, indexes, queries, migrations. Use when designing or changing a data model.
---

# Database Design

> **Learn to THINK, not copy SQL patterns.**

## Selective Reading Rule

Read ONLY the references relevant to the request. Check the content map and open what you need.

| Reference | Description | When to read |
| --- | --- | --- |
| [database-selection](references/database-selection.md) | PostgreSQL vs Neon vs Turso vs SQLite | Choosing a database |
| [orm-selection](references/orm-selection.md) | Drizzle vs Prisma vs Kysely | Choosing an ORM |
| [schema-design](references/schema-design.md) | Normalization, PKs, relationships | Designing a schema |
| [indexing](references/indexing.md) | Index types, composite indexes | Performance tuning |
| [optimization](references/optimization.md) | N+1, EXPLAIN ANALYZE | Query optimization |
| [migrations](references/migrations.md) | Safe migrations, serverless DBs | Schema changes |

## Core Principle

- When the database preference is unclear and the choice changes the architecture, follow the
  shared question protocol; as a subagent, return the question to the caller
- Choose database/ORM based on CONTEXT (check `.redevkit/memory/tech.md` first)
- Don't default to PostgreSQL for everything

## Decision Checklist

Before designing a schema:

- [ ] Database preference found in memory or the plan, or resolved via the question protocol?
- [ ] Chosen the database for THIS context?
- [ ] Considered the deployment environment?
- [ ] Planned the index strategy?
- [ ] Defined relationship types?
- [ ] Recorded the model in `specs/NNN-short-name/data-model.md`?

## Anti-Patterns

- ❌ Default to PostgreSQL for simple apps (SQLite may suffice)
- ❌ Skip indexing
- ❌ Use `SELECT *` in production
- ❌ Store JSON when structured data is better
- ❌ Ignore N+1 queries
- ❌ Run a destructive migration (drop, truncate, lossy change) without explicit confirmation
  (gate G4)

## Audit

| Audit | Purpose |
| --- | --- |
| `schema_validator.py` | Prisma schema checks: syntax, missing relations, index recommendations, naming |

In the verify command's audit step (not during implementation), when its orchestrator did not already run it, run `.redevkit/audits/schema_validator.py <project_path>` with the Python interpreter detected
per `.redevkit/audits/README.md`. If no Python is available, the audit is
`SKIPPED (no Python)`: say so and fall back to the project's own commands (for example
`npx prisma validate`, `npx drizzle-kit check`, the migration dry run, the test suite). Never
report a skipped audit as PASS.

Files in this skill

  • SKILL.md2.6 KB
  • references/database-selection.md1.1 KB
  • references/indexing.md900 B
  • references/migrations.md1.1 KB
  • references/optimization.md910 B
  • references/orm-selection.md768 B
  • references/schema-design.md1.4 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.