DB Schema Generator

Generate database schemas, migrations, and ERD diagrams from plain English descriptions — supports PostgreSQL, MySQL, SQLite, and MongoDB with proper indexes...

MIT-0 · Free to use, modify, and redistribute. No attribution required.
0 · 198 · 0 current installs · 0 all-time installs
MIT-0
Security Scan
VirusTotalVirusTotal
Benign
View report →
OpenClawOpenClaw
Benign
high confidence
Purpose & Capability
Name and description (generate schemas, migrations, ERDs) match the SKILL.md content. The skill requests no binaries, env vars, or config paths — which is proportional for an instruction-only generator.
Instruction Scope
SKILL.md stays focused on generating schemas, migrations, ERDs, indexes, and seed data from English descriptions. It does include CLI-style usage examples (e.g., `db-schema "..."`) despite there being no install/binary provided — this is a documentation/example artifact rather than an instruction to access system binaries. Also note the seed-data feature could encourage users to paste realistic data into prompts; avoid including private/PII in inputs.
Install Mechanism
No install spec and no code files are present, so nothing is downloaded or written to disk. This is the lowest-risk model for a skill of this type.
Credentials
The skill declares no required environment variables, credentials, or config paths. The instructions do not reference any hidden env vars or credentials — access requests are proportionate to the stated purpose.
Persistence & Privilege
always:false and default invocation settings are appropriate. The skill does not request persistent system presence or modify other skills/configs.
Assessment
This skill is an instruction-only text generator (it produces SQL, migration templates, ERD text). It does not install code or ask for credentials, so installing it carries low technical risk. However: (1) do not paste sensitive or production secrets/PII into prompts — seed data generation can mirror input content; (2) treat generated SQL/migrations as draft: review and test before applying to production databases; (3) the SKILL.md shows CLI examples but no binary is supplied — the agent will generate text, it will not run local migration commands for you. If you need an executable tool integrated into your environment, you should verify or supply a vetted implementation separately.

Like a lobster shell, security has layers — review code before you run it.

Current versionv1.0.0
Download zip
latestvk97f7b24re4q0gewk6pg64qprn82jct6

License

MIT-0
Free to use, modify, and redistribute. No attribution required.

Runtime requirements

🗄️ Clawdis
OSmacOS · Linux · Windows

SKILL.md

DB Schema

Describe your data model in English. Get production-ready schema, migrations, and diagrams.

What It Does

Takes a plain English description of your data and generates:

  • SQL schema (CREATE TABLE statements with constraints)
  • Migration files (for Prisma, Drizzle, Knex, Alembic, etc.)
  • Entity-Relationship diagram (Mermaid or ASCII)
  • Indexes (auto-detected from common query patterns)
  • Seed data (realistic sample data for development)

Usage

From description:

db-schema "Users have many posts. Posts have many comments. Users can like posts."

With options:

db-schema "E-commerce with products, orders, customers" --dialect postgres --orm prisma

Options:

  • --dialectpostgres (default), mysql, sqlite, mongodb
  • --ormraw (default), prisma, drizzle, knex, sqlalchemy, typeorm
  • --formatsql (default), json, markdown
  • --diagram — include ERD diagram: mermaid (default), ascii, none
  • --seed — generate seed data (default: false)
  • --seed-count — rows per table for seed data (default: 10)

Generation Rules

Schema Design:

  1. Every table gets a primary keyid (BIGSERIAL for PG, AUTO_INCREMENT for MySQL, INTEGER AUTOINCREMENT for SQLite)
  2. Timestamps by defaultcreated_at and updated_at on every table
  3. Foreign keys with proper namingtable_id references table(id)
  4. ON DELETE behavior — CASCADE for owned relationships, SET NULL for optional
  5. Proper types — use appropriate types (TEXT not VARCHAR(255) for PG, TIMESTAMPTZ not TIMESTAMP)

Relationship Detection:

EnglishRelationshipImplementation
"has many"One-to-ManyFK on the "many" side
"belongs to"Many-to-OneFK on current table
"has one"One-to-OneFK with UNIQUE constraint
"many to many"Many-to-ManyJunction table
"can like/follow/tag"Many-to-ManyJunction table with metadata

Auto-Indexing:

PatternIndex Type
Foreign keysB-tree index
Email, usernameUNIQUE index
Created/updated datesB-tree index
Status/type/role columnsB-tree index
Full-text search fieldsGIN index (PG) / FULLTEXT (MySQL)
Slug/path columnsUNIQUE index
Composite lookupsComposite index

Type Mapping:

ConceptPostgreSQLMySQLSQLite
IDBIGSERIALBIGINT AUTO_INCREMENTINTEGER
Short textVARCHAR(N)VARCHAR(N)TEXT
Long textTEXTTEXTTEXT
MoneyNUMERIC(12,2)DECIMAL(12,2)REAL
BooleanBOOLEANTINYINT(1)INTEGER
TimestampTIMESTAMPTZDATETIMETEXT
JSONJSONBJSONTEXT
UUIDUUIDCHAR(36)TEXT
EnumCustom TYPEENUM(...)TEXT CHECK

Output (SQL):

-- Generated by db-schema
-- Description: E-commerce with products, orders, customers

CREATE TABLE customers (
    id BIGSERIAL PRIMARY KEY,
    email VARCHAR(255) NOT NULL UNIQUE,
    name VARCHAR(255) NOT NULL,
    created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
    updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);

CREATE TABLE products (
    id BIGSERIAL PRIMARY KEY,
    name VARCHAR(255) NOT NULL,
    description TEXT,
    price NUMERIC(12,2) NOT NULL CHECK (price >= 0),
    stock INTEGER NOT NULL DEFAULT 0,
    created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
    updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);

CREATE TABLE orders (
    id BIGSERIAL PRIMARY KEY,
    customer_id BIGINT NOT NULL REFERENCES customers(id) ON DELETE CASCADE,
    status VARCHAR(50) NOT NULL DEFAULT 'pending',
    total NUMERIC(12,2) NOT NULL DEFAULT 0,
    created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
    updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);

CREATE TABLE order_items (
    id BIGSERIAL PRIMARY KEY,
    order_id BIGINT NOT NULL REFERENCES orders(id) ON DELETE CASCADE,
    product_id BIGINT NOT NULL REFERENCES products(id) ON DELETE RESTRICT,
    quantity INTEGER NOT NULL CHECK (quantity > 0),
    unit_price NUMERIC(12,2) NOT NULL
);

CREATE INDEX idx_orders_customer_id ON orders(customer_id);
CREATE INDEX idx_orders_status ON orders(status);
CREATE INDEX idx_order_items_order_id ON order_items(order_id);
CREATE INDEX idx_order_items_product_id ON order_items(product_id);

ERD Output (Mermaid):

erDiagram
    CUSTOMERS ||--o{ ORDERS : places
    ORDERS ||--|{ ORDER_ITEMS : contains
    PRODUCTS ||--o{ ORDER_ITEMS : "included in"

Files

1 total
Select a file
Select a file to preview.

Comments

Loading comments…