scoobydont-666/shared-claude-skills/database-design
Trust tier 3
- community
Source check pending
Checking that the SKILL.md file is still in the repository.
Design SQL schemas, indexes, migrations and data retention for PostgreSQL and SQLite; evaluate integrity, compatibility and query behavior.
Install
npx vskill@latest install scoobydont-666/shared-claude-skills/database-designSKILL.md
Database Design & Schema Management
When to Use
- Designing a new database schema or adding tables
- Reviewing an existing schema for correctness, performance, or security
- Planning migrations (especially for production data)
- Designing indexes for query patterns
- Defining retention/deletion policies for sensitive data
- Evaluating SQLite vs PostgreSQL for a given use case
SQLite vs PostgreSQL Decision
| Factor | SQLite | PostgreSQL | |
|---|---|---|---|
| Single-user/process | Yes | Overkill | |
| Multi-tenant | No | Yes | |
| Multi-process writes | No (WAL helps reads) | Yes | |
| Sensitive data needing RBAC | No | Yes (row-level security) | |
| Schema migrations needed | Manual/limited | Alembic, full ALTER support | |
| Production deployment | Embedded only | Always appropriate | |
| Full-text search | FTS5 (basic) | tsvector/tsquery (rich) | |
| JSON queries | json_extract (basic) | jsonb (rich, indexed) |
Rule: If multi-tenant or handling financial/PII data → PostgreSQL. No exceptions.
Schema Design Checklist
1. Table Design
2. Naming Conventions
3. Normalization
- 1NF: No repeating groups, no arrays in columns (use junction tables)
- 2NF: Every non-key column depends on the full primary key
- 3NF: No transitive dependencies (column A → column B → column C)
- Denormalize intentionally only for proven performance needs, document why
4. Index Strategy
5. Multi-Tenant Isolation
6. Sensitive Data
Migration Strategy
Alembic (Python/SQLAlchemy)
Migration Safety Rules
SQLite Migrations (No Alembic)
SQLite has limited ALTER TABLE support. For schema changes:
- Create new table with desired schema
- Copy data from old table
- Drop old table
- Rename new table to old name
- Recreate indexes and triggers
Wrap in a transaction. Test on a copy first.
Schema Review Protocol
When reviewing an existing schema:
- Read the migration files or CREATE TABLE statements
- Map entity relationships — draw the FK graph mentally
- Check for missing indexes on FK columns and WHERE clause columns
- Check for missing constraints — can invalid data be inserted?
- Check tenant isolation — is tenant_id on every tenant-scoped table? In every query?
- Check for PII — is sensitive data identified and protected?
- Check for orphans — can rows exist without their parent? (missing ON DELETE CASCADE)
- Check for N+1 patterns — are related entities fetched in loops instead of JOINs?
- Output: findings table with severity (Critical/High/Medium/Low) and recommended fix
Anti-Patterns
| Anti-Pattern | Why It's Bad | Fix | |
|---|---|---|---|
| EAV (Entity-Attribute-Value) | Unqueryable, no type safety | Proper columns or JSONB | |
| Soft deletes everywhere | Accumulates garbage, complicates queries | Hard delete + audit log | |
| UUID primary keys on large tables | 4x storage, worse cache locality | BIGINT + UUID as alternate key | |
| Storing JSON blobs for structured data | No referential integrity | Normalize into tables | |
| Missing ON DELETE behavior | Orphaned rows | Explicit CASCADE/RESTRICT | |
| Composite primary keys on 3+ columns | Awkward FK references, join complexity | Surrogate key + unique constraint |
Integration
- tdd: Write schema tests first (can I insert valid data? rejected invalid data?)
- repo-hardening-workflow: Schema review is part of the data governance phase
- code-quality: N+1 queries and missing indexes are performance findings
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/database-design/SKILL.md
Popularity
- Repository stars
- 1
- 7-day trend score
- 3
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/scoobydont-666/shared-claude-skills/database-design)