# database-schema-designer

database-schema-designer — a Claude Code skill that turns product requirements into a normalized relational schema with tables, ORM models, RLS, indexes and migrations. Works across six platforms, including Codex, Cursor and Gemini CLI.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode, Windsurf (Devin Desktop), Claude.ai · 183 installs · ★ 1183 repo stars
- Author: borghei
- License: LicenseRef-MIT-Commons-Clause · policy=link-only · description only; the file stays with the author
- Source: https://github.com/borghei/Claude-Skills/tree/HEAD/engineering/database-schema-designer/SKILL.md
- Updated: 2026-11-08
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/skills/borghei-database-schema-designer

## What it does

The skill targets PostgreSQL, MySQL and SQLite, and writes output as Drizzle, Prisma, TypeORM or Alembic. From a plain-language list of entities and relationships it builds tables, adds `id`, `created_at`, `updated_at`, and where needed `deleted_at`, `organization_id` and `version`. Primary keys use UUIDv7 or CUID2, which keeps B-tree inserts local.

Security gets its own pass. The skill generates Row-Level Security for tenant isolation, column-level PII encryption, and audit logging with before/after JSON snapshots. Migration planning covers rollback SQL and zero-downtime patterns for large tables.

Three Python scripts do the heavy lifting. `schema_validator.py` flags missing FK indexes and soft-delete tables without a partial index. `migration_diffr.py` produces forward and rollback SQL between two DDL versions. `erd_generator.py` renders a Mermaid ERD. You need Python 3 and a `.sql` file to run the first one.

## Requirements
- Works with: PostgreSQL

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add borghei/Claude-Skills --skill database-schema-designer -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/database-schema-designer/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/database-schema-designer/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add borghei/Claude-Skills --skill database-schema-designer -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/database-schema-designer/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add borghei/Claude-Skills --skill database-schema-designer -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/database-schema-designer/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install borghei/Claude-Skills engineering/database-schema-designer/SKILL.md
```

2. **Manually: put the files in place**
- File: `.github/skills/database-schema-designer/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add borghei/Claude-Skills --skill database-schema-designer -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/borghei/Claude-Skills --path engineering/database-schema-designer
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/database-schema-designer/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add borghei/Claude-Skills --skill database-schema-designer -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/borghei/Claude-Skills/tree/HEAD/engineering/database-schema-designer/SKILL.md

## When to use it
- design tables from natural-language requirements
- add RLS and multi-tenancy to a single-tenant schema
- plan a migration with rollback for a large table
- catch missing foreign-key indexes
- render a Mermaid ERD

## Example prompts
- Design tables for orders, products and customers, with soft deletes
- Run `schema_validator.py` on `assets/schema.sql` and show me the errors
- Build a migration from `schema_v1.sql` to `schema_v2.sql`, with the rollback SQL

## Similar
- [database-migration-management](https://affpapa.org/en/nevibecode/skills/database-migration-management.md) — skill · 505 installs
- [planetscale-schema-recommendations-agent-loop](https://affpapa.org/en/nevibecode/skills/planetscale-schema-recommendations-agent-loop.md) — skill · 2000 installs
- [database-design](https://affpapa.org/en/nevibecode/skills/moizibnyousaf-database-design.md) — skill · 624 installs
- [database-expert](https://affpapa.org/en/nevibecode/agents/database-expert.md) — subagent · ★ 763 repo stars
- [database-schema-design](https://affpapa.org/en/nevibecode/skills/database-schema-design.md) — skill · 599 installs
- [relational-database-mcp-cloudbase](https://affpapa.org/en/nevibecode/skills/relational-database-mcp-cloudbase.md) — skill · 962 installs

## Other versions with the same name
- [database-schema-designer · softaworks](https://affpapa.org/en/nevibecode/skills/softaworks-database-schema-designer.md) — 4400 installs
- [database-schema-designer · alirezarezvani](https://affpapa.org/en/nevibecode/skills/database-schema-designer.md) — 692 installs
- [database-schema-designer · onewave-ai](https://affpapa.org/en/nevibecode/skills/onewave-ai-database-schema-designer.md) — 432 installs

From the same set: [borghei/claude-skills](https://affpapa.org/en/nevibecode/by/borghei/claude-skills.md) — 120 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
