# Design Better Database Schemas

Database choices often ignore workload, deployment, and migration constraints. This skill guides selection, schema design, indexing, optimization, and safer changes.

## Install

```bash
npx skillstore add sickn33/database-design
```

## Metadata

- Status: approved
- Slug: sickn33-database-design
- Skillstore revision: r2
- Version status: missing
- Tree hash: ea0b6a9d05ad675bd965360247da698876a6f10956e9552377bddb9203831677
- Author: sickn33
- GitHub username: sickn33
- License: MIT
- Repository: https://github.com/sickn33/antigravity-awesome-skills/tree/main/skills/database-design
- Ref: f9e2c34b4f19c7f3e6b0a1e93227b5f77cc12526
- Supported tools: Claude, Codex, Claude Code
- Audit status: complete
- Agent install advisory: allowed
- Manual install advisory: allowed
- Artifact signature: available
- Audit attestation: unavailable
- Human verification: not\_verified
- Risk factors: external\_commands
- Quality score: 75
- Public page: https://skillstore.pages.dev/skills/sickn33-database-design
- Manifest: https://skillstore.pages.dev/api/skills/sickn33-database-design/manifest

## Capabilities

- Compares PostgreSQL, Neon, Turso, SQLite, PlanetScale, and CockroachDB for common deployment requirements.
- Guides normalization, primary key selection, timestamps, relationships, and foreign key deletion behavior.
- Recommends index types and composite index ordering based on query patterns.
- Explains N\+1 prevention, execution plan review, selective columns, pagination, and caching priorities.
- Outlines staged migration patterns for columns, indexes, renames, and zero-downtime changes.
- Scans up to ten local Prisma or Drizzle schema files and reports common Prisma issues.

## Use Cases

- Choose a Database Stack: Compare database and ORM options against deployment, latency, query, scaling, and developer experience requirements.
- Review a New Schema: Evaluate entities, keys, relationships, timestamps, normalization, and indexes before implementation.
- Plan Production Changes: Prepare staged migrations and query improvements that reduce locking, downtime, and performance regressions.

## Prompt Templates

### Choose a Database

```
Choose a database for [application]. Requirements include [deployment], [traffic], [query needs], and [availability]. Compare suitable options and explain trade-offs.
```

### Design a Schema

```
Design a schema for [domain]. Include entities, primary keys, relationships, deletion behavior, timestamps, normalization choices, and expected access patterns.
```

### Review Indexes and Queries

```
Review these tables and query patterns: [details]. Recommend indexes, identify N+1 risks, and explain what to verify with execution plans.
```

### Plan a Safe Migration

```
Create a zero-downtime migration plan for [change]. Account for [database], [table size], [deployment process], rollback, backfill, locking, and compatibility.
```

## Limitations

- Database recommendations are general guidance and require validation against real workload, cost, and operational constraints.
- The validator performs detailed checks only for Prisma schemas; discovered Drizzle files receive no validation.
- The validator uses regular expressions, so it cannot fully parse every valid Prisma schema.
- Validation reports warnings and exits successfully, even when schema issues are found.

## Best Practices

- Provide deployment, workload, consistency, latency, and growth requirements before requesting a recommendation.
- Share representative queries and data volumes when planning indexes or optimization.
- Test migrations on a realistic data copy and verify rollback procedures before production.

## Anti Patterns

- Do not choose PostgreSQL or any ORM without comparing requirements and operational trade-offs.
- Do not add indexes without considering write cost, selectivity, and actual query patterns.
- Do not perform breaking schema changes in one deployment step.

## Security Audit

- Audited at: 2026-07-23T22:33:27.575\+00:00
- Summary: All nine static findings are false positives. Backticks in SKILL.md format filenames, while flagged lines elsewhere contain ordinary database guidance and validation logic. No prompt injection or malicious intent was found.

## Stats

- Views: 167
- Downloads: 19
- Favorites: 0
- Popularity score: 0
